Wrong hotkey script triggered
Posted: 14 Dec 2017, 14:53
I have Auto Hotkey V 1.1.26.01 installed on a Windows 7 Machine. With an Intel i5-2500 CPU and 16 gig of ram.
The script that is not working right consists of 256 hotkey definitions. One for every possible modifier key state with the F13 Key. I am using an Adafruit Feather with the 32u4 Arduino processor to emulate a keyboard and send keystrokes to the computer.
After loging all of the keystrokes I send and what hotkey scripts get triggered I have found a pattern. If the keystroke has both the left and right of Ctrl, Shift, Alt, or Win keys, AHK will sometimes ignore either the left or the right modifier key but never both. Also if I am sending the Left and Right of 2 or 3 keys, it will sometimes ignore the left or right of 1, 2 or all 3 of them (most of the time it only ignores one of them). It can sometimes ignore the left of one of them and the right of another. The baffling part is that it is only sometimes. I also discovered if I rearrange the order the hotkey definitions are in the ahk file, the keystrokes that fire incorrectly change.
For example 2 of the hotkey scripts look like this
<^<+<#F13::Send, 011 - LCtrl LShift LWin F 13{enter}
Return
<>^<+<#F13::Send, 027 - LCtrl LShift LWin RCtrl F 13{enter}
Return
When the keystrokes are sent for the second one the first on get's triggered. In this case the right control key is being ignored. The reason I'm 99% sure this is an issue with auto hot key is if I take that first hot string out of the script or just move it to the end, then the second one works correctly. To be clear though this is just a part of the file. I have never tried just those 2 hotkeys in a script. But I have tried to put the hotkeys in different order in a script and when I do, the errors still happen but on different hotkeys. I know that it does work with all modifier keys because this hotkey always fires correctly.
<>^<>+<>!<>#F13::Send, 255 - LCtrl LShift LAlt LWin RCtrl RShift RAlt RWin F 13{enter}
Return
It can happen for very simple cases. For example the LAlt RAlt F13 triggers the RAlt F13 hotkey script. It even happens if I program the Arduino to send keystrokes 10 seconds apart. So how fast I send the keystrokes ins't the issue.
This is for a programmable touchscreen keypad I am working on. To give it more power I want to have it send unused keystrokes to fire AHK hotkeys. Since F13-F24 aren't on any keyboard I have ever seen I figure it is safe to use those. But 12 isn't enough so I am trying to use every modifier key state to give me plenty of options. With not being able to use both the left and right of a give modifier key at the same time, it takes my total number of hotkeys using the F13-F24 from 3072 to 972. I don't think that will be a big deal since I don't think I will ever use that many hotkeys and for simple keyboard macros I don't need to use those keys to trigger a AHK script. But it does seem to be a bug that could come up for some users.
I have attached the AHK scrip I have been using.
Chris W.
The script that is not working right consists of 256 hotkey definitions. One for every possible modifier key state with the F13 Key. I am using an Adafruit Feather with the 32u4 Arduino processor to emulate a keyboard and send keystrokes to the computer.
After loging all of the keystrokes I send and what hotkey scripts get triggered I have found a pattern. If the keystroke has both the left and right of Ctrl, Shift, Alt, or Win keys, AHK will sometimes ignore either the left or the right modifier key but never both. Also if I am sending the Left and Right of 2 or 3 keys, it will sometimes ignore the left or right of 1, 2 or all 3 of them (most of the time it only ignores one of them). It can sometimes ignore the left of one of them and the right of another. The baffling part is that it is only sometimes. I also discovered if I rearrange the order the hotkey definitions are in the ahk file, the keystrokes that fire incorrectly change.
For example 2 of the hotkey scripts look like this
<^<+<#F13::Send, 011 - LCtrl LShift LWin F 13{enter}
Return
<>^<+<#F13::Send, 027 - LCtrl LShift LWin RCtrl F 13{enter}
Return
When the keystrokes are sent for the second one the first on get's triggered. In this case the right control key is being ignored. The reason I'm 99% sure this is an issue with auto hot key is if I take that first hot string out of the script or just move it to the end, then the second one works correctly. To be clear though this is just a part of the file. I have never tried just those 2 hotkeys in a script. But I have tried to put the hotkeys in different order in a script and when I do, the errors still happen but on different hotkeys. I know that it does work with all modifier keys because this hotkey always fires correctly.
<>^<>+<>!<>#F13::Send, 255 - LCtrl LShift LAlt LWin RCtrl RShift RAlt RWin F 13{enter}
Return
It can happen for very simple cases. For example the LAlt RAlt F13 triggers the RAlt F13 hotkey script. It even happens if I program the Arduino to send keystrokes 10 seconds apart. So how fast I send the keystrokes ins't the issue.
This is for a programmable touchscreen keypad I am working on. To give it more power I want to have it send unused keystrokes to fire AHK hotkeys. Since F13-F24 aren't on any keyboard I have ever seen I figure it is safe to use those. But 12 isn't enough so I am trying to use every modifier key state to give me plenty of options. With not being able to use both the left and right of a give modifier key at the same time, it takes my total number of hotkeys using the F13-F24 from 3072 to 972. I don't think that will be a big deal since I don't think I will ever use that many hotkeys and for simple keyboard macros I don't need to use those keys to trigger a AHK script. But it does seem to be a bug that could come up for some users.
I have attached the AHK scrip I have been using.
Chris W.