2013-02-24 118 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