Remap 2 keys to 1

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
jmp1992
Posts: 3
Joined: 19 Jul 2017, 22:16

Remap 2 keys to 1

19 Jul 2017, 22:20

Hi, I have this problem. When I press "s" in my keyboard, it writes "s1", so I want to make a script to delete the "1" after the "s". Help please :D
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: Remap 2 keys to 1

19 Jul 2017, 22:26

Code: Select all

~s::Send {Backspace}
[/code

or with a delay:

[code]
~s::
Sleep 50 ; 50 milliseconds
Send {Backspace}
return
You could also try:

Code: Select all

s & 1::Send s
But those options rely on your s always typing s1.

Alternatively, you could try this:

Code: Select all

~s::Hotkey, 1, null ; this enables a hotkey for 1 that will run the null-label below when the 1 is pressed
~s up::Hotkey, 1, off ; disables the 1 hotkey, so the 1 key can be used normally

null: ; this label makes the hotkey have no effect, except blocking the original key (1).
return
Some links are in the code above, but additional links are: modifiers (for an explanation on what ~ does), the Hotkey command (how the 1 hotkey was created) vs the general use of Hotkey (how the s hotkeys were created), and labels.
jmp1992
Posts: 3
Joined: 19 Jul 2017, 22:16

Re: Remap 2 keys to 1

19 Jul 2017, 22:37

Thank you so much :D
jmp1992
Posts: 3
Joined: 19 Jul 2017, 22:16

Re: Remap 2 keys to 1

19 Jul 2017, 22:37

Thank you so much :D

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: AlFlo, GEOVAN, Joey5 and 143 guests