-
Iterate script for all selected layers?
I have this script working for my selected properties on a single layer. However, I’m trying to get it to work on multiple layers simultaneously, but I’m not able to get it to work. I think the problem has to do with line 3, but I don’t know how to tackle it. Thanks.
function myBridgeController(myBridge){
var myComp = app.project.activeItem;
var myLayers = myComp.selectedLayers[0];
var myProps = myLayers.selectedProperties;
var myControl = app.project.activeItem.layer(myBridge);
if (!myControl){
var controller = app.project.activeItem.layers.addNull();
controller.name = myBridge;
controller.enabled = false;
}
for (var i = 0; i < myProps.length; i++){
var myEffect = myComp.layer(myBridge).Effects.addProperty("ADBE Checkbox Control");
myEffect.name = myBridge + " " + myLayers.name + " " + myProps[i].name;
var myExpr = 'thisComp.layer("' + myBridge + '").effect("' + myEffect.name + '")("Checkbox");';
myNewProp = myComp.layer(myBridge).property("Effects").property(myEffect.name).property("Checkbox");
myNewProp.addToMotionGraphicsTemplateAs(myComp, myEffect.name);
myProps[i].selected = true;
myProps[i].expression = myExpr;
}
}