Dashiva
October 1st, 2004, 03:39 AM
Alright, so i'm just some guy who doesn't know anything about this stuff.. but anyway, i'm writing this Jscript file to parse a text dump of a report we get here at work.
I load the text file..
fso = new ActiveXObject("Scripting.FileSystemObject");
f = fso.OpenTextFile(fileLocation, 1);
Then proceed to read each line in a loop, determining if I need what's in the line etc:
for (i=0; i<150; i)
{
line = f.ReadLine();
// Various code to parse the text file, and throw it in an excell spreadsheet
}
Alright, so my problem is that I can't come up with a method to figure out how many lines are in the text file. In the For loop I have it set to 150 for testing purposes, but for example if I have i<150 and the text file happens to be 10,000 lines, the script hangs.
I've tried to experiment with while (!f.AtEndOfStream) but can't seem to get it to work properly, it will just process one line, then quit...
Any ideas would be appreciated!
-Dasha
I load the text file..
fso = new ActiveXObject("Scripting.FileSystemObject");
f = fso.OpenTextFile(fileLocation, 1);
Then proceed to read each line in a loop, determining if I need what's in the line etc:
for (i=0; i<150; i)
{
line = f.ReadLine();
// Various code to parse the text file, and throw it in an excell spreadsheet
}
Alright, so my problem is that I can't come up with a method to figure out how many lines are in the text file. In the For loop I have it set to 150 for testing purposes, but for example if I have i<150 and the text file happens to be 10,000 lines, the script hangs.
I've tried to experiment with while (!f.AtEndOfStream) but can't seem to get it to work properly, it will just process one line, then quit...
Any ideas would be appreciated!
-Dasha