Purpose: When doing formula's in a spreadsheet, I want to be able to add a parenthesis without taking my hand off of the keypad.
How can I remap NumLock with AutoHotKey to do the following:
- Single press = changes NumLock state (If ON, then OFF. If OFF, then ON.)
- Double press followed by NumpadDiv = Left Parenthesis
- Double press followed by NumpadMult = Right Parenthesis
- Double press, followed by nothing = nothing changes (timeout)
My code:
~NumLock::
if (A_PriorHotkey <> "~NumLock" or A_TimeSincePriorHotkey > 400)
{
; Too much time between presses, so this isn't a double-press.
send {numlock}
return
}
SetTimer, WatchKeys, 200
return
WatchKeys:
if GetKeyState("NumpadDiv")
SendInput, {(}
else if GetKeyState("NumpadMult")
SendInput, {)}
else
SetTimer, WatchKeys, off
SetNumlockState, on
return