experience Posted September 14, 2007 Share Posted September 14, 2007 I can exit the script before i click the start button, but as soon as it starts running it wont respond to any of the exit commands. I've set Esc, the stop button and the cross on the the window to make it close which work fine except when its running. I've tried everything i can think of to make it work but have ran out of ideas expandcollapse popup#include <GUIConstants.au3> GUICreate("title", 300, 120) ; will create a dialog box that when displayed is centered GUISetState (@SW_SHOW) ; will display an empty dialog box Opt("GUICoordMode",2) Opt("GUIOnEventMode",1) $Button_1 = GUICtrlCreateButton ("Start", 50, 90, 100) $Button_2 = GUICtrlCreateButton ( "Stop / Exit", 0, -1) $progressbar1 = GUICtrlCreateProgress (-150, -80,100,20) $Label = GUICtrlCreateLabel("", -170, 10, 250, 20) $Label2 = GUICtrlCreateLabel("Will put some Text here when i get a chance", -240, -70, 250, 20) $nMsg = GUIGetMsg() GUISetState () GuICtrlSetOnEvent($Button_2,"Quit") GuiCtrlSetOnEvent($Button_1,"DoScript") GUICtrlSetOnEvent($progressbar1,"Doscript") GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") HotKeySet("Esc","close") Func close() Exit EndFunc While 1 Sleep(100) WEnd Func Quit() Exit EndFunc Func _Exit() Exit EndFunc Func DoScript() GUICtrlSetData ($progressbar1,(0)) MouseMove(1200, 400) sleep(4000) GUICtrlSetData ($progressbar1,(25)) sleep(4000) MouseMove(600, 400) GUICtrlSetData ($progressbar1,(50)) sleep(4000) MouseMove(1200, 400) GUICtrlSetData ($progressbar1,(75)) sleep(4000) MouseMove(600, 400) GUICtrlSetData ($progressbar1,(100)) EndFunc Link to comment Share on other sites More sharing options...
AlmarM Posted September 14, 2007 Share Posted September 14, 2007 (edited) Will this works: expandcollapse popup#include <GUIConstants.au3> GUICreate("title", 300, 120) ; will create a dialog box that when displayed is centered GUISetState (@SW_SHOW) ; will display an empty dialog box Opt("GUICoordMode",2) Opt("GUIOnEventMode",1) $Button_1 = GUICtrlCreateButton ("Start", 50, 90, 100) $Button_2 = GUICtrlCreateButton ( "Stop / Exit", 0, -1) $progressbar1 = GUICtrlCreateProgress (-150, -80,100,20) $Label = GUICtrlCreateLabel("", -170, 10, 250, 20) $Label2 = GUICtrlCreateLabel("Will put some Text here when i get a chance", -240, -70, 250, 20) $nMsg = GUIGetMsg() GUISetState () GuICtrlSetOnEvent($Button_2,"Quit") GuiCtrlSetOnEvent($Button_1,"DoScript") GUICtrlSetOnEvent($progressbar1,"Doscript") GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") HotKeySet('{ESC}', '_Exit') Func close() Exit EndFunc While 1 Sleep(100) WEnd Func _Exit() ;ToolTip(' '&@CRLF&' EXITING '&@CRLF&' ') Sleep(500) Exit EndFunc Func DoScript() GUICtrlSetData ($progressbar1,(0)) MouseMove(1200, 400) sleep(4000) GUICtrlSetData ($progressbar1,(25)) sleep(4000) MouseMove(600, 400) GUICtrlSetData ($progressbar1,(50)) sleep(4000) MouseMove(1200, 400) GUICtrlSetData ($progressbar1,(75)) sleep(4000) MouseMove(600, 400) GUICtrlSetData ($progressbar1,(100)) EndFunc Edited September 14, 2007 by AlmarM Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
experience Posted September 14, 2007 Author Share Posted September 14, 2007 Will this works: expandcollapse popup#include <GUIConstants.au3> GUICreate("title", 300, 120) ; will create a dialog box that when displayed is centered GUISetState (@SW_SHOW) ; will display an empty dialog box Opt("GUICoordMode",2) Opt("GUIOnEventMode",1) $Button_1 = GUICtrlCreateButton ("Start", 50, 90, 100) $Button_2 = GUICtrlCreateButton ( "Stop / Exit", 0, -1) $progressbar1 = GUICtrlCreateProgress (-150, -80,100,20) $Label = GUICtrlCreateLabel("", -170, 10, 250, 20) $Label2 = GUICtrlCreateLabel("Will put some Text here when i get a chance", -240, -70, 250, 20) $nMsg = GUIGetMsg() GUISetState () GuICtrlSetOnEvent($Button_2,"Quit") GuiCtrlSetOnEvent($Button_1,"DoScript") GUICtrlSetOnEvent($progressbar1,"Doscript") GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") HotKeySet('{ESC}', '_Exit') Func close() Exit EndFunc While 1 Sleep(100) WEnd Func _Exit() ;ToolTip(' '&@CRLF&' EXITING '&@CRLF&' ') Sleep(500) Exit EndFunc Func DoScript() GUICtrlSetData ($progressbar1,(0)) MouseMove(1200, 400) sleep(4000) GUICtrlSetData ($progressbar1,(25)) sleep(4000) MouseMove(600, 400) GUICtrlSetData ($progressbar1,(50)) sleep(4000) MouseMove(1200, 400) GUICtrlSetData ($progressbar1,(75)) sleep(4000) MouseMove(600, 400) GUICtrlSetData ($progressbar1,(100)) EndFunc No that gives an error when you execute it Link to comment Share on other sites More sharing options...
AlmarM Posted September 14, 2007 Share Posted September 14, 2007 (edited) What error ?? EDIT: ah... i know what you mean... the code is: expandcollapse popup#include <GUIConstants.au3> GUICreate("title", 300, 120); will create a dialog box that when displayed is centered GUISetState (@SW_SHOW) ; will display an empty dialog box Opt("GUICoordMode",2) Opt("GUIOnEventMode",1) $Button_1 = GUICtrlCreateButton ("Start", 50, 90, 100) $Button_2 = GUICtrlCreateButton ( "Stop / Exit", 0, -1) $progressbar1 = GUICtrlCreateProgress (-150, -80,100,20) $Label = GUICtrlCreateLabel("", -170, 10, 250, 20) $Label2 = GUICtrlCreateLabel("Will put some Text here when i get a chance", -240, -70, 250, 20) $nMsg = GUIGetMsg() GUISetState () GuICtrlSetOnEvent($Button_2,"Quit") GuiCtrlSetOnEvent($Button_1,"DoScript") GUICtrlSetOnEvent($progressbar1,"Doscript") GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") HotKeySet('{ESC}', '_Exit') Func Quit() Exit EndFunc Func close() Exit EndFunc While 1 Sleep(100) WEnd Func _Exit() ;ToolTip(' '&@CRLF&' EXITING '&@CRLF&' ') Sleep(500) Exit EndFunc Func DoScript() GUICtrlSetData ($progressbar1,(0)) MouseMove(1200, 400) sleep(4000) GUICtrlSetData ($progressbar1,(25)) sleep(4000) MouseMove(600, 400) GUICtrlSetData ($progressbar1,(50)) sleep(4000) MouseMove(1200, 400) GUICtrlSetData ($progressbar1,(75)) sleep(4000) MouseMove(600, 400) GUICtrlSetData ($progressbar1,(100)) EndFunc Good Enough ^^ ? Edited September 14, 2007 by AlmarM Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
experience Posted September 14, 2007 Author Share Posted September 14, 2007 (edited) What error ?? EDIT: ah... i know what you mean... the code is: expandcollapse popup#include <GUIConstants.au3> GUICreate("title", 300, 120); will create a dialog box that when displayed is centered GUISetState (@SW_SHOW) ; will display an empty dialog box Opt("GUICoordMode",2) Opt("GUIOnEventMode",1) $Button_1 = GUICtrlCreateButton ("Start", 50, 90, 100) $Button_2 = GUICtrlCreateButton ( "Stop / Exit", 0, -1) $progressbar1 = GUICtrlCreateProgress (-150, -80,100,20) $Label = GUICtrlCreateLabel("", -170, 10, 250, 20) $Label2 = GUICtrlCreateLabel("Will put some Text here when i get a chance", -240, -70, 250, 20) $nMsg = GUIGetMsg() GUISetState () GuICtrlSetOnEvent($Button_2,"Quit") GuiCtrlSetOnEvent($Button_1,"DoScript") GUICtrlSetOnEvent($progressbar1,"Doscript") GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") HotKeySet('{ESC}', '_Exit') Func Quit() Exit EndFunc Func close() Exit EndFunc While 1 Sleep(100) WEnd Func _Exit() ;ToolTip(' '&@CRLF&' EXITING '&@CRLF&' ') Sleep(500) Exit EndFunc Func DoScript() GUICtrlSetData ($progressbar1,(0)) MouseMove(1200, 400) sleep(4000) GUICtrlSetData ($progressbar1,(25)) sleep(4000) MouseMove(600, 400) GUICtrlSetData ($progressbar1,(50)) sleep(4000) MouseMove(1200, 400) GUICtrlSetData ($progressbar1,(75)) sleep(4000) MouseMove(600, 400) GUICtrlSetData ($progressbar1,(100)) EndFunc Good Enough ^^ ?Ah ha yeh thats good the Esc key exits! the exit button & window close still doesnt work tho Edited September 14, 2007 by experience Link to comment Share on other sites More sharing options...
AlmarM Posted September 14, 2007 Share Posted September 14, 2007 Ah ha yeh thats good the Esc key exits! the exit button & window close still doesnt work thoUhm...window close still doesnt work tho???What you mean ?? Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 14, 2007 Moderators Share Posted September 14, 2007 Uhm...window close still doesnt work tho???What you mean ??When you are doing a "Sleep()", nothing is interpreted from the GUI during that sleep, so when you are clicking on the close option for the GUI, it's not getting the message. You'll have to re-think what you are doing a bit more clearly. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
AlmarM Posted September 14, 2007 Share Posted September 14, 2007 When you are doing a "Sleep()", nothing is interpreted from the GUI during that sleep, so when you are clicking on the close option for the GUI, it's not getting the message. You'll have to re-think what you are doing a bit more clearly.Lol im just a newbie who did know that about the HotKeySet...Buy i still dont know anything about the GUI things Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. 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