pinkfoyd Posted February 23, 2006 Share Posted February 23, 2006 hi all ! can someone can help me explan why i can do this : dim $test $test[0] = 1 that return : test.au3 (2) : ==> Badly formated variable or macro.: $test[0] = 1 $test^ ERROR because i don't like create a very large array ( ie : dim $test[999] ) they are no solution for create a dynamicaly extentable array ? hope my explanation was clear Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 23, 2006 Moderators Share Posted February 23, 2006 hi all ! can someone can help me explan why i can do this : dim $test $test[0] = 1 that return : test.au3 (2) : ==> Badly formated variable or macro.: $test[0] = 1 $test^ ERROR because i don't like create a very large array ( ie : dim $test[999] ) they are no solution for create a dynamicaly extentable array ? hope my explanation was clear Have a script to look at? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Stumpii Posted February 23, 2006 Share Posted February 23, 2006 Probably because you are not creating $test as an array to start with, then trying to access it as an array. I think that I usually _ArrayCreate. i.e. (untested) dim $test = _ArrayCreate ( 1 ) Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity. Link to comment Share on other sites More sharing options...
GaryFrost Posted February 23, 2006 Share Posted February 23, 2006 (edited) Have a script to look at? Dim $test ;do some code If Not IsArray($test) Then Dim $test[1] Else ReDim $test[Ubound($test) + 1] EndIf $test[Ubound($test) - 1] = 1 Edited February 23, 2006 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
pinkfoyd Posted March 1, 2006 Author Share Posted March 1, 2006 (edited) ok grafost, as i understand, the only solution is to do a resize of the array for each element i need to insert.. thanks ! Edited March 1, 2006 by pinkfoyd Link to comment Share on other sites More sharing options...
kclteam Posted March 3, 2006 Share Posted March 3, 2006 Hi! I am not sure about the last post. How do you resize an array? If what I think is you mean to do is $test = _ArrayCreate ( 1 ) ;later wen I need to resize $test = _ArrayCreate ( 2 ) Will resizing an array everytime reset it's variable? That is to say, if I have created an array of size 1 having a value say "name" and then I resize it to 2 as shown above, will the value of array[1] still be "name"? I believe we should all pay our tax with a smile. I tried - but they wanted cash! Link to comment Share on other sites More sharing options...
ChrisL Posted March 3, 2006 Share Posted March 3, 2006 What about _ArrayAdd? #include <Array.au3> _ArrayAdd ( $avArray, $sValue ) [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
Developers Jos Posted March 3, 2006 Developers Share Posted March 3, 2006 Will resizing an array everytime reset it's variable? That is to say, if I have created an array of size 1 having a value say "name" and then I resize it to 2 as shown above, will the value of array[1] still be "name"?Remarks The ReDim keyword is similar to Dim, except that ReDim preserves the values in the array instead of removing the values while resizing an array. The number of dimensions must remain the same, or the old array will be forgotten during the ReDim. The array will retain the scope (Global or Local) that it had prior to resizing. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
kclteam Posted March 4, 2006 Share Posted March 4, 2006 Yeah...got it! Thanx ChrisL and JdeB for the infos. This seems to be a nice feature...gonna experiment with it more. I believe we should all pay our tax with a smile. I tried - but they wanted cash! 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