samibb Posted February 15, 2021 Share Posted February 15, 2021 Dears is there any function in AutoIT works like GOTO in VBA i need it ? Thanks DonChunior 1 Link to comment Share on other sites More sharing options...
Somerset Posted February 15, 2021 Share Posted February 15, 2021 🙄 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 15, 2021 Moderators Share Posted February 15, 2021 samibb, Why on earth did you hijack a totally unrelated thread to ask this question? Short answer: No, because GOTO is evil. Longer answer: AutoIt uses functions instead, which offers more control over the flow of your script without the risk of spaghetti code. M23 Exit, mLipok and Musashi 3 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
genius257 Posted February 15, 2021 Share Posted February 15, 2021 Hi @samibb. If you're desperate, AutoIt2 has GOTO 😅 TheDcoder 1 My highlighted topics: AutoIt Package Manager, AutoItObject Pure AutoIt, AutoIt extension for Visual Studio Code Github: AutoIt HTTP Server, AutoIt HTML Parser Link to comment Share on other sites More sharing options...
junkew Posted February 15, 2021 Share Posted February 15, 2021 Just explain why you think you need GOTO and you will get alternative solutions TheDcoder 1 FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
TheDcoder Posted February 15, 2021 Share Posted February 15, 2021 2 hours ago, Melba23 said: GOTO is evil. I'll be the devil's advocate and say that it is not... but it is pretty easy to misuse @samibb As many others have pointed out in this thread, functions are used to split tasks into separate sections of code. For other uses of GOTO, consider using loops and other various control flow statements to accomplish your task Dan_555 1 EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
samibb Posted February 15, 2021 Author Share Posted February 15, 2021 Dear @junkew thank you very much . My program uses Internet via IE and running in list of sorted step. when the internet disconnect i need to start over after re signing because I'll lost the previse step. Thanks Link to comment Share on other sites More sharing options...
Somerset Posted February 15, 2021 Share Posted February 15, 2021 20 minutes ago, TheDcoder said: I'll be the devil's advocate and say that it is not... but it is pretty easy to misuse You are trying to invite some expletives hurled your direction, friend. TheDcoder and seadoggie01 2 Link to comment Share on other sites More sharing options...
Musashi Posted February 15, 2021 Share Posted February 15, 2021 At the very least, the excessive use of GOTO would be a decent substitute for an obfuscator . TheDcoder 1 "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
junkew Posted February 15, 2021 Share Posted February 15, 2021 You can do something like below You can assign function to a variable like $f=consolewrite $f("hello world") Just read the call, assign, eval, exitloop keywords in the helpfile func example() $stepCount=0 ;Some restart logic if ($failed) then $stepCount = 25 endif while ($stepCount <=99) call "step" & cstr($iCount) $stepCount=$stepCount+1 wend endfunc func step1() ... endfunc func step2() ... endfunc ... func step99() ... endfunc Nice example FrancescoDiMuro 1 FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
Nine Posted February 15, 2021 Share Posted February 15, 2021 To follow previous suggestions, here the way to use Loop as GoTo : #include <Constants.au3> Const $NUMBER_OF_STEPS = 2 Local $iStep = 1 While True SignIn() Do Call ("Step" & $iStep) If @error then ContinueLoop 2 $iStep += 1 Until $iStep > $NUMBER_OF_STEPS ExitLoop WEnd Func SignIn() ConsoleWrite ("Sign in" & @CRLF) EndFunc Func Step1() ConsoleWrite ("Step 1" & @CRLF) EndFunc Func Step2() ConsoleWrite ("Step 2" & @CRLF) EndFunc “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
JockoDundee Posted February 16, 2021 Share Posted February 16, 2021 Actually, the problem with GOTO is not where it goes to; it’s that it doesn’t come BACK FROM Skysnake and argumentum 2 Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
Gianni Posted February 22, 2021 Share Posted February 22, 2021 Just to say, if we had access to the internal stack of AutoIt return addresses and we could delete the top one (POP), it would be like turning the last used gosub into a GOTO .... Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
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