2015-04-02 28 views
0

關注遠調用後立即:AHK(AutoHotkey的):以從的InputBox

inputbox,inv,Scan Invoice Number: 

我想借此從輸入框,併到另一個窗口集中離開,但預期和前等待用戶輸入它的行爲不繼續下一行代碼。有什麼方法可以覆蓋這種行爲嗎?

回答

1

InputBox使當前線程等待用戶輸入,因此掛起線程。在其他語言中,你會說Thread終止,並且一個ActionListener開始監聽。通過直接在AutoHotkey中調用一個新線程無法主動實現多線程本身,但是,您可以按照documentation中的說明使用熱鍵或定時子例程啓動它。

我想出了以下解決方案爲自己幾次,據我所知這是最徹底的方法有:

setTimer, continueAfterInputbox, -100 ; a negative period indicates "run once only", after a sleep of 100 ms in this case 
inputbox, inv, Scan Invoice Number: 
;; do things with %inv% 

Return 

continueAfterInputbox: 
msgbox, do other cool things 
return