Created
April 26, 2020 03:22
-
-
Save AndreVallestero/1070eeadd8de7e65f09b113254950a7a to your computer and use it in GitHub Desktop.
AutoHotKey delayed key hold trigger
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HOLD_TIME = 3000 ; Time required to toggle key in milliseconds | |
KEY_TO_TOGGLE = g ; Key to toggle on and off | |
~LButton:: | |
hold_until_tick := A_TickCount + HOLD_TIME | |
SetTimer, ToggleKey, % -HOLD_TIME | |
return | |
ToggleKey: | |
if (A_TickCount >= hold_until_tick and GetKeyState("LButton")) | |
Send, % "{" KEY_TO_TOGGLE ((key_down := !key_down) ? " down}" : " up}") | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment