Skip to content

Instantly share code, notes, and snippets.

@AndreVallestero
Created April 26, 2020 03:22
Show Gist options
  • Save AndreVallestero/1070eeadd8de7e65f09b113254950a7a to your computer and use it in GitHub Desktop.
Save AndreVallestero/1070eeadd8de7e65f09b113254950a7a to your computer and use it in GitHub Desktop.
AutoHotKey delayed key hold trigger
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