Home
Head's Up: I'm in the middle of upgrading my site. Most things are in place, but there are something missing and/or broken including image alt text. Please bear with me while I'm getting things fixed.

ps - js - Basic write to file.txt

NOTE : These don't seem to not be working consistently in photoshop cc 2022. Need to investigate more, but don't count on it at this poing

js
const logFile = new File('~/Desktop/adobe-script-file.txt')

function log(msg) {
  // TODO: Move this into a try catch
  if (logFile.open('a', 'TEXT', '????')) {
    logFile.writeln(msg)
    logFile.close()
  }
}

log('Hello, world')

#+OLDNOTES :

Make sure to set the [TODO: Code shorthand span ] property.

js
var tFile = new File('~/Desktop/missing-dir/ExtendScript-test.txt');
if (tFile.lineFeed === 'macintosh') {
    tFile.lineFeed = "unix";
}
if(tFile.open('a', 'TEXT', '????')) {
    tFile.writeln("asdf");
    tFile.close();
}
else {
    $.writeln("Could not open file: " + tFile.absoluteURI);
}

This [TODO: Code shorthand span ] stuff used to go to ExtendScript toolkit, but that's been dead for a while now.