Jump to content
Sign in to follow this  
Dinosaurr

Array variable has incorrect number of subscript or subscript dimension rage exceeded.

Recommended Posts

Dinosaurr

Global $Line[12]

For $i = 1 to 12 Step +1
    $Line[$i] = FileReadLine("ipaddresses.txt", $i)
Next

For $i = 1 to 12 Step +1
    ShellExecute("lol.exe", $Line[$i] & " 0")
    Sleep(2000)
Next

I was trying to get this to run, but i get that error when ever i try to run :)

Share this post


Link to post
Share on other sites
Authenticity

Array's first index is always 0 and grow up to array's size minus 1 so $Arr[5] is $Arr[0] through $Arr[4] which is the last subscript.

Edited by Authenticity

Share this post


Link to post
Share on other sites
Dinosaurr

Array's first index is always 0 and grow up to array's size minus 1 so $Arr[5] is $Arr[0] through $Arr[4] which is the last subscript.

Ahhh, i got it.

thanks.

Share this post


Link to post
Share on other sites
Authenticity

You don't need to use 'Step +1' because it's the default behavior. The problem here is that you don't know how much lines there will be so use some mechanism to ReDim the array or if you want you can use _FileReadToArray which returns 1 on success and the submitted array's first subscript $Array[0] containing the number of records then it can be accessed like this:

For $i = 1 To $Array[0]

; Do something here

Next

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  

×