I want to disable a key after I press certain times but I cant make it work. I am not sure if I have logical error.
Code: Select all
$6::
Test("6", "o")
return
Code: Select all
Global f
Test(key1, key2) {
f := 0
While GetKeyState(key1, "p")
{
Send, {%key2%}
ToolTip % f, 1200, 600, 20
f := f + 1
delay := 10
if (f >= 20) {
Hotkey, %key1%, Label, On
if (GetKeyState(original, "p") = 0)
Hotkey, %key1%, Label, Off
}
}
}
Code: Select all
Label:
return
I tried to swap the position of On and Off. From the documentation, I think "Off" should be disabling the key
https://www.autohotkey.com/docs/commands/Hotkey.htm
However, this example is using "On" to turn off the key.
https://autohotkey.com/board/topic/9557 ... -keyboard/
I am not quite sure so I tried either way.
Thanks!