Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Automatic duplicate comp & auto replace image (based on library)

  • Automatic duplicate comp & auto replace image (based on library)

    Posted by Menno Wisselink on September 7, 2016 at 12:59 am

    Hello guys,

    My question; I got a folder of about 50 pictures. I’ve made a comp where I got 1 of the pictures does a little animation.
    Now; I need to get all the other 49 pictures do the exact same thing. Is there any way – that the proces of Duplicating the comps and replace the picture 50 times can be done automatic?

    Greetz,
    Menno

    Miguel De mendoza replied 9 years, 8 months ago 2 Members · 3 Replies
  • 3 Replies
  • Miguel De mendoza

    September 7, 2016 at 10:37 am

    You can do it by scripting, try this:

    function findItem (itemName, type){
    var proj = app.project;
    var curItem;
    for(var i = 1; i <= proj.numItems; i++){
    curItem = proj.item(i);
    if(!( curItem instanceof type) || curItem.name != itemName){
    continue;
    }
    else {
    return curItem;
    }
    }
    return false;
    }

    var images = findItem("Folder with images name", FolderItem).items;
    var masterComp = findItem("Your master comp name", CompItem);

    for(var i = 1; i < images.numItems; i++){
    var newSource = images.item(i);
    var newComp = masterComp.duplicate();
    var layerSource = newComp.layers.byName("Your image layer name");

    newComp.name = newComp.name + "_" + i;
    layerSource.replaceSource(newSource);
    }

  • Menno Wisselink

    September 7, 2016 at 12:22 pm

    Thanks for the answer; How and where do I have to apply this script?

  • Miguel De mendoza

    September 7, 2016 at 1:21 pm

    File/Scripts/Run Script File.
    The file must be a .jsx file.

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