• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

Bridge script to automate "open files as layers in photoshop"?

Explorer ,
Oct 11, 2013 Oct 11, 2013

Copy link to clipboard

Copied

Hello, i badly need a solution for this problem:

Working with HDR Photography I usually end up with many exposure brackets of 7 raw-shots. After adjusting them in Lightroom 5.2, i want to open each exposure bracket as layers in Photoshop CS6 and save it as PSD.

In Lightroom (or Bridge) there is the command "open as layers in photoshop." The big Problem is: Doing this bracket for bracket it takes years to process. And then i have to save every single File within photoshop, wich takes another eternity.

Is there a script or plugin to automate this task? Something that processes Image stacks perhaps? Or something similar from Bridge?

I ́ve found a bridge Script here:

http://forums.adobe.com/message/42463...

It supposed to do exactly what im looking for... But it don ́t work in Bridge CS6 😞

-kai

TOPICS
Scripting

Views

4.5K

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , Oct 13, 2013 Oct 13, 2013

Ah I see what the problem is, it is only written for use from ExtendScript Toolkit, the follow code should work, and you should then be able to run the script from the Tools menu.

#target bridge

if( BridgeTalk.appName == "bridge" ) { 

var batchStack = new MenuElement( "command","Batch Stack", "at the end of Tools" , "batchStack" );

}

batchStack .onSelect = function () {

var stacks = app.document.stacks;

var stackCount = stacks.length;

for(var s = 0;s<stackCount;s++){

      var stackFiles = getStackFile

...

Likes

Translate

Translate
Enthusiast ,
Oct 11, 2013 Oct 11, 2013

Copy link to clipboard

Copied

It looks as if you didn't use a plain text editor to copy the script, as the error message does not reflect what the first line of the code is.

Try doing it again this time using ExtendScript Toolkit that is installed with Photoshop.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 13, 2013 Oct 13, 2013

Copy link to clipboard

Copied

Philip, thanks for your answer. I am a complete newbie, so I write exactly what I did:

1.) I´m on windows 7 64-bit with adobe Master Collection CS6.

2.) I have loaded the following script using copy + past into the ExtendScript Toolkit (CS6):


var stacks = app.document.stacks;
var stackCount = stacks.length;
for(var s = 0;s<stackCount;s++){
      var stackFiles = getStackFiles( stacks
);
      if(stackFiles.length> 1){
           var bt = new BridgeTalk;
           bt.target = "photoshop";
           var myScript = ("var ftn = " + psRemote.toSource() + "; ftn("+stackFiles.toSource()+");");
           bt.body = myScript;
           bt.send(5);
      }
}
function getStackFiles( stack ){
      var files = new Array();
      for( var f = 0; f<stack.thumbnails.length;f++){
           files.push(stack.thumbnails.spec);
      }
      return files;
};
function psRemote(stackFiles){
app.bringToFront();
var thisDoc = open(File(stackFiles[0]));
var Name = decodeURI(app.activeDocument.name).slice(0,-4);
thisDoc.layers[0].name = decodeURI(Name);
for(var a = 1;a<stackFiles.length;a++){
    open(File(stackFiles));
    Name = decodeURI(app.activeDocument.name).slice(0,-4);
    activeDocument.activeLayer.duplicat...







3.)  In the toolkit I start the script (with target application Bridge CS6-64 bit): Everything works as expected.

4.) Then I save the script as a "stack-batch.jsx" in the folder "C: \ Users \ kai \ AppData \ Roaming \ Adobe \ Bridge CS6 \ Startup Scripts \ Stack Batch.jsx"

5.) At the start of Bridge I get the Following Following error message:

"Error in C: \ Users \ ... \ AppData \ Roaming \ Adobe \ Bridge CS6 \ Startup
Scripts \ stack Batch.jsx
Line 1: var = app.document.stacks stacks;
undefined is not an object "


6.) Bridge and then starts the script is not enabled.

Thanks for a hint what I'm doing wrong ... Or what might not be right in the script!

-kai

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Oct 13, 2013 Oct 13, 2013

Copy link to clipboard

Copied

Ah I see what the problem is, it is only written for use from ExtendScript Toolkit, the follow code should work, and you should then be able to run the script from the Tools menu.

#target bridge

if( BridgeTalk.appName == "bridge" ) { 

var batchStack = new MenuElement( "command","Batch Stack", "at the end of Tools" , "batchStack" );

}

batchStack .onSelect = function () {

var stacks = app.document.stacks;

var stackCount = stacks.length;

for(var s = 0;s<stackCount;s++){

      var stackFiles = getStackFiles( stacks );

      if(stackFiles.length> 1){

           var bt = new BridgeTalk;

           bt.target = "photoshop";

           var myScript = ("var ftn = " + psRemote.toSource() + "; ftn("+stackFiles.toSource()+");");

           bt.body = myScript;

           bt.send(5);

      }

}

function getStackFiles( stack ){

      var files = new Array();

      for( var f = 0; f<stack.thumbnails.length;f++){

           files.push(stack.thumbnails.spec);

      }

      return files;

};

function psRemote(stackFiles){

app.bringToFront();

var thisDoc = open(File(stackFiles[0]));

var Name = decodeURI(app.activeDocument.name).slice(0,-4);

thisDoc.layers[0].name = decodeURI(Name);

for(var a = 1;a<stackFiles.length;a++){

    open(File(stackFiles));

    Name = decodeURI(app.activeDocument.name).slice(0,-4);

    activeDocument.activeLayer.duplicate(thisDoc);

    app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);

    thisDoc.layers[0].name = Name;

    }

      var saveFile = new File('~/desktop/'+(new Date().getTime().toString())+'.psd');

      app.activeDocument.saveAs(saveFile);

      app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);

}

};

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 13, 2013 Oct 13, 2013

Copy link to clipboard

Copied

Ahh .. this looks great! Huge thank you!
I must admit that I am not a web developer but a photographer (who likes to fiddle). So sorry for my ignorance 🙂

Philip, unfortunately, I still see an error in the script:

I run the script within Bridge on a folder with 10 image stacks (4 stacks consist of 5 shots, 6 stacks of 7 shots). But unfortunately, the script sometimes processed 6 stacks, other times 7 stacks (as saved psd files) ... And ends without any further error message. So i end up with just a part of the existing Stacks 😞

Do you have any idea what could be the reason?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Oct 14, 2013 Oct 14, 2013

Copy link to clipboard

Copied

Sorry this is beyond me, looks like you would need the help of the original poster.

You should be able to contact him @ http://www.ps-bridge-scripts.talktalk.net/

Best of luck.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 01, 2020 Dec 01, 2020

Copy link to clipboard

Copied

Thanks Philip for setting me off in the right direction. I too have the same problem that Arwen described. However, I over came it by writing the loop in string and sending the all the files across together, looping over each stack. This way, one message is sent to PS rather than multiple. I just tested it on 14 stacks each with 60 large images - no problems :).

Hope that helps ayone expering the same issue.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 05, 2020 Dec 05, 2020

Copy link to clipboard

Copied

LATEST

I have been using the original script on Extendscript 32 bit version on Mojave.  I would like to source the script to run on the current 64 bit version of MacOS.  Can anyone be of assistance please?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines