FORUMS: list search recent posts

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

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Scott McGee
Use array to add Item to Comp with specific words (Script)
on Feb 4, 2018 at 10:28:54 pm
Last Edited By Scott McGee on Feb 4, 2018 at 10:29:56 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);
}


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]