Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions How to add .ffx to a bunch of layers via scripting?

  • How to add .ffx to a bunch of layers via scripting?

    Posted by Vincenzo Imbimbo on July 2, 2022 at 10:55 am

    Hello guys, i have an AE Project with 50 compositions, in each composition i have 2 shape layers, i need to apply one .ffx to the first layer, and apply another .ffx to the second layer, i need to do this in all 50 compositions, so i think the best option is to do it automatically with a script, can you guys help me?

    Dan Ebberts
    replied 3 years, 10 months ago
    2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    July 2, 2022 at 2:56 pm

    The basic structure could be something like this, but I’d probably add some additional checks to make sure the comp has the layers you’re expecting, that they’re not locked, etc.

    var preset1path = "/c/test/preset1.ffx";

    var preset2path = "/c/test/preset2.ffx";

    var myComp, mySelected;

    for (var i = 1; i <= app.project.numItems; i++){

    myComp = app.project.item(i);

    if (myComp instanceof CompItem){

    mySelected = myComp.selectedLayers;

    for (var j = 0; j < mySelected.length; j++){

    mySelected[j].selected = false;

    }

    myComp.layer(1).selected = true;

    myComp.layer(1).applyPreset(File(preset1path));

    myComp.layer(1).selected = false;

    myComp.layer(2).selected = true;

    myComp.layer(2).applyPreset(File(preset2path));

    }

    }

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