Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Can’t write to file (after effects scripting)

  • Can’t write to file (after effects scripting)

    Posted by Arno Deceuninck on June 18, 2017 at 4:01 pm

    I have this code:
    var exportDurationFile = new File;
    exportDurationFile = exportDurationFile.saveDlg ("Choose your duration export location", "Text File:*.txt");

    exportDurationFile.open("w");
    $.writeln("opened for writing");

    exportDurationFile.encoding = "UTF-8";
    $.writeln("Encoding set to UTF-8");

    exportDurationFile.write("test");
    $.writeln("test written to it");

    exportDurationFile.close();
    $.writeln("file closed");

    $.writeln("export succesfully");

    But it doesn’t write anything to the file, this is the console output:
    Select output file
    opened for writing
    Encoding set to UTF-8

    Does anyone know what I’m doing wrong?

    Arno Deceuninck replied 9 years, 2 months ago 2 Members · 2 Replies
  • 2 Replies
  • Walter Soyka

    June 19, 2017 at 2:24 pm

    Your code is fine. You have to make sure you’ve enabled “Allow Scripts to Write to Files and Access Network” in Ae’s general preferences.

    Walter Soyka
    Designer & Mad Scientist at Keen Live [link]
    Motion Graphics, Widescreen Events, Presentation Design, and Consulting
    @keenlive   |   RenderBreak [blog]   |   Profile [LinkedIn]

  • Arno Deceuninck

    June 19, 2017 at 6:06 pm

    Thanks!

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