Creative Communities of the World Forums

The peer to peer support community for media production professionals.

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

  • Unable to create a system level text file

  • Avinash Ramanath

    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

    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

Viewing 1 - 2 of 2 posts

Log in to reply.

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