Loading an expression with a script

Moderators: Disciple, zlovatt

Post Reply
benfrank
Posts: 2
Joined: November 2nd, 2009, 5:00 pm

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!
User avatar
lloydalvarez
Enhancement master
Posts: 460
Joined: June 17th, 2004, 9:27 am
Location: New York City, NY
Contact:

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
Post Reply