Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
    
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
add comment

1 Answer

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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