Sign in to follow this  
Followers 0
Thoha

Array with stringindexes

2 posts in this topic

I have the following piece of code:

For $i = 1 to 10
  $newarray[$stringarray[$i]] = "Test"
Next

The $stringarray contains some different strings, however the size of the array remains to be one in stead of ten :S

Any solution to this?

Share this post


Link to post
Share on other sites



AutoIt arrays can only use non-negative integers for array indexes. If you want to use strings, look for Scripting.Dictionary in the forum search. If you are attempting to fill an array with ten items, try this:

Dim $newarray[10]
for $i = 0 to 9
  $newarray[$i] = "Test"
next

[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0