-2
我目前在AutoIt中設置了一個程序。這是什麼寫成的代碼,以及一些注意事項,可能是有用的,回答我的問題:一旦在AutoIt中按下「Q」按鈕,我該如何讓程序停止?
;File with data is pw.txt
$fh = FileOpen("pw.txt")
;Loops 5 times, every time it loops $attempt should equal the next line of pw.txt
For $i = 1 To 10
$attempt = FileReadLine($fh)
MouseClick("left");MouseClick("left",711,256)
Sleep(700)
Send($attempt);Enters whatever is in $attempt variable
Sleep(700)
Send("{enter}")
Sleep(700)
MouseClick("left")
Sleep(700);Once first loop is finished, second loop begins. The only thing that is different is what is entered ($attempt)
Next
FileClose("pw.txt");After finished looping, file closes.
對於這個問題的緣故,我設置了循環計數爲10,所以以後$ I = 10 (循環10次後),程序仍然有效,但不會執行任何操作。
我想讓它如此,以便如果用戶點擊鍵盤上的「Q」按鈕,我的程序將停止,並且不會執行其他操作(我不想完全關閉程序,只需停止循環) 。我希望循環在下一次運行程序時從1開始運行
例如,如果我在循環4上並按下「Q」按鈕,循環將停止,然後我應該能夠點擊「F5」按鈕再次運行我的程序,並且它將在迴路1上。
任何幫助將不勝感激!謝謝!
查看HotKeySet – Richard