Page 1 of 1

Input, SendEvent and a Hotkey

Posted: 21 Mar 2018, 14:46
by Barney
The following script behaves inconsistently.

Code: Select all

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

Re: Input, SendEvent and a Hotkey

Posted: 21 Mar 2018, 15:36
by Nextron
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.