ca143508 Posted January 23, 2007 Share Posted January 23, 2007 Guys, Is there a way you can pause a script until a button is pressed on the gui? Cheers, Michael Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 23, 2007 Moderators Share Posted January 23, 2007 (edited) Guys,Is there a way you can pause a script until a button is pressed on the gui?Cheers,MichaelOpt('GUISetOnEventMode', x) While 1 Sleep(1000) WEnd ;Rest of functions Edited January 23, 2007 by SmOke_N 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...
Psibernetic Posted January 23, 2007 Share Posted January 23, 2007 That code SmOke_N gave you confused me, so it case it did you too, here is (to my understanding) the kinda more standard way of doing it $MainWinID=GuiCreate("Your GUI Window") ;Creates your Window and stores its ID in the variable $MainWinID $Your_Buttons_Control_ID=GUICtrlCreateButton("Your Button", 0, 0) ;Creates your button and stores its ID in the variable GUISetState(@SW_SHOW) ;shows the GUI while 1 ;set a never ending loop $Event=GuiGetMsg() ;this functions checks to see if the user has interacted with the GUI, and if so stores which control was interacted with select case $Event=$GUI_EVENT_CLOSE ;If the user clicked the exit button, do the following exitloop case $Event=$Your_Buttons_Control_ID ;If the user clicked your button, do the following ;Your code here EndSelect WEnd Exit ;any Functions you have should be defined here [sup]Psibernetic[/sup]My Creations:X-HideSecuracy Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 23, 2007 Moderators Share Posted January 23, 2007 That code SmOke_N gave you confused me, so it case it did you too, here is (to my understanding) the kinda more standard way of doing itShouldn't confuse you if you look at the functions for GUISetOnEvent*Opt('GUIOnEventMode', 1) $Main = GUICreate('Example:', 100, 100) $Button = GUICtrlCreateButton('Click Me', 0, 0, 100, 100) GUISetOnEvent(-3, '_ByeBye');Set $GUI_EVENT_CLOSE function GUICtrlSetOnEvent($Button, '_EventHandler');Set Control to an Event Handler GUISetState() While 1 ;Lets Just Sleep As Long As Allowed, Until You Need Me Sleep(0x7FFFFFFF) WEnd Func _EventHandler() Switch @GUI_CtrlId Case $Button _CallSomeFunction() EndSwitch EndFunc Func _CallSomeFunction() Return MsgBox(64, 'Found', 'Ok, you called me, now what do you want?') EndFunc Func _ByeBye() Exit 1 EndFunc 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...
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