Wolfiesaxah Posted June 8, 2015 Share Posted June 8, 2015 Hi Guys, just a simple confirmation, I have a script that starts with a "while" loop and inside that while-loop there's tons of actions/scripts and tons of variables declared as "Local". My question is when the first round of while-loop script is done, do I need to release each variables before looping? I'm asking because there's a lot of variables inside that loop. These variables will be re-used in each loop. while 1 Local $VariableaA = "This is the first variable" Local $VariableaB = "This is the 2nd variable";More stuffs hereVariableaA = 0 ;<----DO I STILL NEED TO RELEASE EACH VARIABLES OR THE "Local" RE-DECLARATION AT THE START OF THIS LOOP AUTOMATICALLY DOES THAT? OR I GUESS THE ASSIGNING OF NEW VALUES KINDA RE-USES THEM.VariableaB = 0WEnd Link to comment Share on other sites More sharing options...
water Posted June 8, 2015 Share Posted June 8, 2015 Have you tested what the values of the variables are after the first loop? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted June 8, 2015 Share Posted June 8, 2015 A test as simple as this would show you how AutoIt works:Local $Test = "Test" ConsoleWrite($Test & @CRLF) Local $Test = "Test2" ConsoleWrite($Test & @CRLF) Local $Test ConsoleWrite($Test & @CRLF) My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Wolfiesaxah Posted June 8, 2015 Author Share Posted June 8, 2015 Awesome! I didn't know Autoit has ConsoleWrite Link to comment Share on other sites More sharing options...
water Posted June 8, 2015 Share Posted June 8, 2015 But the first place to look at is the help file:Declaring a variable with a simple value in the same scope will not change the value in the variable. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted June 8, 2015 Share Posted June 8, 2015 Awesome! I didn't know Autoit has ConsoleWrite Then you should have a look at the AutoIt tutorials in the wiki or the help file to get a better understanding of how AutoIt works My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
jchd Posted June 8, 2015 Share Posted June 8, 2015 It's also better for variables used in loops to be declared once before the loop. The Local qualifier doesn't limit them to the loop block: their scope is local to the function they are in, or the whole script when they are not declared inside a function, starting from the point of declaration. There is no other scoping construct like { ... } in C, for instance, like it or not.That also means that if you assign a significantly large value to a variable (like FileRead a very large text file or create a huge array) its content will persist outside of a loop and it's up to you to free the memory used by re-assigning 0 to it (re-assigning to an empty string will not free memory used by a string variable). This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with 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