7 Replies Latest reply on Dec 23, 2017 11:11 AM by SuperMerlin

    Bridge sort by number of keywords...

    frankr53607480

      Hi there,

       

      so I use the Windows Version of Bridge 5.1...NO CC.

      I found a keyword Counter for each Foto/Illustration...but did not finding a keyword Counter for the hole Folder.

       

      When I am in a Folder I could go to VIEW --> SORT IT --> NAME...TYPE etc. but there is NO Chance to sort it by the number of keywords.

      To hover on each file is really a pain, when there are thousands of files in the Folder...

       

      I want to sort by the number of keywords: for example 70 at the top...69...68...!

       

      Is there any script given, or some other Chance to make this happen ?

       

      Thanks for your time.

       

      All the best,

      Frank

        • 1. Re: Bridge sort by number of keywords...
          SuperMerlin Level 5

          Okay I dont't think you will get what you want, here is a very poor compromise.

          To Install see Prepression: Downloading and Installing Adobe Scripts

          This script creates  a tabbed palette, in the bottom left hand corner of Bridge

          Once you have selected your folder click the process button.

          It will create a list of all files with the number of keywords associated with it.

          If you click on a file name in that window it will reveal that file and select it.

          Hope it is of some use?

          Also it will tell you how many keywords in total there are.

          N.B. You need to click process if you change folder to update the details.

          The font is very small but due to Adobe not fixing thier bugs there is nothing I can do about it, last good version was Bridge CS5 and it has got worse with every new version.

           

          #target bridge;
          onDocLoadEvent = function( event ){
          if(event.object instanceof Document){
              if( event.type == "loaded" ){
                    $.sleep(1000);
                          keyCount();
                      }
                  }
                  return { handled: false };
          }
          app.eventHandlers.push( { handler: onDocLoadEvent} );
          function keyCount(){
          try{  
          sPalette = new TabbedPalette( app.document, "KeyTest", "test", "script","left","bottom");
          pnl1 = sPalette.content.add('panel');
          pnl1.alignChildren="left";
          pnl1.addBtn = pnl1.add('button', undefined, 'Process');
          pnl1.txtF = pnl1.add('edittext', undefined, "                                               ");
          pnl1.addBtn.preferredSize=[50,25];
          pnl1.txtField = pnl1.add('listbox');
          pnl1.txtField.preferredSize=[200,200];
          //should work but doesn't blame Adobe!
          pnl1.txtField.graphics.font = "dialog:24";
          pnl1.addBtn.onClick = function(){
          pnl1.txtField.text ="";
          var thumbs = app.document.visibleThumbnails;
          var List =[];
          var tCount =0;
          for(var a in thumbs){
          if(!thumbs[a] instanceof File) continue;
          var md = thumbs[a].synchronousMetadata;
          try{
          md.namespace = "http://ns.adobe.com/photoshop/1.0/"; 
          var count = md.Keywords.length;
          tCount += count;
          List.push([[decodeURI(thumbs[a].spec.name)],[count]]);
          }catch(e){}
          }
          List = List.sort(function(a,b){return a[1]-b[1];});
          List.reverse();
          pnl1.txtF.text = "Total Keyword Count = " + tCount.toString();
          pnl1.txtField.removeAll();
          for(var z in List) {pnl1.txtField.add("item",List[z].toString());}
          pnl1.txtField.selection=0;
          pnl1.txtField.onChange = function(){
          app.document.deselectAll();
          app.document.select(new Thumbnail(app.document.presentationPath + "\\" + List[this.selection.index][0]));
          app.document.reveal(new Thumbnail(app.document.presentationPath + "\\" + List[this.selection.index][0]));
              }
          }        
          sPalette.content.layout.layout(true);
          }catch(e){$.writeln(e + "\n" + e.line);}
          };
          
          
          
          • 2. Re: Bridge sort by number of keywords...
            frankr53607480 Level 1

            Hello SuperMerlin,

             

            thanks for your answer, your time and your efforts.

             

            Trying and install the script...but you are right, this is not what I am looking for.

             

            The files are sortet by keyword numbers in the Little window...BUT the file numers are not in secuance.

            For example:

            12583.jpg = 55 keywords

            20585.jpg = 55 keywords

            2407.jpg = 55 keywords

            19387.jpg = 55 keywords

             

            So in the Folder there are thousands of files...and searching by file Name cost a lot of time.

             

            Maybe there is an more practical way !?

             

            Thanks and best regards,

            Frank

            • 3. Re: Bridge sort by number of keywords...
              SuperMerlin Level 5

              Just click on the filename you want and it will select it for you.

              • 4. Re: Bridge sort by number of keywords...
                frankr53607480 Level 1

                Hello SuperMerlin,

                 

                oh...that I didnt read at the first time.

                 

                Is there a Chance to select MORE THAN ONE in the selection box ?

                THIS would be perfect...

                 

                In the script I had the field high increased and the font size reduced.

                 

                But didnt get mark more than one file...

                 

                THANKS for your help and your time.

                 

                Best regards,

                Frank

                • 5. Re: Bridge sort by number of keywords...
                  SuperMerlin Level 5

                  This version will let you select as many files as you wish, after you have made your selections press the "Select the selected" button.

                  Hope this works

                  #target bridge;
                  onDocLoadEvent = function( event ){
                  if(event.object instanceof Document){
                      if( event.type == "loaded" ){
                            $.sleep(1000);
                                  keyCount();
                              }
                          }
                          return { handled: false };
                  }
                  app.eventHandlers.push( { handler: onDocLoadEvent} );
                  function keyCount(){
                  try{  
                  sPalette = new TabbedPalette( app.document, "KeyTest", "test", "script","left","bottom");
                  pnl1 = sPalette.content.add('panel');
                  pnl1.alignChildren="left";
                  pnl1.addBtn = pnl1.add('button', undefined, 'Process');
                  pnl1.txtF = pnl1.add('edittext', undefined, "                                               ");
                  pnl1.addBtn.preferredSize=[150,25];
                  pnl1.selBtn = pnl1.add('button', undefined, 'Select the selected');
                  pnl1.selBtn.preferredSize=[150,25];
                  pnl1.txtField = pnl1.add('listbox', undefined, undefined, { multiselect: true } );
                  pnl1.txtField.preferredSize=[200,200];
                  //should work but doesn't blame Adobe!
                  pnl1.txtField.graphics.font = "dialog:24";
                  pnl1.addBtn.onClick = function(){
                  pnl1.txtField.text ="";
                  var thumbs = app.document.visibleThumbnails;
                  var List =[];
                  var tCount =0;
                  for(var a in thumbs){
                  if(!thumbs[a] instanceof File) continue;
                  var md = thumbs[a].synchronousMetadata;
                  try{
                  md.namespace = "http://ns.adobe.com/photoshop/1.0/"; 
                  var count = md.Keywords.length;
                  tCount += count;
                  List.push([[decodeURI(thumbs[a].spec.name)],[count]]);
                  }catch(e){}
                  }
                  List = List.sort(function(a,b){return a[1]-b[1];});
                  List.reverse();
                  pnl1.txtF.text = "Total Keyword Count = " + tCount.toString();
                  pnl1.txtField.removeAll();
                  for(var z in List) {pnl1.txtField.add("item",List[z].toString());}
                  pnl1.selBtn.onClick=function(){
                  app.document.deselectAll();
                  var sels = pnl1.txtField.selection;
                  for(var r in sels){ app.document.select(new Thumbnail(app.document.presentationPath + "\\" +sels[r].toString().split(",")[0])); }
                  }        }
                  sPalette.content.layout.layout(true);
                  }catch(e){$.writeln(e + "\n" + e.line);}
                  };
                  
                  
                  
                  • 6. Re: Bridge sort by number of keywords...
                    frankr53607480 Level 1

                    SuperMerlin,

                     

                    YOU ARE THE BEST !

                     

                    This works and save me many many hours of wasted time !

                     

                    THANK YOU so much !!

                     

                    Really great...

                     

                    Wish you peaceful Holidays and best regards,

                    Frank

                     

                    AAAAA+++++

                    • 7. Re: Bridge sort by number of keywords...
                      SuperMerlin Level 5

                      Merry Christmas and Happy New Year to you too!