Sign in to follow this  
Followers 0
charvi

No GOTO directive in AutoIT...

9 posts in this topic

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?

Share this post


Link to post
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]

Share this post


Link to post
Share on other sites

Is "Return" the keyword you're looking for? :)


Broken link? PM me and I'll send you the file!

Share this post


Link to post
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:)

Share this post


Link to post
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]

Share this post


Link to post
Share on other sites

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

Try it and be amazed :)

test()

Func test()
    Return
    MsgBox(0,"Nope","Not showing")
EndFunc

Broken link? PM me and I'll send you the file!

Share this post


Link to post
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]

Share this post


Link to post
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!

Share this post


Link to post
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
Sign in to follow this  
Followers 0