Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Replacing several items at once form bin to comp.

  • Replacing several items at once form bin to comp.

    Posted by Trace Burroughs on February 16, 2012 at 3:17 pm

    Is there a scripts or method or can someone write me a script and how much would it cost, so I can choose several items at once in the bin and select several layers in a project and have those items in the comp replaced with the items in the bin. I know how to do it one at a time.

    The items I need to replace are jpgs in the comp with precomps from the bin. As I mentioned I can do it one by one by toggling option +/, but how can I do several at once?

    Thanks for your help.

    Trace Burroughs
    LME COLLECTIONS
    lme-collections.com

    Trace Burroughs replied 14 years, 3 months ago 2 Members · 7 Replies
  • 7 Replies
  • Dan Ebberts

    February 16, 2012 at 3:54 pm

    This should take the selected bin items (in the order they appear in the bin) and use them to replace the sources of the selected layers (in the order that the layers were selected):


    {
    var myComp = app.project.activeItem;
    var myItems = app.project.selection;
    var myLayers = myComp.selectedLayers;
    if (myLayers.length == myItems.length){
    for (var i = 0; i < myLayers.length; i++){
    myLayers[i].replaceSource(myItems[i],false);
    }
    }else{
    alert("Number of selected layers and bin items does't match.");
    }
    }

    Dan

  • Trace Burroughs

    February 16, 2012 at 4:03 pm

    Dan,

    Thank you. How do I take that text and make a script application that I put in the script folder in the AE folder in Applications?

    Do I just take the text file and add a .jsx extension to it and add it to the script folder when AE isn’t open?

    Thanks

    Trace

    Trace Burroughs
    LME COLLECTIONS
    lme-collections.com

  • Dan Ebberts

    February 16, 2012 at 4:09 pm

    You can just save it somewhere with a .jsx extension, then

    File>Scripts>Run Script File (navigate to where you saved it)

    Dan

  • Trace Burroughs

    February 16, 2012 at 4:18 pm

    Dan,

    Thank you. When I went to open the script I got this error message.

    Unable to execute script at line 4. null is not an object.

    Trace Burroughs
    LME COLLECTIONS
    lme-collections.com

  • Dan Ebberts

    February 16, 2012 at 4:25 pm

    My guess is that you selected the layers first and then the bin items. Try it the other way.

    Dan

  • Trace Burroughs

    February 16, 2012 at 4:29 pm

    Beautiful!!!! Thank you!!

    Trace

    Trace Burroughs
    LME COLLECTIONS
    lme-collections.com

  • Trace Burroughs

    February 16, 2012 at 6:57 pm

    Dan,

    1) I hope I’m not over staying my welcome, but do you have a script for the following. I select several comps within a project and the script saves each comp as a project and collects all the need files, creates a folder for it and that all goes into another folder that will contain all the project folders and content created…..so basically it’s the collect files function that Ae already has but batch processing several comps selected within a project.

    2.) Also is there a script where you select several comps with in a project and universally change the comp settings and all its variables for all those selected comps.

    Thanks Trace

    Trace Burroughs
    LME COLLECTIONS
    lme-collections.com

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