Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

script to create and update a log file

Community Beginner ,
Aug 05, 2022 Aug 05, 2022

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");

 

TOPICS
Scripting
61
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation