Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Where to write setProperty script

  • Where to write setProperty script

    Posted by Jon Rowe on October 13, 2023 at 2:39 am

    I’m quite new to script in After Effects.
    I’ve been successfully improving the efficiency of a project I’m working on using scripts and expression controls but I’ve hit a snag.
    I’d like to dynamically change the options of a series of dropdown lists as these options will change over time and manually changing them all would be time consuming and prone to error.
    I believe that ‘setPropertyParameters’ is the solution but I don’t know where to write the code.
    The example provided on Adobe’s After Effects Scripting Guide is below, but I don’t know where to put such code to make my dropdown list’s options change. The stopwatch on the Dropdown’s Menu property seems to want an index as the return value.

    var dropdownItems = [
        "First Item",
        "Second Item",
        "(-",
        "Another Item",
        "Last Item"
    ];
    
    var dropdownEffect = layer.property("ADBE Effect Parade").addProperty("ADBE Dropdown Control");
    dropdownEffect.property(1).setPropertyParameters(dropdownItems);
    Jon Rowe replied 10 months, 4 weeks ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    October 13, 2023 at 6:26 am

    This is a script, so you would save it as a .jsx file, and then execute it via the menu File > Scripts > Run Script File > (navigate to the script).

  • Jon Rowe

    October 15, 2023 at 10:17 am

    Thanks very much Dan.

    I’ve only ever worked with VBA before so appreciate your patience.

    Couple of related follow up questions if that’s ok:

    Firstly, could I write the script in a new text document and then save it with the .jsx file extension?

    Secondly, There’s around 30 x dropdown menus who’s menu items are based on the names of the layers in a particular comp. When I make changes to this comp, (eg. add another layer), I need to update the menu items in all the dropdown lists to reflect the changes. So would I need to re-execute the script every time I updated this comp? Is there perhaps an event that is fired (such as ‘onCompChange’) which I could take advantage of to automatically run the script again in the background?

  • Dan Ebberts

    October 15, 2023 at 2:54 pm

    You can probably create your script in any simple text editor that will generate a plain text file. Notepad will work on Windows.

    I’m not 100% sure, but I think it’s unlikely that there’s an AE UI event that you could attach to so that your script would run automatically when you change something in a comp. You’re probably stuck launching the script manually.

  • Jon Rowe

    October 15, 2023 at 9:44 pm

    OK, thanks again Dan.

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