2013-02-24 115 views
1

对不起,我的英语不好。热键使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)它使所有的AutoHotkey脚本热键和AutoHotkey的的托盘菜单快捷键激活(未暂停或中止,只是热键不工作)。这是为什么?如何解决这个问题?

+0

你有没有 “关闭” 的#IfWinActive在结束了吗?在Return下,用'#IfWinActive'添加一行。看看这是否解决您的问题。 – 2013-02-25 09:23:37

+0

还有#IfWinActive,ahk_group ExplorerWindows之后 我只发布了脚本的一部分 – Taylan 2013-02-25 09:42:50

+0

请提供一些关于建议的解决方案的反馈,如果其中一个答案有帮助,那么请点击“白色登记表”标记将它变成绿色。谢谢! – 2013-02-26 08:21:45

回答

0

您提供的信息很少去......我能想象,你会打按Ctrl小号例如在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 
+0

好吧,我只是将500改为1.我认为这是毫秒。好吧,我从你的代码评论中发现了这一点。我应该将此标记为答案吗? – Taylan 2013-02-26 13:17:15

+0

@ T--,很高兴看到你解决了这个问题。如果你能检查我的答案,那将不胜感激。 – 2013-02-26 13:23:39