Jump to content

Array with stringindexes


 Share

Recommended Posts

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?

Link to comment
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]

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...