setting a property to an expression from within script

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
peteoconnell
Posts: 19
Joined: November 14th, 2004, 2:10 pm

Hi I am making a script that makes an adjustment layer with a levels effect on it and I would like the the rgb gamma property to be an expression deriving its value from the input white property. Although I can get the expression to work as a simple number eg:

Code: Select all

myComp = app.project.activeItem;
mySolid = myComp.layers.addSolid([0,0,0], "colorCorrect", myComp.width, myComp.height,1);
mySolid.startTime = 0
mySolid.adjustmentLayer = true;
myEffect = mySolid.property("Effects").addProperty("Levels (Individual Controls)");
myEffectProperty = myEffect.property("Gamma");
var myEffectPropertyExpression = "5" 
myEffectProperty.expression = myEffectPropertyExpression;
I can't seem to get it to work as a string expression pointing to another property (in this example I get an error):

Code: Select all

myComp = app.project.activeItem;
mySolid = myComp.layers.addSolid([0,0,0], "colorCorrect", myComp.width, myComp.height,1);
mySolid.startTime = 0
mySolid.adjustmentLayer = true;
myEffect = mySolid.property("Effects").addProperty("Levels (Individual Controls)");
myEffectProperty = myEffect.property("Gamma");
var myEffectPropertyExpression = "effect("Levels (Individual Controls)")("Input White")"
myEffectProperty.expression = myEffectPropertyExpression;

Anyone know what's up with that?
Pete O'Connell
Dan Ebberts
Posts: 320
Joined: June 26th, 2004, 10:01 am
Location: Folsom, CA
Contact:

You probably just need to change the outer quotes to single quotes so they don't confilict with the quotes in the expression itself:

var myEffectPropertyExpression = 'effect("Levels (Individual Controls)")("Input White")';

Dan
peteoconnell
Posts: 19
Joined: November 14th, 2004, 2:10 pm

Thanks Dan that did the trick.
Pete
Post Reply