-
[HELP] Script to convert all expressions into keyframes
Hi! I’m trying to create a script that converts all the expressions to keyframes, i have a bunch of layers with expressions in the “Position” property, and i need to convert it to keyframes.
I found this post: https://creativecow.net/forums/thread/bulk-convert-expressions-into-keyframes/ where Dan wrote a code but i’m trying to run it and i get this error:
Syntax error in line:
app.executeCommand(app.findMenuCommandId(“Convert Expression to Keyframes”));
This is the code by Dan:
(Dan if you are reading this pls help me!)
{
function convertToKeyframes(theProperty){
if (theProperty.canSetExpression && theProperty.expressionEnabled){
theProperty.selected = true;
app.executeCommand(app.findMenuCommandId(“Convert Expression to Keyframes”));
theProperty.selected = false;
}
}var myComp = app.project.activeItem;
if (myComp && myComp instanceof CompItem){
var myLayer;
var myProperty;
app.beginUndoGroup(“convert expressions”);
for (var i = 1; i <= myComp.numLayers; i++){ myLayer = myComp.layer(i); try{ myProperty = myLayer.property("position"); convertToKeyframes(myProperty); }catch(err){ } try{ myProperty = myLayer.property("anchorPoint"); convertToKeyframes(myProperty); }catch(err){ } try{ myProperty = myLayer.property("rotation"); convertToKeyframes(myProperty); }catch(err){ } try{ myProperty = myLayer.property("scale"); convertToKeyframes(myProperty); }catch(err){ } try{ myProperty = myLayer.property("opacity"); convertToKeyframes(myProperty); }catch(err){ } } app.endUndoGroup(); } }