Hi Dan,
Thank you for your reply. I’ve seen your anwers in many posts here and were hoping you would find time to read through my post. Thanks for that.
I paste the current state of the script again. I filled in an commandId since I have english AE at work in the german version in my home office.
Your additional line brings me at least one step closer. After running the script, now the comps are all opened and in every comp the two layers are highlighted. But the “convert expression to keyframes” is still not happening.
Without your line, sometimes (most of the times, but not always – i’m working in a test project now, with only one two layer comp, duplicated four times.) the conversion will work only for the active comp in the viewer. So I have seen, that the function in general does its job. The error must be in the orders I give to work through my selection.
I am still not able to see why its not running. Further testing didn’t help either.
Why is the conversion not executed?
var items = app.project.items;
var selectedComps = new Array();
function convertToKeyframes(theProperty){
if (theProperty.canSetExpression && theProperty.expressionEnabled){
theProperty.selected = true;
app.executeCommand(2639);
theProperty.selected = false;
}
}
for (var i = 1; i <= items.length; i++) {
if ((items[i] instanceof CompItem) && items[i].selected) {
selectedComps[i] = items[i];
}
}
for (var i = 1; i <= selectedComps.length; i++) {
var comp = selectedComps[i];
if (!comp) continue;
comp.openInViewer();
var layer = comp.layer(2);
var prop = layer.property("scale");
convertToKeyframes(prop);
layer = comp.layer(1);
prop = layer.property("sourceText");
convertToKeyframes(prop);
}