DigDeep Posted April 16, 2015 Share Posted April 16, 2015 (edited) Hi, I am stuck at a stage and would need some help here. Everything is good except the part: Select Case FileExists("found something which should not be here") ; (Skip the below process. Butdo not exit Example GUI) EndSelect If the above part runs then I want any further actions inside the Button 2 to be skipped for (PartB, Part C and Part D) but should not exit the complete GUI I cannot use the "Exit" here as it exits complete GUI. expandcollapse popup#NoTrayIcon #RequireAdmin #include<process.au3> #include <Date.au3> #include <File.au3> #include <IE.au3> #include <Array.au3> #include <Constants.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate(" Example", 352, 117, -1, -1, $GUI_SS_DEFAULT_GUI) $Button1 = GUICtrlCreateButton("Button 1", 32, 48, 131, 25) $Button2 = GUICtrlCreateButton("Button 2", 192, 48, 131, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE $nMsg = MsgBox(68, "Example", "Do you want to exit?", $Form1) Exit Case $nMsg = $Button1 ; Install Button ; Perform $Button1 Actions Case $nMsg = $Button2 ; Repair Button ; Perform $Button2 Actions ; 1. PartA script Select Case FileExists("found something which should not be here") ; (Skip the below process. Butdo not exit Example GUI) EndSelect ; 2. Part B Script ; 3. Part C script ; 4. Part D script EndSelect WEnd Edited April 16, 2015 by sunshinesmile84 Link to comment Share on other sites More sharing options...
Solution mikell Posted April 16, 2015 Solution Share Posted April 16, 2015 (edited) ContinueLoop Edit While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE Exit Case $nMsg = $Button1 ;.... Case $nMsg = $Button2 If FileExists("should not be here") Then ContinueLoop ; restart execution of the loop at the expression testing statement (While) ; If not then do something EndSelect WEnd Edited April 16, 2015 by mikell Link to comment Share on other sites More sharing options...
caramen Posted April 16, 2015 Share Posted April 16, 2015 (edited) Exemple of Logic Help : You share your part A Into 2 function in teh while. ; PART A SCRIPT : While (1) Func AlloA () Select Case FileExists("found something which should not be here") ; (Skip the below process. Butdo not exit Example GUI) AlloB () EndSelect EndFunc Func AlloB () ExitLoop EndFunc WEnd Tips : -Anything under Case line is do until the Next case or the EndSelect -If you do a loop you can exit loop anywhere by using ExitLoop - You can even use loop only to do multiple case and ignore a part of your script If Condition 1 then ExitLoop EndIf Hf Edited April 16, 2015 by caramen My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
DigDeep Posted April 16, 2015 Author Share Posted April 16, 2015 Thank you Mikell and Caramen 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