Tec Posted October 31, 2006 Share Posted October 31, 2006 (edited) How can i exit a Gui with a sleep command in Loop ? #include <GUIConstants.au3> AdlibEnable("myadlib") GUICreate("My GUI Button") ; will create a dialog box that when displayed is centered Opt("GUICoordMode",2) $Button_1 = GUICtrlCreateButton ("Run Notepad", 10, 30, 100) $Button_2 = GUICtrlCreateButton ( "Button Test", 0, -1) GUISetState () ; will display an dialog box with 2 button ; Run the GUI until the dialog is closed While 1 Sleep(10000) Wend Func myadlib() $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $Button_1 Run('Notepad.exe') ; Will Run/Open Notepad Case $msg = $Button_2 MsgBox(0, 'Testing', 'Button 2 was pressed') ; Will demonstrate Button 2 being pressed EndSelect EndFunc Is this a way ? Edited October 31, 2006 by Tec Link to comment Share on other sites More sharing options...
jvanegmond Posted October 31, 2006 Share Posted October 31, 2006 How can i exit a Gui with a sleep command in Loop ? what you are looking is called "GUIOnEventMode". Here's an example on how to use this: #include <GUIConstants.au3> Opt("GUIOnEventMode", 1) $parent1 = GUICreate("Parent1") GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate") GUISetState() While 1 Sleep(10000) Wend Func Terminate() Exit EndFunc github.com/jvanegmond Link to comment Share on other sites More sharing options...
Tec Posted October 31, 2006 Author Share Posted October 31, 2006 (edited) Big thx Edited October 31, 2006 by Tec Link to comment Share on other sites More sharing options...
jvanegmond Posted October 31, 2006 Share Posted October 31, 2006 Big thx Big no problem. github.com/jvanegmond 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