Sign in to follow this  
Followers 0
karliky

Can't close gui when FOR is running

2 posts in this topic




While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case BLABLA!
;;;;;;;;;;;;;;
for $x = 0 to 100
;;;WHEN IS RUNNING I CAN'T CLOSE THE GUI
next
Case $GUI_EVENT_CLOSE
ExitLoop
Exit

EndSwitch
WEnd
No but you shouldn't expect otherwise. The gui is only closed when it deals with the case $GUI_EVENT_CLOSE.

There are a number of ways to deal with that. Here is one way

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case BLABLA!
           ;;;;;;;;;;;;;;
            For $x = 0 To 100
               ;ExitLoop(2) to exit the for/next and the Switch/EndSwitch
                If GUIGetMsg() = $GUI_EVENT_CLOSE Then ExitLoop (2)

               ;some code here
            Next
        Case $GUI_EVENT_CLOSE
            ExitLoop
            Exit;this line is never executed so might as well remove it

    EndSwitch
WEnd

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
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
Sign in to follow this  
Followers 0