Hello, I have a question about the code below;
-------------------------------------------------
var targetApp = BridgeTalk.getSpecifier ("photoshop");
if (targetApp) {
BridgeTalk.bringToFront (targetApp);
var bt = new BridgeTalk;
bt.target = targetApp;
bt.body = "new Document ('/TestScript.jsx');
app.document.target.children.length;";
bt.onError = function(errorMsgObject) {
alert (errorMsgObject.body);
}
bt.send();
}
------------------------------------------------
The file TestScript.jsx contains
----------------------------------
#target "photoshop"
alert ("Hello From Photoshop");
-----------------------------------
When I run the script, PS is brought to the front as expected, but then I get an error message that "Document does not have a constructor". This code is from an example in the "Javascript Tools Guide".
Of course once I replace the bt.body line with the actual inline script (i.e.)
bt.body = "alert('Hello From Photoshop'); app.document.target.children.length;";
It works. The problem is that the script I want photoshop to execute is actually large and complex and is best left in a file of its own rather than made into inline code. Anyway I can call photoshop to execute a script that resides in another file? BTW, I tried the photoshop.executeScript () command, it seems to also be looking for inline code.
Thanks,
Raphael