Actual behavior: CapsLock does act like Ctrl, but if I hold it down for about one second, it also toggles CapsLock. Depending on the implementation, it may cycle, toggling CapsLock on and off until I release CapsLock. (Ctrl+CapsLock, does toggle CapsLock immediately, though it too may cycle if I hold it.)
I've tried all kinds of ways to do this. Some examples are below.
I've tried it with and without $ prefixes, with and without SendMode Input, with and without KeyWait
I haven't tried SendLevel & SendInput. I haven't tried AHKv2. But I'm willing to try anything.
Code: Select all
#SingleInstance Force
#NoEnv
SendMode Input
; Ctrl+CapsLock toggles CapsLock:
$^CapsLock::CapsLock
; Turn CapsLock into Ctrl:
$CapsLock::LCtrl
Code: Select all
;Auto-Execute
SetStoreCapslockMode, Off ;makes `Send {CapsLock}` always toggle its state
return
#SingleInstance Force
#NoEnv
SendMode Input
; Ctrl+CapsLock toggles CapsLock:
$^CapsLock::
Send {CapsLock}
Return
; Turn CapsLock into Ctrl:
$CapsLock::LCtrl
Code: Select all
#SingleInstance Force
#NoEnv
SendMode Input
; Ctrl+CapsLock toggles CapsLock:
$^CapsLock::
Switch GetKeyState("CapsLock", "T") {
Case 0: ; CapsLock off
SetCapsLockState, On
Case 1: ; CapsLock on
SetCapsLockState, Off
}
KeyWait, CapsLock
Return
; Turn CapsLock into Ctrl:
$CapsLock::LCtrl