Thebarbarius Posted October 6, 2021 Share Posted October 6, 2021 Hello i have this code : expandcollapse popup#Region ### START Koda GUI section ### Form= $Statu = GUICreate("ACTION", 214, 97, 192, 124) $STOP = GUICtrlCreateButton("STOP", 64, 32, 91, 25) GUISetState(@SW_HIDE, $Statu) #EndRegion ### END Koda GUI section ### If Not @error Then While 1 Switch GUIGetMsg() Case $STOP $msg = MsgBox(4, "Answer", "Whant you stop ?") If $msg = 6 Then GUISetState(@SW_HIDE, $Statu) ExitLoop(4) EndIf for $i = 1 To $listFile[0][0] If $alistFile[$i][0] Then Switch $listFile[$i][0] Case "END" local $ini = IniReadSection($listFile, "START") While 1 Switch GUIGetMsg() Case $STOP $msg = MsgBox(4, "Answer", "Whant you stop ?") If $msg = 6 Then GUISetState(@SW_HIDE, $Statu) ExitLoop(4) EndIf EndSwitch WEnd EndSwitch EndIf Next EndSwitch WEnd EndIf How to make for while loop $stop. If i make like my copy past a loop don't work and i can"t for exemple make other action Please can you edit My Loop or mùake suggestion THX Link to comment Share on other sites More sharing options...
Thebarbarius Posted October 6, 2021 Author Share Posted October 6, 2021 I have this #Region ### START Koda GUI section ### Form= $Statu = GUICreate("ACTION", 214, 97, 192, 124) $STOP = GUICtrlCreateButton("STOP", 64, 32, 91, 25) GUISetState(@SW_HIDE, $Statu) #EndRegion ### END Koda GUI section ### If Not @error Then While 1 for $i = 1 To $trajetFile[0][0] If $testFile[$i][0] Then While 1 Switch GUIGetMsg() Case $STOP MsgBox(0, "", "STOPED") EndSwitch Wend Switch $trajetFile[$i][0] Case "END" local $ini = IniReadSection($testtFile, "START") Switch $testFile[$i][0] case "TEST" MsgBox(0, '', 'test ok') EndSwitch EndIf I have edited. Now can tell me how to run loop, and if i press $STOP, stop my loop. With acutaly loop i can exit loop but a loop don't work. It's very important please Link to comment Share on other sites More sharing options...
Leendert-Jan Posted October 7, 2021 Share Posted October 7, 2021 (edited) You can use ExitLoop to exit the while loop when the stop button is clicked While 1 Switch GUIGetMsg() Case $STOP MsgBox(0, "", "STOPPED") ExitLoop EndSwitch WEnd Edit: If you want to actually CLOSE YOUR SCRIPT when you click the stop button, use Exit instead of ExitLoop. More info: https://www.autoitscript.com/autoit3/docs/functions/GUICtrlCreateButton.htm https://www.autoitscript.com/autoit3/docs/keywords/ExitLoop.htm Edited October 7, 2021 by Leendert-Jan spelling Link to comment Share on other sites More sharing options...
Musashi Posted October 7, 2021 Share Posted October 7, 2021 21 hours ago, Thebarbarius said: With acutaly loop i can exit loop but a loop don't work. It's very important please With your current script you can't do anything at all. If it is so important, please post a compilable excerpt. Spoiler "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now