Hi, You can absolutely use scripting to accomplish what you're trying to do. It's not something that's super simple to explain but I can point you to the important pieces of scripting and let you figure out how the functionality needs to work to fit your wants. Firstly, to precompose layers within a comp, you'll use the following code:
var comp = app.project.activeItem;
var indices = [/* array of layer indices to be precomposed...pulled via layer.index /*];
comp.layers.precompose("New Name", indices, true);
Now, handling the expressions is a little trickier because you need to disable them, update them, precompose and then enable them to avoid getting an error. That functionality should be relatively straightforward. When you're ready to update the expressions...you'll do it like this. Below is an example for accessing the Scale expression
var layer = comp.layers(1);
var scale = layer.property("ADBE Transform Group").property("ADBE Scale"); //can also do layer.transform.scale
if(scale.expressionEnabled) {
scale.expressionEnabled = false;
var curExpression = scale.expression;
scale.expression = curExpression.replace("old reference", "new reference");
}
}
You can also look into Regular Expressions (RegExp object in Javascript) for more advanced ways of doing a search and replace. Just make sure your ordering is disable expression, update expression, precompose layers and then in the new comp...iterating over all layers and re-enabling their expressions. Hope that helps! Calvin
... View more