当我的控制键卡住时,有几种情况,并且只有在运行AutoHotkey时才会发生。使用多个不同的修饰键(尤其是#(Windows)键,!(alt)键)会发生这种情况。

之前已经多次发布过类似的问题:
1
2
3。存在一些解决方案,并且the one suggested here partially helped me(降低了问题发生的频率),但是控制键仍然偶尔会卡住。我尝试过的东西包括#InstallKeybdHook

我有两个问题:


有可能预防此问题吗?
有什么好方法可以让AutoHotkey尽快解决此问题吗?


我已经尝试了上面建议的所有内容,并创建了自己的StuckKeyUp函数(as suggested here)版本:

StuckKeyUp(){
sleep 300
send {<# up}
send {># up}
send {# up}
send {+ up}
send {<+ up}
send {! up}
send {<! up}
send {>! up}
send {^<^^>! up}
send {^<^>! up}
send {^ up}
send {Ctrl down}
send {Ctrl up}

Send {§ up}
Send {Shift Up}
Send {LShift Up}
Send {RShift Up}
Send {Alt Up}
Send {LAlt Up}
Send {RAlt Up}
Send {Control Up}
Send {LControl Up}
Send {<^ down}
Send {<^ Up}        ; solves some issues, but not all
Send {>^ down}
Send {>^ Up}
Send {RControl Up}
Send {LControl Up}
Send {LWin Up}
Send {RWin Up}
sleep 100
; reload, ; Avoid - Reloading AutoHotkey File causes functions depending on this function to break
return
}

最佳答案

除其他debugging methods
您可以尝试以下方法:

将此代码放在脚本中的特定位置(在发送控制键的热键定义中或在计时器中)

If GetKeyState("Ctrl")           ; If the OS believes the key to be in (logical state),
{
    If !GetKeyState("Ctrl","P")  ; but  the user isn't physically holding it down (physical state)
    {
        Send {Blind}{Ctrl Up}
        MsgBox,,, Ctrl released
        KeyHistory
    }
}


并查看KeyHistory(在关闭消息框之后),在这种情况下密钥会卡住。

08-26 01:28