Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Automatic variation compiler

  • Automatic variation compiler

     Roger Tang updated 5 days ago 2 Members · 5 Posts
  • Roger Tang

    September 15, 2021 at 8:57 am

    Hi all. Just wondering if such a script or plug-in exists? So what I have are –

    BackgroundIMG01.JPG (x5 colour variations)

    MidgroundIMG01.JPG (x5 colour variations)

    ForegroundIMG01.JPG (x5 colour variations)

    (all named sequentially)

    Each with its own layer. Is there a function where I can get After Effects to automatically create a new composition with every possible combination from the above assets, via just replacing the layers?

    Each layer would have some form of animation/effects applied, which is why I’d be leaning towards replacing a layer, rather than creating a completely new composition for each combination.

    Apologies if this doesn’t make any sense…

    Any help would be greatly appreciated!

  • Fabrice Leconte

    September 17, 2021 at 11:38 pm

    Hello, the script will duplicate your main composition to preserve effects and animations and replace footages.

    function findComp(name) {

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

    item = proj.item(i);

    if (item != null && == name)

    return i;


    return null;


    proj = app.project;

    // Edit these values

    mainComp = 'Main Composition';

    bBase = 'BackgroundIMG';

    mBase = 'MidgroundIMG';

    fBase = 'ForegroundIMG';

    ext = '.JPG';

    numPerFolder = 5;


    for (f = 1; f <= numPerFolder; f++) {

    for (m = 1; m <= numPerFolder; m++) {

    for (b = 1; b <= numPerFolder; b++) {

    // duplicate the main composition to preserve effects / animations

    var newComp = proj.item(findComp(mainComp)).duplicate(); = newComp.layer(1).name.charAt(0) + f + '_' + newComp.layer(2).name.charAt(0) + m + '_' + newComp.layer(3).name.charAt(0) + b;

    // replace footages

    newComp.layer(1).replaceSource(proj.item(findComp(fBase + ('00' + f.toString()).slice(-2) + ext)), true);

    newComp.layer(2).replaceSource(proj.item(findComp(mBase + ('00' + m.toString()).slice(-2) + ext)), true);

    newComp.layer(3).replaceSource(proj.item(findComp(bBase + ('00' + b.toString()).slice(-2) + ext)), true);

    // newComp.openInViewer();





  • Roger Tang

    September 20, 2021 at 10:21 am

    Holy cow, did you write this? This looks awesome! Ty so much!!

    I’ve started my comp and added the files in, and changed the values in your script. However, the return I’m getting is on line 49, “Unable to call “item” because of parameter 1. null is not an unsigned integer.”

    After that, the script was able to duplicate the main comp with the name “F1_M1_B1” as per the script, but no layers were changed.

    I’ve mucked around with the Lines 49-53, but I don’t have much clue in this area.

    Any ideas?

  • Fabrice Leconte

    September 20, 2021 at 1:38 pm
  • Roger Tang

    September 20, 2021 at 8:40 pm

    Absolutely amazing! Thank you so much. I’ve had another look at the original script and my working files; I was silly. I didn’t even think to check the case-sensitivity on ext! Had mine at “.PNG” rather than “.png”, which resolved the issue immediately. Thank you so much for this!

Viewing 1 - 5 of 5 posts

Log in to reply.

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