Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Use array to add Item to Comp with specific words (Script)

  • Use array to add Item to Comp with specific words (Script)

    Posted by Scott Mcgee on February 4, 2018 at 10:28 pm

    I have a script that duplicates my Comps *5 no problem. Then a separate script I’m trying to join up to this.

    This script below works fine on it’s own, but what I want to do is create an array. [“BL”,”CF”,”LS”,”LV”,”TS”,”TW”] so that it can go through my project and it adds my footage to the corresponding comp.

    Footage Item “BL-ANIMATE”
    Comp1 “BL-BUMPER-IN”
    Comp2 “BL-BUMPER-OUT”

    I’m fine if it’s the activeItem, it’ll still be a timesaver if I can use the Array to use the string of the first two letters to know which footageitem to use, but I can’t seem to get the Array to work. I nearly got it to work, but it would only add the first item in the array and it also added the last item in the project (Which was a comp) three time. Bizarre.


    var footageName =”BL-ANIMATE”;
    var myProject = app.project;
    var myComp = myProject.activeItem;

    var myFootage = null;
    for (var i = 1; i <= myProject.numItems; i++){
    myFootage = myProject.item(i);
    if (myFootage.name == footageName && myFootage instanceof FootageItem){
    break;
    }
    }

    if (myFootage == null){
    alert (“Can’t find ” + footageName);
    }else{
    myComp.layers.add(myFootage);
    }

    Scott Mcgee replied 8 years, 6 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

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