Jump to content

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


Recommended Posts

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 :)

Link to comment
Share on other sites

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

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