This is the code I'm using:
Code: Select all
targetActive := false
keystate := false
#Persistent
SetTimer, MayusRight, 250
return
MayusRight:
IfWinActive, ahk_exe notepad.exe
if ( targetActive == false ){
targetActive := true
if ( GetKeyState(CapsLock, "T") == 1 ){
keystate := true
} else {
keystate := false
}
SetCapsLockState, AlwaysOn
}
IfWinNotActive, ahk_exe notepad.exe
if ( targetActive == true ){
targetActive := false
if ( keystate == true ){
SetCapsLockState, On
} else {
SetCapsLockState, Off
}
}
return
I know that code is inefficient and maybe it's something easy I'm not seeing but I would appreciate any help