Input, SendEvent and a Hotkey

Report problems with documented functionality
User avatar
Barney
Posts: 50
Joined: 28 May 2014, 20:03
Location: Germany

Input, SendEvent and a Hotkey

Post by Barney » 21 Mar 2018, 14:46

The following script behaves inconsistently.

Code: Select all

^g::
SendEvent, a
Input, UserInput, T1
Keeping Control and g key pressed down produces aaggggggg.... Releasing the keys and keeping them pressed down a second time produces aaaaaaaaaa....
In the first case it is like the Control key is not put back into down state after sending a with the consequence that the hotkey is not triggered again. I don't know
User avatar
Nextron
Posts: 1218
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win7 x64 AHK: Unicode x32

Re: Input, SendEvent and a Hotkey

Post by Nextron » 21 Mar 2018, 15:36

It could be this The hotkey isn't a hooked hotkey. If no hook is installed by other means, it relies on #HotkeyModifierTimeout after the Send command, breaking the hotkey until you physically press control again. However, after Input is issued, the hook is installed so the modifier state is properly tracked. It looks like the hook isn't unloaded afterwards if it keeps working properly.

Try replacing the hotkey with: $^g:: so it does use the hook and it should work the first time.
Post Reply

Return to “Bug Reports”