dkwokgs Posted April 11, 2004 Posted April 11, 2004 Hi there, I cannot find the Goto or Sub function in Autoit v3. I want to repeatly copy some files in different part of my script. Please advise how to without the goto command. Thanks. Cheers Daniel
jpm Posted April 11, 2004 Posted April 11, 2004 You have to define a user function by Func myFunction () ... EndFunc and just replace your Gosub by MyFunction(). If you have AutoIt V2 script you can try to convert with the "V2 to V3 converter" you find in the Extras folder. There is a lot of new functions in V3 but the GOTO has gone for ever. replace by a structured language with If...then...else, While...wend, Do...Until, Func...EndFunc Take a look at the doc
Blue_Drache Posted October 29, 2004 Posted October 29, 2004 (edited) jpm said: You have to define a user function by Func myFunction () ... EndFuncand just replace your Gosub by MyFunction().If you have AutoIt V2 script you can try to convert with the "V2 to V3 converter" you find in the Extras folder.There is a lot of new functions in V3 but the GOTO has gone for ever. replace by a structured language with If...then...else, While...wend, Do...Until, Func...EndFuncTake a look at the doc <{POST_SNAPBACK}>Docs are ok, but I'd rather look at the nurses. OK, but on a more serious note: How is the removal of goto // gosub making it a "structured" language? calling subroutines would be much easier than a defined function... although they are more or less one and the same, just that for the Old Schoolers (myself included) are more used to the goto and gosub calls. Would it have been that much of a pain to leave them in? Edited October 29, 2004 by Blue_Drache Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache
scriptkitty Posted October 29, 2004 Posted October 29, 2004 Deadhorse topic. Very well argued on both sides pretty well in the past. All I will say is that you can have spagetti code in both, and clean nice code as well, but learn to use UDFs and loops and you will never go back. Took me a long time to give up my oldschool GOTOs, and I still use them in many other languages. I tend not to put a lot (or any) comments in my own scripts(unlike I do here) so when I go back and look at code I did 6 mos ago, it can be hard to debug. Having this structure helps a lot. It also helps me interpret other folks scriblings. "Functions Rule!" not my quote, but I like it. AutoIt3, the MACGYVER Pocket Knife for computers.
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