JohnOne Posted February 10, 2015 Share Posted February 10, 2015 Of course not, it's a bit noob and silly to do either, but a valid curiosty I suppose. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
czardas Posted February 10, 2015 Share Posted February 10, 2015 (edited) I wasn't sure if the interpreter would ignore subsequent Static declarations, as it appears to do under normal circumstances in local scope: when a function is repeatedly called. The fact it throws an error tells us something about the inner workings of AutoIt. Edited February 10, 2015 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
JohnOne Posted February 10, 2015 Share Posted February 10, 2015 Another question might a;so arise. We know that in AutoIt you do not have to declare a variable with either the Global or Local scope keywords (excluding uninitiated arrays maybe). So we say this is bad... While 3 Local $var = 10 ;Something else Sleep(1000) WEnd But what is happening here... While 3 $var = 10 ;Something else Sleep(1000) WEnd Is it being re-declared? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
czardas Posted February 10, 2015 Share Posted February 10, 2015 (edited) Not the way I see it. The variable exists after the first encounter and its assigned value is overwritten on subsequent runs. If the variable does not already exist, it will be declared internally within the local (current) scope, which could be either local or global depending on the circumstance. Edited February 10, 2015 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
JohnOne Posted February 10, 2015 Share Posted February 10, 2015 So AutoIt does re-declare a variable if the scope keyword is used, but deals with it internally if it does not? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
czardas Posted February 10, 2015 Share Posted February 10, 2015 That ought to be correct! operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
jdelaney Posted February 10, 2015 Share Posted February 10, 2015 Depends. If you declare local on the same level as another local with the same variable name, then they will overwrite. If you declare local inside a function, and outside a function, they are seperated. If you declare global outside a function and DONT local the same in a function, the global is overwritten. If you declare local outside a function and DONT local the same in a function, the outside local is overwritten IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. 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