renehasp Posted May 17, 2006 Share Posted May 17, 2006 I just cant seem to figure out the whole loop thing. Can somone show me how they would write this tyoe of script in the new autoit. Or if you can point me to some good documentation on how the loop features can be used. Thanks Rene *********************************************** y Z :abc If y then go to :def else goto exit :def Print "hi" :exit exit ************************************************* Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted May 17, 2006 Share Posted May 17, 2006 For $x = 1 to 10 MsgBox(0,"Loop","This is Loop Number " & $x) Next def() Func def() MsgBox(0,"Done","Loop is done") Exit EndFunc another example $i = 0 While 1 $i = $i + 1 MsgBox(0,"Loop","This is loop number " & $i) If $i = 7 Then Def() EndIf WEnd Func Def() MsgBox(0,"Done","Loop is done") Exit EndFunc BY THE WAY YOU USING v2 I RECOMMEND YOU DOWNLOAD Autoit V3 and BETA Link to comment Share on other sites More sharing options...
renehasp Posted May 17, 2006 Author Share Posted May 17, 2006 I'm using 3 But it still makes no sense. Lets say in the folowing script I want the script to exit automaticaly after it opens word or Notepad how would I acomplish it? #include <GUIConstants.au3> GUICreate("Custom Msgbox", 210, 80) $Label = GUICtrlCreateLabel("Please click a button!", 10, 10) $YesID = GUICtrlCreateButton("Notepad", 10, 50, 50, 20) $NoID = GUICtrlCreateButton("Word", 80, 50, 50, 20) $ExitID = GUICtrlCreateButton("Exit", 150, 50, 50, 20) GUISetState() ; display the GUI Do $msg = GUIGetMsg() Select Case $msg= $YesID run("notepad.exe") Case $msg= $NoID run("C:\Program Files\Microsoft Office\OFFICE11\winword.exe") Case $msg= $ExitID MsgBox(0,"You clicked on", "Exit") Case $msg= $GUI_EVENT_CLOSE MsgBox(0,"You clicked on", "Close") EndSelect Until $msg = $GUI_EVENT_CLOSE or $msg = $ExitID Link to comment Share on other sites More sharing options...
renehasp Posted May 17, 2006 Author Share Posted May 17, 2006 Cool I think I figured it out! with the exit function... #include <GUIConstants.au3> GUICreate("Custom Msgbox", 210, 80) $Label = GUICtrlCreateLabel("Please click a button!", 10, 10) $YesID = GUICtrlCreateButton("Notepad", 10, 50, 50, 20) $NoID = GUICtrlCreateButton("Word", 80, 50, 50, 20) $ExitID = GUICtrlCreateButton("Exit", 150, 50, 50, 20) GUISetState() ; display the GUI Do $msg = GUIGetMsg() Select Case $msg= $YesID run("notepad.exe") exit Case $msg= $NoID run("C:\Program Files\Microsoft Office\OFFICE11\winword.exe") exit Case $msg= $ExitID MsgBox(0,"You clicked on", "Exit") Case $msg= $GUI_EVENT_CLOSE MsgBox(0,"You clicked on", "Close") EndSelect Until $msg = $GUI_EVENT_CLOSE or $msg = $ExitID Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted May 17, 2006 Share Posted May 17, 2006 (edited) why notjust put an exit after you run it? good job hahah #include <GUIConstants.au3> GUICreate("Custom Msgbox", 210, 80) $Label = GUICtrlCreateLabel("Please click a button!", 10, 10) $YesID = GUICtrlCreateButton("Notepad", 10, 50, 50, 20) $NoID = GUICtrlCreateButton("Word", 80, 50, 50, 20) $ExitID = GUICtrlCreateButton("Exit", 150, 50, 50, 20) GUISetState(); display the GUI Do $msg = GUIGetMsg() Select Case $msg= $YesID run("notepad.exe") Exit Case $msg= $NoID run("C:\Program Files\Microsoft Office\OFFICE11\winword.exe") Exit Case $msg= $ExitID MsgBox(0,"You clicked on", "Exit") Case $msg= $GUI_EVENT_CLOSE MsgBox(0,"You clicked on", "Close") EndSelect Until $msg = $GUI_EVENT_CLOSE or $msg = $ExitID Edited May 17, 2006 by thatsgreat2345 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