Page 1 of 1

Loading an expression with a script

Posted: November 4th, 2009, 3:18 pm
by benfrank
I have a script that does a few things, and upon completion i need it to add an expression the the position of a layer in a comp. the expression is saves on its own in a .js file and the script is supposed to load it. this isnt' working at all the way i expect it to. here's what i have now. any help would be GREATLY appreciated.

Code: Select all

var positionExpression = new File("R10_PositionExpression.js");
controlComp.layer("Bounce Variable Controls").position.expression = positionExpression;
Thanks!

Re: Loading an expression with a script

Posted: November 13th, 2009, 8:29 am
by lloydalvarez
Hey Ben,

You need to either read in the file or evaluate it. Since it's a .js you should be able to evaluate it:

$.evalFile(positionExpression);

-Lloyd