Wrong script being triggered

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
cdw3423
Posts: 5
Joined: 10 Dec 2017, 14:43

Wrong script being triggered

12 Dec 2017, 11:27

I have a simple AHK script that has 256 hot keys defined, 1 for every possible modifier key state combined with F13. I have a micro-controller that is configured to act as a keyboard and have it programmed to fire all of these hot keys in order. But in several cases AHK triggers the wrong hot key. The odd thing is that the very last one that contains every modifier key does work fine. For now this is just for testing for a project I am working on. Here is an example of what the script looks like.

<>^<>+<>!<>#F13::
Send, 255 - 1111-1111 LCtrl LShift LAlt LWin RCtrl RShift RAlt RWin F 13{enter}
Return

The 255 and 1111-1111 is the bitmap modifier key state in decimal and binary. As I said, that one does work. All the ones that trigger the wrong hot key script, trigger one that is missing 1 or 2 of the modifier keys but never contains modifier keys the correct one doesn't. I have also found that if I move one of the scripts that is incorrectly triggered to the end of the file, the correct hot key is triggered. But I have not found an order that will get them all to fire correctly and can't see any pattern to what it is doing. In some cases it is only using 3 modifier keys and still fires the wrong script. For example, when I send LAlt LWin RAlt F13, AHK triggers LAlt LWin F13.

At first I thought maybe I was sending the key strokes too fast so I slowed it down to wait 10 seconds between each key stroke but I still get the same result.

I tried to duplicate this with my actual keyboard with the F10 key but my keyboard won't send more than 3 modifier keys at once and I'm still using my 23 year old Gateway AnyKey programmable keyboard that doesn't have the windows keys.

I guess this is a bug in AHK. Has anyone seen this before or have any idea on a work around?

Thanks for your help,
Chris W
cdw3423
Posts: 5
Joined: 10 Dec 2017, 14:43

Re: Wrong script being triggered

13 Dec 2017, 13:57

After looking more closely at all of the keystrokes that were incorrectly triggered by AHK I found a common theme. If the keystroke I am sending via the micro-controller has both the left and right version 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 of those 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). 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. At this point I'm 99% sure it is a bug in AHK but if I avoid using the both left and right of a modifier key at the same time, I can avoid this. That takes the total number of usable modifier key combinations from 256 to 81, but that should still be enough for the project I am working on.

Chris W

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 325 guests