MvGulik Posted December 30, 2010 Share Posted December 30, 2010 Because your saving the Gui result into a local (to function) variable. "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
LMTA Posted December 30, 2010 Author Share Posted December 30, 2010 (edited) That's very clear, thank you for that elaboration! Is it possible to take the new contents of that local (Function) variable to another function? Edited December 31, 2010 by LMTA Link to comment Share on other sites More sharing options...
ZacUSNYR Posted December 30, 2010 Share Posted December 30, 2010 Either set it Global or return it. Link to comment Share on other sites More sharing options...
MvGulik Posted December 30, 2010 Share Posted December 30, 2010 (edited) ... or ByRef it.see on functions. (and variable declaration and variable scope, dim, local, global) Edited December 30, 2010 by MvGulik "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
LMTA Posted December 31, 2010 Author Share Posted December 31, 2010 (edited) @ZacUSNYR and @MvGulik: Thanks for the suggestions, I will give it a try! I have declared the $Map1, 2, 3 and 4 values globally, therefore I was expecting that these global variables would be updated.BTW: I do read the manual before I put a question here. However, it's not always clear for a noob as myself why things sometimes do not work as I expect them to... Edited January 7, 2011 by LMTA Link to comment Share on other sites More sharing options...
MvGulik Posted December 31, 2010 Share Posted December 31, 2010 BTW: I do read the manual before I put a question here. However, it's not always clear for a noob as myself why things sometimes do not work as I expect them to...No shame in quoting a part of the help file that seems unclear, and if needed specifying what it is you think it means or showing some code that is not doing what you think it should be doing. Great way to get some additional information. And maybe even some example codes that shows how it works and what the pitfalls might be. "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
LMTA Posted January 7, 2011 Author Share Posted January 7, 2011 No shame in quoting a part of the help file that seems unclear, and if needed specifying what it is you think it means or showing some code that is not doing what you think it should be doing. Great way to get some additional information. And maybe even some example codes that shows how it works and what the pitfalls might be. Okay, here's an excerpt from the helpfile: Func functioname ( [Const] [byRef] $param1, ..., [Const] [byRef] $paramN, $optionalpar1 = value, ...) ... [Return [value]] EndFunc What I don't get from the manual, is how to implement the ByRef feature in the GUI part of my code. I also don't actually understand why the ByRef feature would help me in this case: I am already declaring the values globally, right? If I adapt the code for the GUI function with the ByRef: Func InstellingenMenu(Byref $Map1, Byref $Map2, Byref $Map3, Byref $Map4)When running the script generates errors, like: ElmoReader.au3(150,74) : ERROR: InstellingenMenu() called by a previous line with 0 arg(s). Min = 4. First previous line calling this Func is 74. Func InstellingenMenu(Byref $Map1, Byref $Map2, Byref $Map3, Byref $Map4) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ ElmoReader.au3(150,74) : ERROR: InstellingenMenu() previously called with Const or expression on ByRef param(s). Func InstellingenMenu(Byref $Map1, Byref $Map2, Byref $Map3, Byref $Map4) ElmoReader.au3(150,74) : ERROR: InstellingenMenu() called by a previous line with 0 arg(s). Min = 4. First previous line calling this Func is 54. Func InstellingenMenu(Byref $Map1, Byref $Map2, Byref $Map3, Byref $Map4) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ ElmoReader.au3(150,74) : ERROR: InstellingenMenu() previously called with Const or expression on ByRef param(s). Func InstellingenMenu(Byref $Map1, Byref $Map2, Byref $Map3, Byref $Map4)Some suggestions what I am (obviously) doing wrong? I still am in the assumption those variables are globally being set and read, but it does not work as I am expecting. Link to comment Share on other sites More sharing options...
MvGulik Posted January 7, 2011 Share Posted January 7, 2011 (edited) nevermind. Edited June 28, 2011 by iEvKI3gv9Wrkd41u "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... 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