问题描述
在几种情况下,我的控制键卡住了,并且只有在我运行AutoHotkey时才会发生.使用多个不同的修饰键(尤其是#(Windows)键,!(alt)键)会发生这种情况.
I have several situations when my control key gets stuck, and it happens only when I have AutoHotkey running. This happens with multiple different modifier keys (# (windows) key, ! (alt) key especially).
类似的问题之前曾发布过多次: 1 , 2 , 3 .存在一些解决方案,并且此处建议的解决方案部分地帮助了我(降低了问题发生的频率),但是控制键仍然偶尔卡住.我尝试过的事情包括 #InstallKeybdHook .
Similar problems have been posted several times before:1,2,3. Some solutions exists, and the one suggested here partially helped me (decreased the frequency of the problem), but the control key still gets stuck occasionally. Things I have tried include #InstallKeybdHook.
我有两个问题:
- 是否可以防止此问题?
- 有什么好方法可以让AutoHotkey尽快解决此问题吗?
我已经尝试了上面建议的所有内容,并创建了自己的StuckKeyUp函数版本如此处建议):
I have tried everything suggested above, and created my own version of a StuckKeyUp function (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
}
推荐答案
其他调试方法您可以尝试以下方法:
Among other debugging methodsyou can try this:
将此代码放在脚本中的特定位置(在发送控制键的热键定义中或在计时器中)
Put this code at specific positions in your script (within hotkey definitions that send the control key or in a timer)
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(在关闭消息框后),在这种情况下密钥会卡住.
and look in the KeyHistory (after closing the message box) in which situations the key gets stuck.
这篇关于AutoHotkey导致控制键卡住的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!