Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Script Settings File

  • Script Settings File

  • Kevin Snyder

    January 21, 2022 at 4:41 pm

    Is it possible for a script to access variables from a .txt file? I want to create a settings file that will allow the user to change the name of the text that is applied to layers when a script is run.

  • Andrei Popa

    January 22, 2022 at 7:42 am

    It is.

    Create your javascript object holding the settings. Then to save it to a file you need to serialize it. You can do that with .toSource(). This creates a string that you can later use with eval(). So save the string created by myVar.toSource() in a txt file and when you need that variable again, read the content of the file and pass it to eval(), like this:

    var mySettings = eval(contentOfFile);

  • Tomas Bumbulevičius

    January 24, 2022 at 6:19 pm

    Alternatively, have a .json settings file – not sure whether toSource is formattable option Andrei, is it? Like adding “tidy” tabulators and at least a bit of visual sense.

Viewing 1 - 3 of 3 posts

Log in to reply.

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