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

script to create and update a log file

Community Beginner ,
Aug 05, 2022 Aug 05, 2022

Copy link to clipboard

Copied

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

Views

50

Translate

Translate

Report

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