Jump to content
Sign in to follow this  

Array with stringindexes

Recommended Posts

I have the following piece of code:

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

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"

[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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...