WaterFish22 Posted September 27, 2005 Posted September 27, 2005 Dose autoitv3 have a goto line or skip to line feature when runing a program? I searched the help file and i didn't find anything. Exzample: ;Varible that can change = $Varible$Varible = XIf $Varible < 99 THEN SLEEP(10000)ELSE ; GOTO or SKIP TO LINE 14 If $Varible > 1 THEN SoundPlay (C:\windows\media\somefile.mp3)ELSE ; GOTO or SKIP TO LINE 14 ;Line 14SoundPlay (C:\windows\media\somefile99.mp3)EXIT; I have a large code then this maby 2 pages ; a go to comand or skip to comand would be helpful to ; elimnate clutter. Thanks!
lte5000 Posted September 27, 2005 Posted September 27, 2005 Hello,Didn't look at you code closely.Hope these links get you started:http://www.autoitscript.com/autoit3/docs/faq.htm#4http://www.autoitscript.com/forum/index.ph...b&highlite=gotoKendall
Buffo Posted September 27, 2005 Posted September 27, 2005 (edited) You have to define a function that is called. The function can named something else but I named it line14 to clarify what the difference to your script is. This should be the code you need: $Varible = X If $Varible < 99 Then Sleep(10000) Else ;Call function "Line14" Line14() EndIf If $Varible > 1 Then SoundPlay(C:\windows\media\somefile.mp3) Else ;Call function "Line14" Line14() EndIf ; This is the function you have to define Func Line14() SoundPlay (C:\windows\media\somefile99.mp3) Exit EndFunc To understand this look in the help file under Func...EndFunc. Hope it helps :-) Cu, Buffo Edited September 27, 2005 by Buffo
jefhal Posted September 27, 2005 Posted September 27, 2005 I asked the same question when I started working with AutoIT. (Dartmouth Basic had it 40 years ago.) Then I was shown how it can all be handled with if-then-else, or select-case-endselect, or several other methods. Keep in mind you can use these in steps: case $x < 1 something case $x = 0 something case $x > 0 something and so on. You never need a goto again. Very refreshing, and your code is much easier to understand and debug... ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
MSLx Fanboy Posted September 27, 2005 Posted September 27, 2005 Goto promotes sloppy 'spaghetti-string code', which becomes a nightmare to read after only a few lines, which is why is was replaced with real functions in autoit3 Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate())
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