patrickj
01-18-2005, 09:59 PM
I have a function that reads a table and writes a .csv file. Since some of the tables being read are sizeable, a minute or so can pass before the write is complete and the file is opened in Excel. I want to change the cursor so that it equals "wait" why the operation is running. Per the following code, the cursor changes AFTER the write is complete. Why? How can I change this behavior?
function WriteToFile(tableID) {
document.body.style.cursor="wait";
try {
var fso, s;
fso = new ActiveXObject("Scripting.FileSystemObject");
s = fso.OpenTextFile("C:\ice_temp.csv",2,1,-2);
s.writeline("ICE_grpmth Report - Function Code Groups by Month - Hours");
s.writeline("For Program(s): THAAD (Terminal High Altitude Area Defense)");
s.writeline("Report Date: January 18 2005 14:35");
var i;
var j;
var fileline = "";
var mycell;
for (i=0; i < document.getElementById(tableID).rows.length; i++) {
for (j=0; j < document.getElementById(tableID).rows(i).cells.length; j++){
mycell = document.getElementById(tableID).rows(i).cells(j)
fileline = fileline + "\"" + mycell.innerText + "\",";
}
s.writeline(fileline);
fileline = "";
}
s.Close();
var myshell = new ActiveXObject("WScript.shell");
myshell.run("C:\ice_temp.csv");
}
function WriteToFile(tableID) {
document.body.style.cursor="wait";
try {
var fso, s;
fso = new ActiveXObject("Scripting.FileSystemObject");
s = fso.OpenTextFile("C:\ice_temp.csv",2,1,-2);
s.writeline("ICE_grpmth Report - Function Code Groups by Month - Hours");
s.writeline("For Program(s): THAAD (Terminal High Altitude Area Defense)");
s.writeline("Report Date: January 18 2005 14:35");
var i;
var j;
var fileline = "";
var mycell;
for (i=0; i < document.getElementById(tableID).rows.length; i++) {
for (j=0; j < document.getElementById(tableID).rows(i).cells.length; j++){
mycell = document.getElementById(tableID).rows(i).cells(j)
fileline = fileline + "\"" + mycell.innerText + "\",";
}
s.writeline(fileline);
fileline = "";
}
s.Close();
var myshell = new ActiveXObject("WScript.shell");
myshell.run("C:\ice_temp.csv");
}