Bridge Scripting Help

Upload Adobe Bridge Scripts, Download Adobe Bridge Scripts, Support for Individual Adobe Bridge Scripts

Moderators: Tom, Kukurykus

shutterflypro

Bridge Scripting Help

Post by shutterflypro »

I use presets in Bridge. What I want to do is make buttons in bridge that wouldd basically apply these presets. Either through modifing the xmp file or some other way. I know how to do the interface but for the life of me I cannot figure out how to actually apply the presets. I would actually like to do it without actually installing my presets, hence the button interface

I am an experienced coder but javascript is really new to me.

Any help will be greatly appreciated!
Patrick

Bridge Scripting Help

Post by Patrick »

Can you give an example of some of the settings you want to set when the button is pressed? I am pretty new to Bridge scripting also, but so far I have had some good progress. I would be happy to try and help.

Patrick
shutterflypro

Bridge Scripting Help

Post by shutterflypro »

I want to mimic what happens when usings ACR presets.

For instance. When I click the button I want to set the saturation slider to -100, for the selected image. Then I want the thumbnail in bridge to update itself.

That is simply what I want to do. I want to hit a button to adjust the various sliders in ACR for the selected image then refresh the thumbnail.
Patrick

Bridge Scripting Help

Post by Patrick »

Here is something to start from. It sets the saturation fine but it doesn't always refresh the thumbnails for me, look at the functions purgeFolderCache / buildFolderCache - I am sure implimenting those will do it.

Code: Select allfunction main() {
   if( BridgeTalk.appName == "bridge" ) // only works with Bridge
      {

         // create menu to access this function
         newMenu3 = new MenuElement( "menu", "Additional Tools", "after Help", "myMenu3" );
         acrCommand = new MenuElement( "command", "Apply Presets", "at the end of myMenu3","myAcr" );
         
         acrCommand.onSelect = function () {
            if ( app.document.selections.length == 0) {
               // if nothing selected, return message
               alert("this only works with one file selected");
            } else if ( app.document.selections.length == 1 ) {
               // if one file selected, set its saturation to -100
               var tn = app.document.selections[0].metadata;
               tn.namespace = "http://ns.adobe.com/camera-raw-settings/1.0/";
               tn.Saturation = -100;
               // refresh screen
               app.refresh();
            } else {
               // if more than one selected, loop through them all
               var i = 0;
               while (i < app.document.selections.length) {
                  // set each thumbnails saturation
                  var tn = app.document.selections.metadata;
                  tn.namespace = "http://ns.adobe.com/camera-raw-settings/1.0/";
                  tn.Saturation = -100;
                  i++;
               };
               // refresh screen
               app.refresh();
               
            };   // end if
         };   // end onSelected
      
   };   // end if
};   // end function

// run script
main();

Hope this helps,

Patrick