Page 1 of 1

setProxy problem --- "Expected: )" ?

Posted: May 28th, 2007, 7:41 am
by Tigerfog
Hi everyone.
I have a problem with my script.
I am merely trying to set a proxy using only ae scripting.
However, everytime I run the script, I have an error.

Here is my script:

Code: Select all

{ //start main function

app.beginUndoGroup("mainprog");

var myCompItem = app.project.item(2);		//a var for the composition

var selItems = app.project.selection;		//a var for the selection
myCompItem.layers.add(selItems[0]);		//the file is brought in the composition, centered
var firstLayer = myCompItem.layer(1);		//a var for the first layer
firstLayer.scale.setValue([200,200,100]);	//scaling the first layer to fit

selItems[0].setProxy(file "/system/Users/hpham/Desktop/proxytest1.psd");

}
The error I get is "Expected: )" on the line with setProxy.
Can anyone explain to me what I did wrong?

Posted: May 28th, 2007, 11:58 am
by vidpat
setProxy() expects a single argument of type File. As written, there are two tokens in the parameter list (a bare word and a string literal). The parser is expecting the list to end with a ')' after the token 'file', which itself doesn't mean anything.

I believe you are looking for this, instead:

Code: Select all

selItems[0].setProxy(new File("/system/Users/hpham/Desktop/proxytest1.psd"));
This creates a new File object to the path that is then passed to setProxy().

Posted: May 31st, 2007, 1:31 pm
by Tigerfog
Aah, I see!

Thank you very much, vidpat!