作者LPen (鳥人)
看板EzHotKey
標題[AHK-] 如何中斷setTimer 內的程序
時間Thu Feb 17 11:49:16 2011
小弟目前遇到一個狀況,要中斷setTimer 的程序,但沒有很好的作法
想請大家指導一下:
我的例子如下
GUI,add, button, Pause
GUI,add, button, Continue
GUI,show
SetTimer, detect, 50000
Return
detect:
;擷取螢幕畫面(略)。
msgbox, 上課要專心,老師有在記錄
Return
ButtonPause:
setTimer,detect,off
Return
ButtonContinue:
SetTimer, detect, 50000
Return
目前的情況是,如果detect 正在執行中的話,這樣的程式無法中斷執行。
不知道有沒有比較對的寫法呢?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 111.184.184.225
推 Lumania:timer程序執行中設off的話,要程序執行結束才會作用 02/19 10:40
→ Lumania:不然你就要在 detect: 中設flag 檢查true|false 然後程序 02/19 10:42
→ Lumania:結束,ButtonPause:去設定該flag 02/19 10:42
→ Lumania:不過msgbox 一執行就會停住,手動才能結束,也沒有辦法設 02/19 10:44
→ Lumania:flag 02/19 10:45