roflmao Posted August 31, 2007 Share Posted August 31, 2007 (edited) So, i want to make a gui script that has two buttons and two hotkeys. The first button are going to start a script that is going to go in a loop, and the second button is going to exit that loop but not exit the whole script so i can start with the first button again. I can't figureout how to do this, can anyone make an example? I want to make the script myself so i want an example It's been a long time sins iv done any autoit so i have n00bed out Edited August 31, 2007 by roflmao Link to comment Share on other sites More sharing options...
Developers Jos Posted August 31, 2007 Developers Share Posted August 31, 2007 .. and your question is what ? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
JoyceBabu Posted August 31, 2007 Share Posted August 31, 2007 How about setting a flag to False on first button click and True on second button click. After completing every loop iteration, check whether the flag is True. If it is false, continue else exit the loop. Link to comment Share on other sites More sharing options...
mrbloody369 Posted August 31, 2007 Share Posted August 31, 2007 (edited) hmmm You need to look at the help file and look in to "HotKeySet" for your hotkeys also your going to have to look up func since it's more likly you will be running the hotkeys VIA func's As for your last question , I beleave it's some thing like this While 1 $nMsg = GUIGetMsg() If $nMsg = $Button1 Then while 2 ;what your looping :) If $nMsg = Button2 Then ExitLoop EndIf WEnd EndIf If $NMsg = $GUI_EVENT_CLOSE Then ExitLoop WEnd Mr B. Edited August 31, 2007 by mrbloody369 Favorite Quotes"If you apply your mind you can create any thing you can dream of" "Any thing can get done by simply click of a button" Link to comment Share on other sites More sharing options...
Zedna Posted August 31, 2007 Share Posted August 31, 2007 (edited) Something for start: expandcollapse popup#include <GUIConstants.au3> GUICreate("Test",220,100) ;, -1,-1, $WS_CAPTION, $WS_EX_TOPMOST) $progressbar = GUICtrlCreateProgress (10,15,200,20,$PBS_SMOOTH) $procent = GUICtrlCreateLabel ('0 %', 10,40,200,20,$SS_CENTER) $start = GUICtrlCreateButton ("Start",35,68,70,22) $stop = GUICtrlCreateButton ("Stop",115,68,70,22) GUICtrlSetState($stop,$GUI_DISABLE) GUISetState() $run = 0 $i = 0 While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $start Then $run = 1 GUICtrlSetState($start,$GUI_DISABLE) GUICtrlSetState($stop,$GUI_ENABLE) EndIf If $msg = $stop Then $run = 0 GUICtrlSetState($start,$GUI_ENABLE) GUICtrlSetState($stop,$GUI_DISABLE) EndIf If $run Then $i = $i + 1 If $i > 100 Then $i = 0 GUICtrlSetData ($progressbar,$i) GUICtrlSetData ($procent,$i & ' %') Sleep(100) EndIf Wend Edited August 31, 2007 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
roflmao Posted August 31, 2007 Author Share Posted August 31, 2007 (edited) Ok, so this is my script now, forgot to say that i got some "sleep" in it, so i dont know if it need to get done with all the sleeps before it reacts to the second button, (EDIT):Yes i need to wait til sleep stuff gets done before it reacts that i have pressed stop. Any way to "fix" this? #include <GUIConstants.au3> GUICreate("Test", 250, 100) GUISetState (@SW_SHOW) $Button1 = GUICtrlCreateButton("Start", 10, 10, 230) $Button2 = GUICtrlCreateButton("Stop", 10, 40, 230) While 1 $nMsg = GUIGetMsg() If $nMsg = $Button1 Then while 2 sleep(3000) ControlSend("", "", "", "{space}") Sleep(30000) ControlSend("", "", "", "test") Sleep(50000) ControlSend("", "", "", "test") Sleep(40000) ControlSend("", "", "", "test") Sleep(30000) ControlSend("", "", "", "test") If $nMsg = Button2 Then ExitLoop EndIf WEnd EndIf If $NMsg = $GUI_EVENT_CLOSE Then ExitLoop WEnd Edited August 31, 2007 by roflmao Link to comment Share on other sites More sharing options...
mrbloody369 Posted August 31, 2007 Share Posted August 31, 2007 (edited) The Post by Zedna maybe your best way then, in less you want to kill the second button idea and hotsetkey it in. short example HotKeySet("^!x","Panic") Func Panic() ExitLoop EndFunc ;===> Panic Edited August 31, 2007 by mrbloody369 Favorite Quotes"If you apply your mind you can create any thing you can dream of" "Any thing can get done by simply click of a button" Link to comment Share on other sites More sharing options...
roflmao Posted September 2, 2007 Author Share Posted September 2, 2007 So, i was tierd last night so i didt think of this, but anyway, im going to make a script that has a gui with a start button that is going to start a nother script and a stop button that is going to stop that script. Both are going to be a exe so i can start and stop. But i got this problem now, the "WEnd" command dont find my "While 1" or somthing.. #include <GUIConstants.au3> GUICreate("LoLPwn! ^___________^", 250, 100) GUISetState (@SW_SHOW) While 1 $msg = Guigetmsg() If $msg = $Start Then Run("Prog.exe", "", @SW_HIDE) If $msg = $Stop Then ProcessClose("Prog.exe") EndIf Sleep(100) WEndoÝ÷ ضØb±ê뢶®¶sdÆæR#2fÆRgV÷C´3¢b3#µW6W'2b3#´Ö6b3#´FW6·F÷b3#µ67&Bb3#µ67&Bb3#µ&öræS2gV÷C² ¥tVæ@ ¤W'&÷#¢gV÷CµvVæB7FFVÖVçBvFæòÖF6ærgV÷CµvÆRgV÷C²7FFVÖVçBà Link to comment Share on other sites More sharing options...
Zedna Posted September 2, 2007 Share Posted September 2, 2007 missing end if While 1 $msg = GUIGetMsg() If $msg = $Start Then Run("Prog.exe", "", @SW_HIDE) EndIf If $msg = $Stop Then ProcessClose("Prog.exe") EndIf Sleep(100) WEnd Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
roflmao Posted September 2, 2007 Author Share Posted September 2, 2007 Thanks 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