I have a script that reads a file, massages it, writes an output file. It takes some time so I want a progress count of how many lines have been processed. But my counter only gets updated after the script has finished running. Any help is greatly appreciated.
<html>
<head>
<script type"text/javascript">
function processfile()
{
fso = new ActiveXObject("Scripting.FileSystemObject");
f1 = fspenTextFile("C:\\infile.txt", 1);
f2 = fso.CreateTextFile("c:\\outfile.txt", true);
linecount=0;
while (!f1.AtEndOfStream)
{
line=f1.ReadLine();
linecount++;
document.getElementById('counter').innerHTML=linecount;
f2.WriteLine(line);
}
f2.WriteBlankLines(1);
f1.Close();
f2.Close();
return;
}
</script>
</head>
<body>
<table>
<tr><td align="center"><input type="button" value="Submit" onClick="processfile()">
</td></tr>
<tr><td align="center">Lines Read: <span id="counter">0000000</span></td></tr>
</table>
</body>
</html>
<html>
<head>
<script type"text/javascript">
function processfile()
{
fso = new ActiveXObject("Scripting.FileSystemObject");
f1 = fspenTextFile("C:\\infile.txt", 1);
f2 = fso.CreateTextFile("c:\\outfile.txt", true);
linecount=0;
while (!f1.AtEndOfStream)
{
line=f1.ReadLine();
linecount++;
document.getElementById('counter').innerHTML=linecount;
f2.WriteLine(line);
}
f2.WriteBlankLines(1);
f1.Close();
f2.Close();
return;
}
</script>
</head>
<body>
<table>
<tr><td align="center"><input type="button" value="Submit" onClick="processfile()">
</td></tr>
<tr><td align="center">Lines Read: <span id="counter">0000000</span></td></tr>
</table>
</body>
</html>