I have now been able to intermittently reproduce the errors similar to your Bug #1, but not yet Bug #2, using the code above for the ALT key. (So, it seems not to matter whether one uses the ALT key or the SHIFT key as the doubletap.)
- If I type [Alt+f+ALT Alt+f+ALT in succession like that, repeatedly and at different speeds, it makes a difference:
- Typing it in succession sometimes outputs "ff", which is an AHK abbreviation hotkey for me, producing "Firefox" (that's how I know "ff" must have been output).
- If I type it very quickly, then it will sometimes output the "f" test message box.
From this, I at first surmised that what
may be happening here is that, due to timing delays/interrupts/collisions (or something) in the keyboard controller, the keys are arriving
out of sequence at the buffers for
A_ThisHotkey and
A_PriorHotkey. I mean, that could be the explanation for
Alt+f+ALT --> "ff". However, that probably could not occur unless the keyboard controller were on the blink. More likely is that the "f" is put into and remains in a buffer, and the "ALT" does not, so the next "f" arrives next to the
first "f".
Typing
Alt+f+ALT Alt+f+ALT repeatedly at speed will occasionally lead to two ALTs occurring close together (back-back) and within 2 seconds the "f" following, thus creating a match in the
A_ThisHotkey and
A_PriorHotkey, and the "f" thus triggering a valid action (the Message Box). So it's probably just an accident of event sequence and timing. So it's
not a bug.
I suspect that this event sequence and timing accident may be at root of the cause of your
Bug #2 also, and that using a different (non-Shift) and little-used doubletap key will avoid/reduce the potential for that particular "bug".
The obvious thing to do would be to put NULLs or (better) odd/different and non-SHIFT/ALT values in
A_ThisHotkey and
A_PriorHotkey, after setting
Double_SHIFT := false (so they then likely would not match next time around, whatever the next key pressed), however, that seems to be something that is not possible in AHK.
Listing
all the possible endkeys as per <https://stackoverflow.com/questions/43701593/authohotkey-exclusive-double-tap-shift-followed-by-action-key> would seem to be a really kludgy way of working around this, but maybe there
is no more elegant way to work around it.
You could still consider using the
TapTap executable, I suppose...