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?
2 Answers
AutoHotkey has 2 functions that might help you:
- "Suspend", which will stop all hotkeys in a script from working.
- "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.
-
3
-
-
Any idea how I can make this work in a particular application? superuser.com/questions/1427953/… Apr 21, 2019 at 21:46
-
@JanacMeena I see you got the answer. TitleMatch is a bit cumbersome to get right. Apr 26, 2019 at 13:10
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