Skip to main content
Inspiring
February 12, 2013
Question

Bridge batch processing script for Photoshop stops after ten mins

  • February 12, 2013
  • 1 reply
  • 1728 views

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?

This topic has been closed for replies.

1 reply

Paul Riggott
Inspiring
February 12, 2013

It might need to check if photoshop is busy/idle before sending more commands?

if (BridgeTalk.getStatus("photoshop") == "IDLE"){

//Send data etc

}

Inspiring
February 15, 2013

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);

      }

};

Inspiring
February 15, 2013

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.