-
Replacing layers with comps Script
Hi,
i need to frequently change 100+ layers in several comps with compositions. (Alt + Hold and move is to slow)The Layers and the comps are the same name but I can’t figure out how to wright that script. I create simple project with 6 items to replace for example. So please help me out.
If you look in screenshot I need in Comp “Portfolio 1080p” to replace Layers “Photo 1”, “Photo 2″… with Comps marked with red. Problem is that “Photo 5” and “Photo 6” are in different comps, and “Photo 1” repeat it self.
Thank you in advance!
var projectItems = app.project.items;
var i = 1;
var j = 1;
var x = 1;
var str= '';
for(i=1; i < projectItems.length; i++){
var item = projectItems[i].name;
if(item.name == "Portfolio 1080p"){
alert(1);
for(j=1; j <= 7; j++){
var newItem = null;
if(item.layer(j).name != "5 Folio"){
if(item.layer(j).name != "6 Folio"){
alert(2);
for(x =1; x < projectItems.length; x++){
if(item.layer(j).name == projectItems[x].name){
alert(3);
newItem = projectItems[x];
item.replaceSource(newItem, false);
}
}
}
}
}
}
}Igor Stikic

