Question
Opening a Script in PS from Bridge
The following script was (severely) hacked from Bob's OpenClose_PS.jsx. It is called from Bridge and runs the target script in Photoshop. It seems to work even with complex scripts that go from Photoshop back to Bridge to do more things in Bridge.
#target bridge
function getScript ( ) {
var scp = "remoteScript = " + remoteScript + "\n";
scp += "remoteScript();";
return scp;
}
function remoteScript ( ) {
var f = new File ('/c/Program Files/Adobe/Adobe Photoshop CS2/Presets/Scripts/ah-rawprocessor1.js');
if (f.open('r')) {
var sStr = f.read();
}
else throw('failed to open script'+f.fsName);
eval(sStr);
}
function runScript ( ) {
var bt = new BridgeTalk ();
var theScript = getScript();
bt.target = "photoshop";
bt.body = theScript;
bt.send();
}
runScript();
BUT I do not understand what is going on in the first line of the getScript function - or perhaps in the whole of that function. I would like to understand it better and as part of that find a way to specify the target script path within the runscript() call ie runScript(targetScript);
Andrew
#target bridge
function getScript ( ) {
var scp = "remoteScript = " + remoteScript + "\n";
scp += "remoteScript();";
return scp;
}
function remoteScript ( ) {
var f = new File ('/c/Program Files/Adobe/Adobe Photoshop CS2/Presets/Scripts/ah-rawprocessor1.js');
if (f.open('r')) {
var sStr = f.read();
}
else throw('failed to open script'+f.fsName);
eval(sStr);
}
function runScript ( ) {
var bt = new BridgeTalk ();
var theScript = getScript();
bt.target = "photoshop";
bt.body = theScript;
bt.send();
}
runScript();
BUT I do not understand what is going on in the first line of the getScript function - or perhaps in the whole of that function. I would like to understand it better and as part of that find a way to specify the target script path within the runscript() call ie runScript(targetScript);
Andrew
