Rabbitman Posted December 13, 2010 Share Posted December 13, 2010 I cant get the exit button at the top right to exit. I think the function is GUI_EVENT_CLOSE but when i put it in my script it says unable to parse function call. Its the only thing i have put in so far... and i want to make it work with hotkeys. What should i do? Script: Opt('MustDeclareVars', 1) Bye() Func Bye() Local $msg GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd EndFunc Link to comment Share on other sites More sharing options...
Rabbitman Posted December 13, 2010 Author Share Posted December 13, 2010 oops i double posted Link to comment Share on other sites More sharing options...
Mat Posted December 13, 2010 Share Posted December 13, 2010 I had to add two lines to get it to work as I think you'd like it. The first is "#include<GUIConstantsEx.au3>" Which is probably the reason you got the error The second is GUICreate("Test") as you hadn't made a GUI... I assume you weren't posting the whole code? Right now it doesn't actually exit as such, it just returns from the program. It is possible that if you have more code after Bye() then it will carry on going and won't exit. Opt('MustDeclareVars', 1) #include<GUIConstantsEx.au3> GUICreate("Test") Bye() Func Bye() Local $msg GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd EndFunc ;==>Bye AutoIt Project Listing Link to comment Share on other sites More sharing options...
Rabbitman Posted December 13, 2010 Author Share Posted December 13, 2010 Yes i had a GUI before and the guiconstants Link to comment Share on other sites More sharing options...
James Posted December 14, 2010 Share Posted December 14, 2010 I had to add two lines to get it to work as I think you'd like it. The first is "#include<GUIConstantsEx.au3>" Which is probably the reason you got the error The second is GUICreate("Test") as you hadn't made a GUI... I assume you weren't posting the whole code? Right now it doesn't actually exit as such, it just returns from the program. It is possible that if you have more code after Bye() then it will carry on going and won't exit. Opt('MustDeclareVars', 1) #include<GUIConstantsEx.au3> GUICreate("Test") Bye() Func Bye() Local $msg GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd EndFunc ;==>Bye Really Mat? Why share code that is malformed and bad practise? Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Mat Posted December 14, 2010 Share Posted December 14, 2010 Really Mat? Why share code that is malformed and bad practise? OP wanted to know what was wrong with the code, so I made it work and pointed out what could be wrong. It may not be how I'd write it... Does he really want me to reply with my template GUI? #AutoIt3Wrapper_AU3Check_Stop_OnWarning=y #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 4 -w 5 -w 6 #include<GUIConstantsEx.au3> _Main() Func _Main() Local $hGUI, $iMsg $hGUI = GUICreate("Template GUI") GUISetState(@SW_SHOW, $hGUI) While 1 $iMsg = GUIGetMsg() Select Case $iMsg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd GUIDelete($hGUI) Exit EndFunc ;==>_Main AutoIt Project Listing 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