Hello,
I'm fairly new to Auto hot key and I want to disable capsLock functionality only when a certain application is active, so naturally I tried to combine #HotIf WinActice("App name") with setCapsLockState "AlwaysOff", but it doesn't seem to make any impact.
following is the script I'm trying.
#Requires AutoHotkey v2.0
#HotIf WinActive("App name")
SetCapsLockState "AlwaysOff"
return
If I replace SetCapsLock state, with something like ^q::MsgBox "You pressed Control+Q in app name", that seems to work fine. Does this mean #HotIf WinActive("App name") can only work with creating key board shortcuts and macros and not with SetCapsLockState?
using SetCapsLockState with #HotIf WinActive
Re: using SetCapsLockState with #HotIf WinActive
#HotIf only applies to hotkeys and hostrings remaps as described at the very top of its documentation page. This will disable the CapsLock key only when the designated window is active:
Code: Select all
#Requires AutoHotkey v2.0
#HotIf WinActive("App name")
CapsLock::return
Re: using SetCapsLockState with #HotIf WinActive
Thanks for writing back, I wasn't aware that SetCapsLockState is not considered a hotkey / hot string. The solution you shared does disable the capslock key, but as I mentioned I'm only interested in disabling the capslock functionality and not the key itself. Basically the program I want to do this for is a game and I don't want to disable the key since it serves other functionality in game, I only want to disable the capslock toggling functionality linked to this key temporarily.