1

对不起,我的英语不好。

#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)时,它会使所有自动热键脚本热键和自动热键的托盘菜单快捷方式无效(没有暂停或暂停,只是热键不起作用)。这是为什么?如何解决这个问题?

4

1 回答 1

0

您提供的信息很少……我可以想象您可能会点击Ctrls例如在 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
于 2013-02-25T11:20:32.747 回答