My specific setup is a last generation, top of the line X1 Carbon running fully patched Windows 10. (While I doubt hardware or OS matters here, I'm including just in case.) The problem has been with me for years and still appears in the latest AHK release which at this time is 1.1.25.01, 64-bit.
Some things I've tried without success:
(1) KeyWait at the beginning of the macro, e.g.
Code: Select all
#0::
KeyWait, LWin
KeyWait, 0
MsgBox "xxxxx"
Return
(2) "ReleaseModifiers" script, e.g.
Code: Select all
ReleaseModifiers(timeout := "") ; timeout in ms
{
static aModifiers := ["Ctrl", "Alt", "Shift", "LWin", "RWin"]
startTime := A_Tickcount
while (isaKeyPhysicallyDown(aModifiers))
{
if (timeout && A_Tickcount - startTime >= timeout)
return 1 ; was taking too long
sleep, 5
}
return
isaKeyPhysicallyDown(Keys)
{
if isobject(Keys)
{
for Index, Key in Keys
if getkeystate(Key, "P")
return key
}
else if getkeystate(Keys, "P")
return Keys ;keys!
return 0
}
}
Also tried solutions posted elsewhere, e.g. https://autohotkey.com/boards/viewtopic.php?f=5&t=26760 and https://autohotkey.com/board/topic/9409 ... ways-down/
The only thing I've found that consistently gets me out of the stuck key situation is to kill and relaunch AHK, which is not a terribly convenient workaround.
Hoping someone can help end this long national nightmare!