-
Swapping out multiple lines of an expression with another bunch of lines.
Hi, thanks for your interest in this thread,
I know it can be done just via scripting, and I’ve already managed to replace one-line code in an expression, but I’m facing troubles when I want to replace multiple lines of code, it just doesn’t work, no errors, nothing occurs, but the expression doesn’t change!
The code I’m using to replace a single-line code is in the field below (I don’t know where it’ll show up).
Does anybody have an idea?
Thanks!
var MainExpr = app.project.item(1).layer(2).transform.rotation.expression + ""; //The entire expression in the propertyvar OldExpr = ; //The code I want to replace
var NewExpr = ; //The new code
var FinExpr = MainExpr.replace(OldExpr, NewExpr);
app.project.item(1).layer(2).transform.rotation.expression = FinExpr;
//Those are the lines...
MinTime = key(1).time;
MaxTime = key(2).time;
MinValue = key(1).value;
MaxValue = key(2).value;//That I want to replace with...
MinTime = key(2).time;
MaxTime = key(2).time;
MinValue = key(2).value;
MaxValue = key(2).value;