Jump to content

Why is wrong with this Array ?


deef99
 Share

Recommended Posts

I get this error and I don't understand what the issue is:

I:\VB\SiteChn.au3 (23) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

Case $array[4] = "U"

Case ^ ERROR

Here is the first line in $file: 8007019235,5890890,grc3,U

I had a Msgbox and it does show the Array[4] does equal U...so what is the problem?

Here is part of my code...

$line = FileReadLine($file)

If @error = -1 Then ExitLoop

;MsgBox(0, "Line read:", $line)

$array = StringSplit($line,",")

;look to see if going live U or turn down D

Select

Case $array[4] = "U"

$vec = 200

Case $array[4] = "D"

$vec = 61

EndSelect

Link to comment
Share on other sites

I get this error and I don't understand what the issue is:

I:\VB\SiteChn.au3 (23) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

Case $array[4] = "U"

Case ^ ERROR

Here is the first line in $file: 8007019235,5890890,grc3,U

I had a Msgbox and it does show the Array[4] does equal U...so what is the problem?

Here is part of my code...

$line = FileReadLine($file)

If @error = -1 Then ExitLoop

;MsgBox(0, "Line read:", $line)

$array = StringSplit($line,",")

;look to see if going live U or turn down D

Select

Case $array[4] = "U"

$vec = 200

Case $array[4] = "D"

$vec = 61

EndSelect

There must be a typo or something in the actual script, because this works fine:
$line = "8007019235,5890890,grc3,U"
$array = StringSplit($line, ",")

;look to see if going live U or turn down D
Select
    Case $array[4] = "U"
        $vec = 200
    Case $array[4] = "D"
        $vec = 61
EndSelect
ConsoleWrite("$vec = " & $vec & @LF)

Can you post a demo script we can actually run that will show the problem?

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...