Adobe After Effects Forum
Can't write to file (after effects scripting)
Can't write to file (after effects scripting)
by Arno Deceuninck on Jun 18, 2017 at 4:01:21 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?


Re: Can't write to file (after effects scripting)
by Walter Soyka on Jun 19, 2017 at 2:24:08 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 [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Re: Can't write to file (after effects scripting)
by Arno Deceuninck on Jun 19, 2017 at 6:06:47 pm

Thanks!





© CreativeCOW.net