Jump to content

Creation of an array not working?


stderr
 Share

Recommended Posts

Is it my stupidity or is there something wrong with AutoIt?

$shops[0] = "720, 540"
$shops[1] = "500, 480"
$shops[2] = "500, 420"

for $pos IN $shops

    msgbox(0,"", $pos)

next

Becomes:

C:\Users\stderr\Desktop\autoit\test3.au3 - 0 error(s), 1 warning(s)
->23:13:13 AU3Check ended.rc:1
>Running:(3.3.6.1):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "C:\Users\stderr\Desktop\autoit\test3.au3"    
C:\Users\stderr\Desktop\autoit\test3.au3 (1) : ==> Expected a "=" operator in assignment statement.:
$shops[0] = "720, 540"
$shops^ ERROR
->23:13:14 AutoIT3.exe ended.rc:1
>Exit code: 1    Time: 1.366

Using AutoIt 3.3.6.1 on Windows 7 64bit (Ultimate)

greetings,

stderr

Link to comment
Share on other sites

  • Developers

Ok .. thanks for the hint.

Maybe it should be added in the Docs ... there is nothing to read about previous defining of an array.

it is:

Arrays

An Array is a variable containing series of data elements of the same type and size. Each element in this variable can be accessed by an index number.

An example:

Let's say you want to store these series of characters: "A", "U", "T", "O", "I", "T" and "3".

You could use seven separate variables to do so, but using an Array is more efficient:

$Array[0]="A"

$Array[1]="U"

..etc..

$Array[6]="3"

To access a specific value in an Array, you only have to know the index number:

$MyChar=$Array[2]

This results in $MyChar containing the letter "T" (See also: 'operators').

The index number can also be substituted by another variable or an expression, so you can build complex ways to assign or access elements in an array.

Arrays can also be multi dimensional, when you use multiple series of index numbers, like:

$Array[0][0]="Upper-Left"

$Array[1][0]="Lower-Left"

$Array[0][1]="Upper-Right"

$Array[1][1]="Lower-Right"

(These values are just examples)

You can use up to 64 dimensions in an Array. The total number of entries cannot be greater than 2^24 (16 777 216).

Before you can start using Arrays in your script, you must define their bounds using the 'Dim' keyword.

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

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...