Sturmi Posted June 2, 2016 Posted June 2, 2016 Hi! I have a main GUI and there I call on button press 5 functions which are all new guis which go through 1 by 1 till end. In my Button case from main gui it looks like this: Case $Btn1 Function1() Function2() Function3() I'm currently wondering on how i can stop running as example function3 when user pressed close button in gui2 ( function2 ). So Actually all I search is to stop the Case running when one windows close got pressed. thanks in advance
AutoBert Posted June 3, 2016 Posted June 3, 2016 Please post a runable (reproducer) script showing your issue(s). Read https://www.autoitscript.com/wiki/Interrupting_a_running_function and https://www.autoitscript.com/wiki/Managing_Multiple_GUIs.
Sturmi Posted June 3, 2016 Author Posted June 3, 2016 i just added more sub guis to the example of autoit. works but im not sure how to interrupt when its in 1,2,3,4th window so it won't load the other if close is pressed
AutoBert Posted June 3, 2016 Posted June 3, 2016 5 hours ago, AutoBert said: Please post a runable (reproducer) script showing your issue(s).
Sturmi Posted June 3, 2016 Author Posted June 3, 2016 expandcollapse popup#include <GUIConstantsEx.au3> gui1() Func gui1() $hGUI1 = GUICreate("Gui 1", 200, 200, 100, 100) $hButton1 = GUICtrlCreateButton("Msgbox 1", 10, 10, 80, 30) $hButton2 = GUICtrlCreateButton("Show Gui 2", 10, 60, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $hButton1 MsgBox("", "MsgBox 1", "Test from Gui 1") Case $hButton2 ; Disable the first GUI GUISetState(@SW_DISABLE, $hGUI1) gui2() gui3() gui4() ; Re-enable the first GUI GUISetState(@SW_ENABLE, $hGUI1) EndSwitch WEnd EndFunc ;==>gui1 Func gui2() $hGUI2 = GUICreate("Gui 2", 200, 200, 350, 350) $hButton3 = GUICtrlCreateButton("MsgBox 2", 10, 10, 80, 30) GUISetState() While 1 ; We can only get messages from the second GUI Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete($hGUI2) ExitLoop Case $hButton3 MsgBox("", "MsgBox 2", "Test from Gui 2") EndSwitch WEnd EndFunc ;==>gui2 Func gui3() $hGUI3 = GUICreate("Gui 2", 200, 200, 350, 350) $hButton3 = GUICtrlCreateButton("MsgBox 2", 10, 10, 80, 30) GUISetState() While 1 ; We can only get messages from the second GUI Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete($hGUI3) ExitLoop Case $hButton3 MsgBox("", "MsgBox 2", "Test from Gui 2") EndSwitch WEnd EndFunc ;==>gui3 Func gui4() $hGUI4 = GUICreate("Gui 2", 200, 200, 350, 350) $hButton3 = GUICtrlCreateButton("MsgBox 2", 10, 10, 80, 30) GUISetState() While 1 ; We can only get messages from the second GUI Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete($hGUI4) ExitLoop Case $hButton3 MsgBox("", "MsgBox 2", "Test from Gui 2") EndSwitch WEnd EndFunc ;==>gui2 Normally you would go to next function when button next is pressed and so on. but want to have when close is pressed that the case wont get run through anymore
AutoBert Posted June 3, 2016 Posted June 3, 2016 6 hours ago, AutoBert said: Read ... and https://www.autoitscript.com/wiki/Managing_Multiple_GUIs. You don't read or why don't using GuiGetMsg(1). Or what of Read ... and https://www.autoitscript.com/wiki/Managing_Multiple_GUIs.
Sturmi Posted June 3, 2016 Author Posted June 3, 2016 and in which way does this help me to stop my case to go through all functions ?
AutoBert Posted June 3, 2016 Posted June 3, 2016 28 minutes ago, Sturmi said: and in which way does this help me to stop my case to go through all functions ? it helps me to help you. I am not interestet to do a work you can do yourself. And make a real example: and in which way does this help me to stop my case to go through all functions ?
caramen Posted June 3, 2016 Posted June 3, 2016 (edited) Sturmi we encoutering the same issue i guess i whould like to stop a case also and the tips given to me by all other user is : "Make your own timer" Watxh this: Or folow this : Hope it gonna help you but i am still stuck the tutorial is here btw. https://www.autoitscript.com/wiki/Interrupting_a_running_function i dont understand it. good luck ! Edited June 3, 2016 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
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