Skip navigation
Currently Being Moderated

Tricky problem. Opening RAW with Javascript. White balance problem.

Mar 4, 2012 6:58 AM

Tags: #custom #photoshop #cs5 #script #raw #bridge #camera #javascript #presets #scripting #white #balance

Hi all. Hopefully someone can help with this - its a tricky one.

 

I've been using a javascript to send RAW and DNG files to Photoshop CS5 for automatic processing. The script opens the files directly into PS, apparently bypassing Adobe Camera Raw. It always renders the photos with the ACR default settings which can be set in either ACR on Lightroom. The standard Adobe settings are WB (As Shot), Brightness (+50), Contrast (+25).

 

My problem is that it ignores any changes I have made to the RAW files in ACR. So if I want to use a custom white balance, its not possible to use the javascript. The script ignores the 'custom' white balance and resets it to 'As Shot'.

 

I've tried changing the default values in ACR but the options are As Shot, or a set Kelvin preset such as Tungsten, Sunlight etc. Nothing helps.

 

Is it possible for the script to be mindful of the custom adjustments - especially subtle changes to WB - that I have made in ACR?

 

The script is below...

 

var stacks = app.document.stacks;
var stackCount = stacks.length;
for(var s = 0;s<stackCount;s++){
      var stackFiles = getStackFiles( stacks[s] );
      if(stackFiles.length> 1){
           var bt = new BridgeTalk;
           bt.target = "photoshop";
           var myScript = ("var ftn = " + psRemote.toSource() + "; ftn("+stackFiles.toSource()+");");
           bt.body = myScript;
           bt.onResult = function( inBT ) {myReturnValue(inBT.body); }
           bt.send(500);
      }
}
function getStackFiles( stack ){
      var files = new Array();
      for( var f = 0; f<stack.thumbnails.length;f++){
           files.push(stack.thumbnails[f].spec);
      }
      return files;
};
function myReturnValue(str){
      res = str;
}
function psRemote(stackFiles){
      var loadLayersFromScript = true;
      var strPresets = localize ("$$$/ApplicationPresetsFolder/Presets=Presets");
      var strScripts = localize ("$$$/PSBI/Automate/ImageProcessor/Photoshop/Scripts=Scripts");
      var strFile2Stack = "Load Files into Stack.jsx";
      var ipFilePath = app.path + "/" + strPresets + "/" + strScripts + "/" + strFile2Stack;
      var ipFile = new File (ipFilePath);
      $.evalFile( ipFile );
      loadLayers.intoStack(stackFiles);
      app.doAction ('My Action');
      var saveFile = new File('~/desktop/'+(new Date().getTime().toString())+'.psd');
      app.activeDocument.saveAs(saveFile);
      app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
}

 
Replies
  • Currently Being Moderated
    Mar 4, 2012 9:49 AM   in reply to OrchidPhoto

    But isn't this script just passing a list of files from Bridge to anther script in Photoshop? My guess would be that you need to look at the file opening options in the 'Load Files into Stack.jsx'

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 4, 2012 10:48 AM   in reply to OrchidPhoto

    You also need to correct your action, it requires two parameters...

     

    app.doAction("ActionName","ActionSet");

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 5, 2012 12:15 PM   in reply to OrchidPhoto

    You could stack your own files IE:...

     

     

    var stacks = app.document.stacks;
    var stackCount = stacks.length;
    for(var s = 0;s<stackCount;s++){
          var stackFiles = getStackFiles( stacks[s] );
          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[f].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[a]));
        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);
    } 
    
    
     
     
    |
    Mark as:
  • Currently Being Moderated
    Oct 9, 2013 2:56 AM   in reply to Paul Riggott

    Paul,

    this script do perfectly what i need... But unfortunately not in Bridge CS6 :-(

    I use Windows7 64 and CS6. When I run the script from the Extended Script Toolkit, everything works great.

    Then I saved the script in the Bridge folder "startup scripts". At the start of Bridge I get the 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 "

    Bridge and then starts the script is not enabled.

    Thanks for any help
    -kai

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points