I tried to replicate the same for NumLock and ScrollLock but they don't toggle at all.
What is it that I'm doing wrong?
Code: Select all
TOGGLE_CapsLock:
If GetKeyState("CapsLock", "T") = 1
SetCapsLockState, Off
Else If GetKeyState("CapsLock", "F") = 0
SetCapsLockState, On
Return
RETURN
TOGGLE_NumLock:
If GetKeyState("NumLock", "T") = 1
SetNumLockState, Off
Else If GetKeyState("NumLock", "F") = 0
SetNumLockState, On
Return
RETURN
TOGGLE_ScrollLock:
If GetKeyState("ScrollLock", "T") = 1
SetScrollLockState, Off
Else If GetKeyState("ScrollLock", "F") = 0
SetScrollLockState, On
Return
RETURN
; ============================================================================
Shift & CapsLock::Gosub, TOGGLE_CapsLock ; <------- works
Shift & NumLock::Gosub, TOGGLE_NumLock ; <--------- doesn't work
Shift & ScrollLock::Gosub, TOGGLE_ScrollLock ; <--- doesn't work