Hotkey使Autohotkey不活动直到重新加载

时间:2013-02-24 20:54:59

标签: autohotkey

抱歉我的英语不好。

#IfWinActive, ahk_class PX_WINDOW_CLASS

~^s::
KeyWait, s, U
WinWait, This is an unregistered copy ahk_class #32770,, 500
IfWinExist, This is an unregistered copy ahk_class #32770
    WinKill, This is an unregistered copy ahk_class #32770
Return

我的问题有时当我按下此热键(ctrl + s)时,它会使所有自动键盘脚本热键和自动键盘的托盘菜单快捷键无效(不暂停或暂停,只有热键不起作用)。这是为什么?如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

你提供的信息非常少......我可以想象你可能会点击 Ctrl s ,例如在PX_WINDOW_CLASS中保存文件。如果当时没有激活与您的winwait匹配的窗口,则不会发生任何事情,AutoHotKey将等待并等待......

建议:缩短WinWait中的超时,添加退出并删除多余的行

SetTitleMatchMode=2 ; Find the string "This is an unregistered copy" anywhere in your Title
#IfWinActive, ahk_class PX_WINDOW_CLASS
    ~^s::
    KeyWait, s, U ; Why do you have this in there? are you hanging on your s key for more than 2 seconds?
    WinWait, This is an unregistered copy,,2 ; Wait for two seconds (or a bit longer..)
    if ErrorLevel ; If timeout of WinWait
        Return
    WinKill ; uses ID found in WinWait
    Return
#IfWinActive

或更短......

SetTitleMatchMode=2
#IfWinActive, ahk_class PX_WINDOW_CLASS
~^s::
    WinWait, This is an unregistered copy,,2
    if not ErrorLevel
        WinKill ; uses ID found in WinWait
Return
#IfWinActive