The GW-Scripting list is a discussion list for information regarding the development and use of Window-Eyes scripts. Any subscriber of the GW-Scripting list has the ability to post on-topic messages.

From:

 David

Subject:

 Strange behavior in a VBScript, any ideas?

Date:

 Fri, Jan 29, 2010 6:31:35 am
I have a file, consisting of a 'table'. Each line in the text file, has three columns, and they are seperated with a Tab.I tried this code:

S = Txt.ReadLine
P = Split( S, VbTab )
C1 = P(0)
C2 = P(1)
C3 = P(2)

When running e script, I get an error telling me that
Subscript is out of range "[Number: 2]"

If now, I insert a line in my script:

S = Txt.ReadLine
msgbox "Hello"
P = Split....

Now the script runs perfectly well. That is, of course, now it stops for each line received from the text file, as the msgbox needs you to press OK. No good solution, when the script is reading 75 lines... :)

What puzzles me, is why it doesn't accept the P(2) line, when running uninterrupted; but gladly works with it, when the msgbox line is there. Any good explainations? Or, is the PC just having fun with me?

Thanks for all suggestions.

--
I am using the free version of SPAMfighter.
We are a community of 6 million users fighting spam.
SPAMfighter has removed 553 of my spam emails to date.
Get the free SPAMfighter here: http://www.spamfighter.com/len

The Professional version does not have this message