Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Best Practice Advice: Storing Data for Later Use with Scripts

  • Best Practice Advice: Storing Data for Later Use with Scripts

    Posted by Nick Haffie-emslie on February 29, 2012 at 10:26 pm

    I’m writing a script that will usually be run 3-4 times on a given project, and needs to remember certain variables between executions (for example, a path to a text file that the user specifies on first run).

    Where do you guys like to store this information? I can think of a number of options, but not sure which is best. Is there some kind of app.project.notes object or something like that where you can store arbitrary data/text? Do you usually write this kind of thing out to a temporary text file? (user would have to enable read/write preference for scripts). If I need to I can even make a text object on a timeline and store things in sourceText, just seems a bit messy.

    All I need right now is plain text, don’t need to store true objects.

    Thanks!

    Dan Fredley replied 13 years, 12 months ago 2 Members · 1 Reply
  • 1 Reply
  • Dan Fredley

    May 25, 2012 at 7:34 am

    That pertains to ScriptUI–you should probably read the Adobe Javascript Tools Guide, which explains it in depth.

    Here’s the basic gist:

    if (app.settings.haveSetting("name of setting", "sub name of setting")) // see if there are saved settings from a previous session
    pal.grp.allGroups.pnl1.effectsList.selection = parseInt(app.settings.getSetting("name of setting", "sub name of setting")); // get the saved setting from a previous session and apply it to the path of that setting in the UI
    pal.onClose = function() // Save current UI settings when user closes the palette
    app.settings.saveSetting("name of setting", "sub name of setting", dfcpPal.grp.allGroups.pnl1.effectsList.selection.index); // save the current selection chosen in the DropDown menu upon closing

    Look through redefinery’s scripts for examples:

    https://www.redefinery.com/blog/

    Dan Fredley

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