Jump to content

Goto or Skip to Line Comand


 Share

Recommended Posts

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 = X

If $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 14

SoundPlay (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!

Link to comment
Share on other sites

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 by Buffo
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...