I would like to use my numeric pad for some actions when it is disabled (AutoHotKey V2)
This is easy for the inner keys that have different names depending on the state of NumLock:
NumpadRight:: MsgBox("pressed right arrow when numpad is off")
What I managed to do for the outer keys such as * (that do not have specific names dependent on the status of the numeric pad) is quite barbaric because I have to repeat the status check for every command:
NumpadMult:: {
if (!GetKeyState("NumLock", "T"))
MsgBox("specific action for NumLock off")
else
Send "*"
}
Is there a simpler way to check for NumLock status when having several actions?
I tried the following, but the state of NumLock does not seem to be reassessed after the initial script startup (I always get a popup with the correct state 0
or 1
):
if (GetKeyState("NumLock", "T")) {
NumpadMult:: MsgBox(GetKeyState("NumLock", "T"))
}