Copy link to clipboard
Copied
I have a javacript to help batch process collections of images in Bridge by sending them (in layers) to Photoshop CS5. It works perfectly, except it stops running after about ten minutes (around 6-10 images) so that I have to keep restarting the script. This behaviour has only started since the script was installed in the Bridge startup folder so that it could be started from the (right click) menu. The script does not seem to time out when run via ExtendToolkit.
Does anyone know why this is happening?
Copy link to clipboard
Copied
It might need to check if photoshop is busy/idle before sending more commands?
if (BridgeTalk.getStatus("photoshop") == "IDLE"){
//Send data etc
}
Copy link to clipboard
Copied
Thanks again Paul. Can I ask you where the best place to insert that would be? The script is below - I'm sure you'll recognise it :6).
I've also been wondering if its possible to alter the script so that the files in bridge are opened in PS as Smart Objects (in layers)? There is a script 'Open as Smart Object in Layers' but I haven't been able integrate it into your fantastic script.
#target bridge
if( BridgeTalk.appName == "bridge" ) {
processDocs = new MenuElement("command", "Process selected docs", "at the end of Thumbnail");
}
processDocs.onSelect = function () {
var sels = app.document.selections;
var selectedFiles = new Array();
for(var a in sels){
selectedFiles.push(sels.spec);
}
if(selectedFiles.length> 1){
var bt = new BridgeTalk;
bt.target = "photoshop";
var myScript = ("var ftn = " + psRemote.toSource() + "; ftn("+selectedFiles.toSource()+");");
bt.body = myScript;
bt.send(5);
}
};
function psRemote(selectedFiles){
app.bringToFront();
for(var f in selectedFiles){
var thisDoc = open(File(selectedFiles
/*run an action if required */
/* app.doAction("atn", "atnSet"); */
/*script listener code goes here...
You will need to remove the //===== lines or the script will fail
*/
/* end script listener code */
var saveFile = new File('~/desktop/'+(new Date().getTime().toString())+'.psd');
app.activeDocument.saveAs(saveFile);
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
}
};
Copy link to clipboard
Copied
PS: I can send you the 'Open Multiple Images as Smart Object Layers' script by email. It was written by Yegor Korzh and while it is available in binary on his website, I dont have permission to post it in the javascript form.
Copy link to clipboard
Copied
I am wondering Paul with this if statement if photoshop is not IDLE say pumping or whatever. Does this mean that it would not complete its task? I was thinking I might need something to wait until it was IDLE and then complete task. So in that case would you use a while statement. Or do you think that would create an endless loop. I would like to hear your opinion. BG
Find more inspiration, events, and resources on the new Adobe Community
Explore Now