Code: Select all
SetCapsLockState, AlwaysOff
e.g.
Code: Select all
SetCapsLockState, AlwaysOff
CapsLock & Space::foo()
Uh...how to fix this issue ?
Code: Select all
SetCapsLockState, AlwaysOff
Code: Select all
SetCapsLockState, AlwaysOff
CapsLock & Space::foo()
Sorry my bad.Nextron wrote:Your example works for me..?
Code: Select all
SetCapsLockState AlwaysOff
Code: Select all
CapsLock & Space::foo()
Should I combine those two scripts ?Nextron wrote:For me it is only blocked if SetCapsLockState AlwaysOff is called after the hotkey script. This could mean that SetCapsLockState AlwaysOff works by setting the state and then using the keyboard hook to drop all key presses. Any other non-admin hooks loaded before it wouldn't see the events either, those loaded after it or hotkeys using the same hook (same script) would.
Don't multiple files means mutliple threads ?Nextron wrote:I prefer to combine scripts as much as possible. Whether performance is impacted greatly depends on your use-case. I think that unless your doing really time sensitive things or interacting with the AHK process itself, you're pretty safe.
Thank you so much for those explnations.Nextron wrote:True, multiple threads may improve speed. Like I said, it greatly depend on your use-case. Having multiple scripts for simple text replacement hotkeys may decrease performance: SendInput reverts to SendEvent, multiple hooks are processed (sequentially). On the other hand, CPU heavy (compression) or slow tasks (writing/uploading files) may block execution of other tasks unless those are executed as a separate process.
In your situation it is clear: Hook of script A blocks a key which is required in script B. Either you:
• Execute script B after A.
• Run script B as admin, and A as a regular user.
• Combine those element in a single script.
A fourth option would be to not block the CapsLock key so it remains visible, but set it to off as soon as it turns on, but you'll end up with a LED that flashes on each time.