Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

loop with sleep and stop the loop

$
0
0
Hi ,
is tthere any way to stop the sleep when it sleeping? when i set the sleep a bit long  like > 1 min, and I wnt to stop the program it wont stop ..i guess because the sleep still going.

here is my code
[ autoit ]         
 GUICreate("My test", 250,100,10,1000) ; will create a dialog box that when displayed is centered     Opt("GUICoordMode", 1)     $Button_1 = GUICtrlCreateButton("Run", 11, 11, 50,30)     $Button_2 = GUICtrlCreateButton("stop", 70, 11,50,30)     $input1 = GUICtrlCreateInput("180000", 11, 45, 100,30)  global $input2 = GUICtrlCreateInput("368,317,380,520", 120, 45, 100,30)     GUISetState() ; will display an  dialog box with 2 button    global $stop = 0, $in1 = 180000 ;3min     ; Run the GUI until the dialog is closed     While 1         $msg = GUIGetMsg()         Select             Case $msg = $GUI_EVENT_CLOSE                 ExitLoop     Case $msg = $Button_1     $in1 = GUICtrlRead($input1)     run10($msg)                 ;Run('notepad.exe') ; Will Run/Open Notepad             Case $msg = $Button_2                 $stop = 1         EndSelect     WEnd EndFunc   ;==>Example func run10 ($stop)    $co = GUICtrlRead($input2)    $cos = StringSplit($co, ',')    ;_arraydisplay($cos)    ;exit      while 1    WinActivate("[Class:whateverhere]")    MouseClick("right", $cos[1], $cos[2], 1)    MouseClick("left", $cos[3], $cos[4], 1) ; from 513    sleep(120000) ; 2 min    ConsoleWrite("click" [email="&@crlf"]&@crlf[/email])    if $stop  = 1 then    ConsoleWrite('stop')    ExitLoop    endif    WEnd EndFunc

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>