Rofellos Posted December 20, 2010 Share Posted December 20, 2010 (edited) In AutoIt, you can not create a dynamic array, you have to specify the length of the array when you create it. One way to create dynamic arrays is create a dynamic string, where substrings are separated by a charactere like "\", and then, use StringSplit. $sString = "" $sString &= "Frist String" & "\" $sString &= "Second String" & "\" $sString &= "Third String" & "\" $aArray = StringSplit( $sString , "\" ) ; $aArray[0] is number of substrings, in this case is 4. ; $aArray[1] is the string "Frist String" ; $aArray[2] is the string "Second String" ; $aArray[3] is the string "Third String" ; $aArray[4] is the string "" Edited December 21, 2010 by Rofellos Link to comment Share on other sites More sharing options...
shanet Posted December 20, 2010 Share Posted December 20, 2010 That should error because you have no delimeters in your stringsplit. [font="Comic Sans MS"]My code does not have bugs! It just develops random features.[/font]My Projects[list][*]Live Streaming (Not my project, but my edited version)[right]AutoIt Wrappers![/right][/list]Pure randomness[list][*]Small Minds.......................................................................................................[size="1"]Simple progress bar that changes direction at either sides.[/size][*]ChristmasIt AutoIt Christmas Theme..........................................................[size="1"]I WAS BOOOORED![/size][*]DriveToy..............................................................................................................[size="1"]Simple joke script. Trick your friends into thinking their computer drive is haywire![/size][/list]In Development[list][*]Your Background Task Organiser[*]AInstall Second Generation[/list]BEFORE POSTING ON THE FORUMS, TRY THIS: %programfiles%/AutoIt3/autoit3.chm Link to comment Share on other sites More sharing options...
Mat Posted December 20, 2010 Share Posted December 20, 2010 ReDim means that AutoIt's arrays are dynamic. AutoIt Project Listing Link to comment Share on other sites More sharing options...
Rofellos Posted December 21, 2010 Author Share Posted December 21, 2010 Thanks shanet , I fixed it.ReDim means that AutoIt's arrays are dynamic.That works too. Link to comment Share on other sites More sharing options...
ZacUSNYR Posted December 21, 2010 Share Posted December 21, 2010 ReDim means that AutoIt's arrays are dynamic.That's how i've always done it, but the OPs way is a good alternative and overly simple. Link to comment Share on other sites More sharing options...
Mat Posted December 21, 2010 Share Posted December 21, 2010 _ArrayAdd and _ArrayPop / _ArrayDelete then That's the easiest way to do it properly. Constantly using StringSplit is not a good idea. You'll get confused as to whether it's a string or array you're are using and it's just as many steps (if not more) to try and edit it. AutoIt Project Listing Link to comment Share on other sites More sharing options...
Rofellos Posted December 22, 2010 Author Share Posted December 22, 2010 (edited) _ArrayAdd and _ArrayPop / _ArrayDelete then That's the easiest way to do it properly. Constantly using StringSplit is not a good idea. You'll get confused as to whether it's a string or array you're are using and it's just as many steps (if not more) to try and edit it.The idea was to use StringSplit() to make a function. Not constantly use StringSplit() over the source code. I didn't know _ArrayAdd, thanks. Edited December 22, 2010 by Rofellos Link to comment Share on other sites More sharing options...
kaotkbliss Posted December 22, 2010 Share Posted December 22, 2010 I like your avatar... 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
Rofellos Posted December 22, 2010 Author Share Posted December 22, 2010 I like your avatar...Karina. The name is Karina. 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