jonez34 Posted December 12, 2006 Posted December 12, 2006 I tried searching the forums for this question as I am sure someone has asked this but I didn't have enough charachthers for the search. Anyway, I am very new to this (2 hours in fact) and am wondering how do I do an if statment where a Yes anwser will go somewhere an No will quit the script. I'm thinking of something like If MsgBox(4,"Blah","Blah") = <this is were I need help> I need the yes to go to either another line in the script or call another au3 file (haven't decided yet) and the NO to just exit. I think that I need an Else statement but everything that I try gives me an error. Also since I would like to know, whats the equivilent of the batch files GOTO command in autoit? I am really looking forward to the anwser as this is a really cool way of doing things.
BALA Posted December 12, 2006 Posted December 12, 2006 There's no longer a GoTo command anymore in the AutoIt language. You can still get similar effect with a loop [font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com
Developers Jos Posted December 12, 2006 Developers Posted December 12, 2006 I tried searching the forums for this question as I am sure someone has asked this but I didn't have enough charachthers for the search. Anyway, I am very new to this (2 hours in fact) and am wondering how do I do an if statment where a Yes anwser will go somewhere an No will quit the script. I'm thinking of something like If MsgBox(4,"Blah","Blah") = <this is were I need help> I need the yes to go to either another line in the script or call another au3 file (haven't decided yet) and the NO to just exit. I think that I need an Else statement but everything that I try gives me an error. Also since I would like to know, whats the equivilent of the batch files GOTO command in autoit? I am really looking forward to the anwser as this is a really cool way of doing things. Button Pressed Return Value OK 1 CANCEL 2 ABORT 3 RETRY 4 IGNORE 5 YES 6 NO 7 TRY AGAIN ** 10 CONTINUE ** 11 so If MsgBox(4,"Blah","Blah") = 6 then ; yes Else ; No EndIF 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.
jonez34 Posted December 12, 2006 Author Posted December 12, 2006 O.k. so below is the script that I am trying to get done. If MsgBox (4,"Question","Do you have a zip program installed?") = 6 Then MsgBox (0,"what","what") Else Exit EndIf I always get an error when I run it. Also instead of the MsgBox of what and what how would I get it to go to either another line in the script (line 21 for example) or call another au3 file?
Developers Jos Posted December 12, 2006 Developers Posted December 12, 2006 O.k. so below is the script that I am trying to get done. If MsgBox (4,"Question","Do you have a zip program installed?") = 6 Then MsgBox (0,"what","what") Else Exit EndIf I always get an error when I run it. Also instead of the MsgBox of what and what how would I get it to go to either another line in the script (line 21 for example) or call another au3 file?That is because you do not use the proper syntax... look at the helpfile to see the options... If MsgBox (4,"Question","Do you have a zip program installed?") = 6 Then MsgBox (0,"what","what") Else Exit EndIf 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.
jonez34 Posted December 12, 2006 Author Posted December 12, 2006 (edited) Thank you JdeB. I tried the help file but it is a little to vague sometimes. Now above the posts says that I can use the Loop command. How does the loop command send the script to another line in the code? Edited December 12, 2006 by jonez34
Developers Jos Posted December 12, 2006 Developers Posted December 12, 2006 (edited) Thank you JdeB. I tried the help file but it is a little to vague sometimes.Nah... there is a difference between vague and not understanding .... Thank you JdeB. I tried the help file but it is a little to vague sometimes.Now above the posts says that I can use the Loop command. How does the loop command send the script to another line in the code?I am sure BALA will be happy to elaborate on that .... Edited December 12, 2006 by JdeB 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.
BALA Posted December 12, 2006 Posted December 12, 2006 Nah... there is a difference between vague and not understanding .... I am sue BALA will be happy to elaborate on that ....I'm not quite sure if that's a compliment or insult. So I'll just stare.... [font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com
BALA Posted December 12, 2006 Posted December 12, 2006 (edited) Anyways, I'm quite into NT Batch Scripting myself so I know what it's like to not have the greatness of the GoTo command *sniff* *sniff* But we will have to do. To create a loop in a batch file you probably would have done something liek this: CODE:BEGIN ECHO Hello World! GOTO BEGIN For AutoIt you can do something like this: While 1 = 1 MsgBox(0, "Hello World!", "Hello World!") WEnd Hope that helped By the way, check out my site for awesome batch file programs I've made Edited December 12, 2006 by BALA [font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com
Developers Jos Posted December 12, 2006 Developers Posted December 12, 2006 I'm not quite sure if that's a compliment or insult. So I'll just stare.... Why ... didn't you bring up this idea ? 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.
jonez34 Posted December 12, 2006 Author Posted December 12, 2006 Alright, thats good to know. So if I was at the end of the script and wanted to call another au3 file based on the entry from a user how would one go about that.
BALA Posted December 12, 2006 Posted December 12, 2006 http://www.autoitscript.com/forum/index.php?showtopic=37770That may help you in calling for another .au3 file [font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com
herewasplato Posted December 12, 2006 Posted December 12, 2006 Alright, thats good to know...It seems that you already have your answer, but here is some more info:While 1 ;this would be like your label MsgBox(0, "", "Hi") WEnd ;this would be like telling AutoIt to goto the labeloÝ÷ Ù«¢+Ù]¡¥±Ä(5Í ½à À°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½Ðí$Ìäí´½¥¹Ñ¼¼Í½µÝ¡É¸ÅÕ½Ðì¤(}ͽµÝ¡É ¤íÑ¡¥Ì¥Ì±¥¹½Ñ¡ÈÑåÁ½½Ñ¼(5Í ½à À°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½Ðí$Ìäí´¬¸ÅÕ½Ðì¤)]¹()Õ¹}ͽµÝ¡É ¤(5Í ½à À°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½Ðí$Ìäí´Í½µÝ¡É¸ÅÕ½Ðì¤)¹Õ¹ìôôÐí}ͽµÝ¡É [size="1"][font="Arial"].[u].[/u][/font][/size]
BALA Posted December 12, 2006 Posted December 12, 2006 Simply put, AutoItv3 is a murderer! [font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com
herewasplato Posted December 12, 2006 Posted December 12, 2006 (edited) Simply put, AutoItv3 is a murderer!Simply put, AutoItv3 is murder!Take your time - you will get it... maybe. Edited December 16, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size]
BALA Posted December 12, 2006 Posted December 12, 2006 I guess eventually, but it would be a lot easier if we still had the GoTo command. [font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com
dandymcgee Posted December 12, 2006 Posted December 12, 2006 (edited) GoTo is the same thing as using a function.... there is absolutely no difference besides the command name, and the fact that functions can also have parameters. Batch: ECHO Hello World! GOTO BEGIN :BEGIN ECHO begin has been called. AutoIt: MsgBox(0, "Title", "Hello World!") Begin() Func Begin() MsgBox(0, "Title", "Begin has been called.") EndFunc The AutoIt code looks a little more intimidating at first, but the extra parameters can proove to be quite useful over time. Just stick with it, and keep learning. Edited December 12, 2006 by dandymcgee - Dan [Website]
jonez34 Posted December 13, 2006 Author Posted December 13, 2006 Thats hot! I love it. I'm scripting up one side of my machine and down the other now. Thanks for every ones help.
Curtiss W. Posted December 22, 2006 Posted December 22, 2006 I was looking for the goto command myself. After a few hours of playing with the Func command I was able to make it work. I can see why learing that was important, but I did finally figure out how to create a goto like command. It was prety simple and I could have shot myself for not figureing it out sooner. I tried to use a null variable but AutoIT did not like that. Curtiss W. CODE; Adding a goto like fuction in AutoIT V3.; All you need to do is add a variable early in you program. I am going to call; mine goto1. (Then any where you really need to use a goto command you can just; uase a If Then statement.$goto1 = "1" ;Setting up the goto variableIf $goto1 = "1" Then label_name() ; Change label name to the name you are using.
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