penguini Posted January 25, 2007 Share Posted January 25, 2007 I am trying to just experiment with making a GUI, and I get it created and everything is ok. But I cannot figure out how to exit the program / GUI when I hit the [X] button on the window. The code I'm trying to use / fix is: expandcollapse popup#include <GUIConstants.au3> GUICreate("TEST PROGRAM", 350, 145, 93, 15) GUICtrlCreatePic("hamburger.jpg", 215, 35, 135, 112) $firstbutton = GUICtrlCreateButton("First", 5, 25, 75, 25) $secondbutton = GUICtrlCreateButton("Second", 5, 50, 75, 25) $thirdbutton = GUICtrlCreateButton("Third", 5, 75, 75, 25) GUICtrlSetOnEvent($firstbutton, "FirstClicked") GUICtrlSetOnEvent($secondbutton, "SecondClicked") GUICtrlSetOnEvent($lastbutton, "LastClicked") GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE, "CloseProg") $starttime = @hour While 1 If $starttime = 2 Then Action() ExitLoop EndIf WEnd Func FirstClicked() $choicex = 309 $choicey = 507 EndFunc Func SecondClicked() $choicex = 309 $choicey = 525 EndFunc Func LastClicked() $choicex = 309 $choicey = 493 EndFunc Func Action() Run("C:\Program Files\Mozilla Firefox\firefox.exe") Sleep(10000) MouseMove(1000,64) Sleep(2000) MouseDown("left") MouseMove(258,64) MouseUp("left") Send("http://www.freewebs.com/{ENTER}") Sleep(10000) MouseClick("left", $choicex, $choicey) MouseClick("left", 307, 546) EndFunc Func CloseProg() Select Case @GUI_CTRLID = $GUI_EVENT_CLOSE MsgBox(1, "CLOSED", "CLOSED!") Exit EndSelect EndFunc Link to comment Share on other sites More sharing options...
theguy0000 Posted January 25, 2007 Share Posted January 25, 2007 I'm pretty sure that Func CloseProg() Select Case @GUI_CTRLID = $GUI_EVENT_CLOSE MsgBox(1, "CLOSED", "CLOSED!") Exit EndSelect EndFunc Since you already specified that it's $GUI_EVENT_CLOSE on line 12 The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN Link to comment Share on other sites More sharing options...
Bert Posted January 25, 2007 Share Posted January 25, 2007 ad this to the beginning to your script: Opt("GUIOnEventMode", 1) The Vollatran project My blog: http://www.vollysinterestingshit.com/ 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