6

I want the "End" key to block/lock certain keys like a,s,d,i,j,k,l. And when I click "End" again to unblock the same keys (a,s,d,i,j,k,l). How can I do this in Autohotkey? Can someone please tell me the commands and functions?

  • Why would you want to do this? – David Feb 19 '13 at 21:47
  • I think @user 99572 is fine should be marked answer; it was very specific and thorough. – ingredient_15939 Oct 10 '13 at 15:09
10

AutoHotkey has 2 functions that might help you:

  1. "Suspend", which will stop all hotkeys in a script from working.
  2. "return", which can be used to disable single keys or hotkeys (and mouse buttons).

Now you can turn these 2 functions to your advantage.

Just place this line of code somewhere in your script:

end::Suspend

This will suspend the script when you press End. Once the script is suspended, the keys will function normally. Once you activate the script with End, the keys will be disabled.

You can disable keys by running a script like this:

a::return
b::return
...

Works like a charm.

Just for simplicity's sake, the whole script will look like this:

end::Suspend
a::return
b::return

Just add any keys you want to disable below the last return. If you want to disable other keys than letters or numbers, just consult the comprehensive Key List. Place the name of the key before the 2 colons: e.g. NumPad0::return

Save the script in a file with extension .ahk, like "disablekeys.ahk". Double click on it or create a shortcut to it in the startup folder if you want it to start automatically. Done.

| improve this answer | |
0

Activate:
1. In Windows, you can pin it to taskbar or startmenu
2. right click pinned icon and click properties
3. give that a shortcut key which can be used to call/activate

Deactivate:
You can suspend ahk script via

#Pause::Suspend


Not a good solution but works

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.