Jump to content

Loop probleme


Recommended Posts

Hello i have this code :

#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

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

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 by Leendert-Jan
spelling
Link to comment
Share on other sites

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

barbariusERR.jpg.c59b67d79258db860ea0802cb06f130a.jpg

 

Musashi-C64.png

"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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...