Jump to content

No GOTO directive in AutoIT...


charvi
 Share

Recommended Posts

Hi everyone,

I read in the introduction that AutoIT has no GOTO directive (or removed it). Sure that it might be seen as an obsolete directive however it would have been a lot easier in some circumstances, to branch directly to a certain point of the program...

For example, instead of jumping testing codes, I need to remark them now.

My actual problem is how to prematurely exit a function if a condition needs to.

Func Test($a)
   If $a = 0 Then [goto end]

  ; do stuff here

:end
EndFunc

I don't see how to do that without GOTO. Who has an idea?

Link to comment
Share on other sites

Hi there,

Func Test($a)
   If $a = 0 Then out()
 ; do stuff here

:end
EndFunc

Func out()
    exit
Endfunc

Cheers

Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Link to comment
Share on other sites

GOTO is evil. Don't ask for it, talk about it, hint at it. Use functions. Functions are far better than GOTO. Mods and Devs get mad when one ask for GOTO. People have been dorked by mods when asking for GOTO. You have been been enlightened.....

enjoy!

Link to comment
Share on other sites

@November: No, that's not the solution, because EXIT seems to end the entire program. I only want to exit the function. I might be wrong but why do you call a function containing only Exit (to exit the Out() function???) instead of If $a = 0 Then Exit ??? :) I'm completely puzzled...

@monoceres: No, Return is not what I'm looking for. It is used to return a value, but I have nothing to return :)

@Volly: I know, that's the text I have read. I accept it too. But then I need a list of BEFORE:....GOTO.... AFTER:........... (stay home?) o:)

Link to comment
Share on other sites

AutoIt isn't so obedient as others :)

You can't say him go to... :)

LOL

Cheers

Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Link to comment
Share on other sites

Try it and be amazed :)

test()

Func test()
    Return
    MsgBox(0,"Nope","Not showing")
EndFunc
Dogmatic.. how can AutoIT return if he doesn't go to??? :) LOL

Cheers m8

Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Link to comment
Share on other sites

Try it and be amazed :)

test()

Func test()
    Return
    MsgBox(0,"Nope","Not showing")
EndFunc
YES monoceres !!! I AM very AMAZED !!!

I must now say that RETURN was indeed what I was looking for !!! :)

Thank you for the example!

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...