windows-10 - AutoHotkey 导致控制键卡住

标签 windows-10 autohotkey modifier-key

当我的控制键卡住时,我有几种情况,只有在我运行 AutoHotkey 时才会发生。这发生在多个不同的修饰键上,包括 control (^)、windows (#) 和 alt (!) 键。
类似的问题之前已经发过几次了:
1 ,
2 ,
3 .存在一些解决方案,并且 the one suggested here partially helped me (降低了问题出现的频率),但控制键仍然偶尔卡住。我尝试过的事情包括 #InstallKeybdHook .
我有两个问题:

  • 是否有可能防止这个问题?
  • 当按键被卡住时,是否有一个让 AutoHotkey 监控的好方法(例如,当按键被按住超过 10 秒时自动通知)并在它发生时立即修复它?

  • 我已经尝试了上面建议的所有方法,并创建了我自己的 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(关闭消息框后)在哪些情况下 key 卡住了。

    关于windows-10 - AutoHotkey 导致控制键卡住,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49009176/

    相关文章:

    c# - 按住修饰键时,所有 WPF 上下文菜单似乎都无法正确处理突出显示的项目

    安卓工作室 Windows 10 (64)

    c# - Visual Studio 无法使用调试器 (AccessViolationException)。随机顺序执行的代码

    android - 谷歌地图发布 key 的 SHA1 显示一些加密文本

    text - 在 AutoHotkey 中快速发送长文本

    autohotkey - 如果修饰键按下,如何禁用键盘重新映射?

    python - 以编程方式刷新 PATH 中的环境变量引用 (Windows 10)

    keyboard - 将电子邮件、浏览器等的键盘热键转换为媒体控制键

    java - KeyEvent 监听器中的多个键