I read that you can declare varables as global by not including the var infront of it, but when I do:
logFileName = "C:\\scripts\\testlog.txt";
writeLogLine("Hello");
function writeLogLine(msg)
{
var ForReading = 1, ForWriting = 2, ForAppending = 8;
var FTarget, File, MyDate, MyTime;
var d = new Date();
MyDate = (d.getMonth() + 1) + "/";
MyDate += d.getDate() + "/";
MyDate += d.getYear();
MyTime = d.toTimeString();
FTarget = new ActiveXObject('Scripting.FileSystemObject');
File = FTarget.OpenTextFile(logFileName, ForAppending, true);
File.Write(MyDate + " " + MyTime + '\t' + msg + '\r\n');
File.Close();
}
It bombs out. Suggestions or comments on if global variables exist?
logFileName = "C:\\scripts\\testlog.txt";
writeLogLine("Hello");
function writeLogLine(msg)
{
var ForReading = 1, ForWriting = 2, ForAppending = 8;
var FTarget, File, MyDate, MyTime;
var d = new Date();
MyDate = (d.getMonth() + 1) + "/";
MyDate += d.getDate() + "/";
MyDate += d.getYear();
MyTime = d.toTimeString();
FTarget = new ActiveXObject('Scripting.FileSystemObject');
File = FTarget.OpenTextFile(logFileName, ForAppending, true);
File.Write(MyDate + " " + MyTime + '\t' + msg + '\r\n');
File.Close();
}
It bombs out. Suggestions or comments on if global variables exist?