Skip to main content
Participant
August 5, 2022
Question

script to create and update a log file

  • August 5, 2022
  • 0 replies
  • 93 views

If the file does not exist, create the file.
If the file exists, add a new line at the end.

function writeLog(text) {
    var logFile = File("C:\\Users\\USUARIO\\Documents\\logFile.log");
    logFile.open("a+", "TEXT", "????");
    var time = new Date();
    logFile.write(time.toString() + " | " + text+"\r");
    logFile.close();
}

writeLog("frist");
writeLog("second");

 

This topic has been closed for replies.