Jump to content
Sign in to follow this  
Matt123

Trouble with array, variables and File Content

Recommended Posts

Matt123

I have a file that lists info about different categories, and the categories are separated by lines and info by "|" (this symbol), getting the info seems to work, but when I split it into an array thats where the trouble comes in.

I'm getting this error "Array variable has incorrect number of subscripts or subscript dimension range exceeded.:"

This is sorta what my code looks like, I'm getting the error first where you see " *** ". Please Help. Thanks! :)

$x = 2
         ;to skip the line talking about the info
  $file_cards = FileOpen("file.txt", 0);0 = Read mode
While $x <= 8
  $contents = FileReadLine("file.txt", $x)
  $INFO = StringSplit(StringStripWS($contents,8),"|")
  ***  $name    = $INFO[0]  ***
  $type  = $INFO[1]
  $time1    = $INFO[2]
  $time2    = $INFO[3]
  $check1  = $INFO[4]
  $check2  = $INFO[5]

$x  = $x + 1
Wend

Share this post


Link to post
Share on other sites
Matt123

TEXT FILE

TYPE | TIME1 | TIME2 | CHECK1 | CHECK2
TEST1 | 25 | 50 | NO | YES
TEST2 | 12 | 20 | YES | NO
TEST3 | 16 | 70 | NO | NO
TEST4 | 29 | 15 | YES | NO

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  

×