Robin Posted March 26, 2009 Share Posted March 26, 2009 (edited) Hi guys...I'm a bit stuck on this one...What is the correct command to call a Func from within a func, but at the same time EXIT the current Func? ie I want to jump from Func 1 to Func 2, and then back to func 1 without creating an endless f-up. I know in assembler we use Ret or RetF and THEN cal a func Edited March 26, 2009 by Robin Link to comment Share on other sites More sharing options...
BrettF Posted March 26, 2009 Share Posted March 26, 2009 You can't end the current func... I could think of workarounds but why :S Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
GEOSoft Posted March 26, 2009 Share Posted March 26, 2009 (edited) There are a few ways of doing it depending on the Return values of the functions but they will usually require a conditional. $Rtn = _Function1() If NOT @Error Then MsgBox(0, "TEST RESULTS", "Today is the 26th") Func _Function1() If _Function2() Then Return SetError(0, 0) Return SetError(1,1) EndFunc Func _Function2() If @MDAY = 26 Then Return @MDAY Return False EndFunc Edited March 26, 2009 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 26, 2009 Moderators Share Posted March 26, 2009 Robin,You cannot quit the first function BEFORE calling the second, but you can AFTER by using Return.I assume you are using some form of conditional (If, Select, Switch) to decide whether to run the second function. If so, then just use Return after the function call:; call function 1 _Func_1() Func _Func_1() ; function 1 code If $var > 23 ; or some other decision code _Func_2() ; call function 2 Return ; You leave function 1 and return to the main script EndIf ; more function 1 code that is not used if function 2 has been called EndFuncI hope that helpsM23 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...
Robin Posted March 26, 2009 Author Share Posted March 26, 2009 (edited) Robin, You cannot quit the first function BEFORE calling the second, but you can AFTER by using Return. I assume you are using some form of conditional (If, Select, Switch) to decide whether to run the second function. If so, then just use Return after the function call:; call function 1 _Func_1() Func _Func_1() ; function 1 code If $var > 23; or some other decision code _Func_2(); call function 2 Return ; You leave function 1 and return to the main script EndIf ; more function 1 code that is not used if function 2 has been called EndFunc I hope that helps M23THAAAATS what i meant....Thanks Melba23...this is exactly what i want.... Thanks to the other guys too for helping Edited March 26, 2009 by Robin 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