Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Unable to create a system level text file

  • Unable to create a system level text file

    Posted by Avinash Ramanath on August 3, 2020 at 8:42 pm

    Hi,
    I want to create a text file via after effects on a mac. I am using the code below but I don’t know what is going wrong as I am unable to create the folder. I have enabled Write and network access inside after effects. Please help.

    var scriptFolderPath = File($.fileName).path; //alert(scriptFolderPath)
    var s = File(scriptFolderPath + "/testfile.txt");

    Tomas Bumbulevičius replied 4 years, 4 months ago 2 Members · 1 Reply
  • 1 Reply
  • Tomas Bumbulevičius

    August 4, 2020 at 11:16 am

    Hey Avinash, check the code below, stripped it down from my scripts, but should be fine / close to it.

    var logFileName = "build-log"; //Log file name
    var scriptFolder = new File($.fileName).path; //Script path folder
    var logFile = initiateLogFile(scriptFolder, logFileName);

    logFile.open("a"); //Open file for appending
    logFile.write("_____"); //Add your logging message
    logFile.close(); //Always don't forget to close after writing the file

    function initiateLogFile(rootLocation, rootTitle) {
    var logFile = File(rootLocation.toString() + "/" + rootTitle + ".txt");
    logFile.encoding = "UTF-8";
    if (!logFile.exists) {
    logFile.open("w");
    logFile.close();
    }
    return logFile;
    }

    Find out more:
    Motion Graphics Design & After Effects Tutorials
    On YT
    On VH

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy