#10361
Stefan
Participant

Having e.g. “c:tempnumbers.txt” with one number at each line.

c:tempnumbers.txt:

123
222
345

Use an code like this to read this file into an array.
Then use a FOR loop to process each array indices (0 till highest index)
and inside the FOR loop use the current index to do what you want.



// 1.) helper code to read an files content

//Your file with the numbers, each at an own line:
NumbFile = "c:tempnumbers.txt";

//============================================
fso = new ActiveXObject("Scripting.FileSystemObject");
oFile = fso.OpenTextFile(NumbFile, 1, false, 0);
content = oFile.ReadAll();
oFile.Close();
fso = null;
//alert(content);
//============================================



// 2.) the needed code itself
//For Each Line In Lines Do:

LinesArray = content.split("n");
for (LineNumb = 0; LineNumb < LinesArray.length; LineNumb++){

//do here what you want...
bAnswer = confirm( LinesArray[LineNumb] );
if (bAnswer == false){break;}

}

For more about Javascript FileSystemObject and text files read e.g.:
http://www.ezineasp.net/post/Javascript-FSO-OpenTextFile-Method.aspx