RainingChain
RainingChain

Reputation: 7792

AHK: Unpress All Pressed Keys

Is there a way to unpress all pressed keys with AHK?

By pressed, I mean Send {something down}

and by unpress I mean Send {something UP}

Upvotes: 5

Views: 4671

Answers (2)

Reasel
Reasel

Reputation: 93

Just in case when you say "messes up with the rest of my work." do you mean triggers other hotkeys? Because if so you can disable Hotkeys:

Hotkey, ^c, Off ; Disables the Ctrl + C hotkey
Hotkey, ^c, On ; Enables the Ctrl + C hotkey
Hotkey, ^c, Toggle ; Flips Ctrl + C to other state in this case to Off
Hotkey, ^c, Toggle ; Flips Ctrl + C to other state in this case to On

Hopefully that is helpful. You can find full documentation here.

Upvotes: 0

Elliot DeNolf
Elliot DeNolf

Reputation: 2999

You're in the right direction. All you would need to do is to create a list of keys to check, then add an if statement (if needed at all) to unpress the keys if pressed.

KeyList := "Shift|a|b|c|d|e|f|g|h|i|j" ; and so on

Loop, Parse, KeyList, |
{
    If GetKeystate(A_Loopfield, "P")
        Send % "{" A_Loopfield " Up}"
}

Upvotes: 7

Related Questions