Skip to main content
Participant
April 10, 2018
Question

labeling or sorting tiffs with and without paths

  • April 10, 2018
  • 3 replies
  • 1298 views

Hi I'm trying to sort a large batch of tiffs, 90% of with have paths, between those that do or do not have paths. I can't find any scripts or methods to sort them this way in bridge currently. Any scripts or tips would be appreciated. Whatever the method, sorting into folders, labeling in the finder, labeling in bridge, I can make work. Thanks in advance.

This topic has been closed for replies.

3 replies

Stephen Marsh
Community Expert
Community Expert
April 10, 2018

Some other options:

Re: Script to Sort Images with/without Clipping Paths?

// https://forums.adobe.com/message/4470536#4470536

#target bridge

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

clipPaths = MenuElement.create("command", "Sort Clipping Paths", "at the end of Tools","clipping");

}

clipPaths.onSelect = function () {

app.document.deselectAll();

var thumbs = app.document.getSelection("psd, tif, jpg, eps");

var noPath = new Folder(app.document.presentationPath+ '/noPath');

var hasPath = new Folder(app.document.presentationPath+ '/hasPath');

var hasClip = new Folder(app.document.presentationPath+ '/hasClip');

if(!noPath.exists)  noPath.create();

if(!hasClip.exists)  hasClip.create();

if(!hasPath.exists)  hasPath.create();

for(var a in thumbs){

var tempFile = thumbs.spec;

var Path = false;

var Clip = false;

tempFile.encoding='BINARY';

tempFile.open('r');

var str= tempFile.read();

tempFile.close();

var pathTag = '8BIM\x07\xd0';

var clippingPathTag = '8BIM\x0b\xb7';

var workPath = '8BIM\x04\x01';

var tagPos =str.match(pathTag);

if(tagPos){

    Path = true;

    tagPos =str.match(clippingPathTag);

    if(tagPos){

        Clip = true;

        }

}

if(!Path){

    if(str.match(workPath)) Path = true;

    }

str = null;

if(!Path) thumbs.moveTo(noPath);

if(Path && Clip)  thumbs.moveTo(hasClip);

if(Path && !Clip) thumbs.moveTo(hasPath);

}

};

And another one:

// https://raw.githubusercontent.com/Paul-Riggott/PS-Scripts/master/Clipping%20path%20names%20to%20collections.jsx

#target bridge;

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

cpToColls = new MenuElement("command", "Clipping Path to Collections", "at the end of Tools");

}

cpToColls.onSelect = function () {

app.document.deselectAll();

var Thumbs = app.document.getSelection("psd,psb,tif,jpg,eps");

var pathList = new Array();

var pathNames = new Array();

var Name = '';

for (var z in Thumbs){

    Name = getFirstClipPathName(Thumbs.spec);

    if(Name != ''){

        $.writeln("Name = " + Name + " length = " + Name.length);

        pathNames.push(Name);

        pathList.push([[Thumbs.spec],[Name]]);

        }

    }

pathNames = UniqueList(pathNames);

for(var t=0;t< pathNames.length;t++){

tempArray = new Array();

for(var p in pathList){

     if(pathList

[1].toString() == pathNames.toString()) tempArray.push(new Thumbnail(File(pathList

[0])));

     }

var colls =app.getCollections();

Found=false;

for(var k in colls){

     if(colls.name.toString() == pathNames.toString()){

         app.addCollectionMember(colls,tempArray);

         Found=true;

         break;

         }

      }

     if(!Found){

             var newCollection = app.createCollection(pathNames.toString());

             app.addCollectionMember(newCollection,tempArray);

             }

    }

function getFirstClipPathName(file){

if(!file.exists) return;

file.open("r");

file.encoding.BINARY;

var dat = file.read();

file.close();

Text='';

if((result = dat.match(/8BIM\x0B\xB7/)) != null) {

ofs = Number(result.index+12);

Text = dat.substr(ofs+1, dat.charCodeAt(ofs));

    }

return Text;

};

function UniqueList(ArrayName){

var unduped = new Object;

for (var i = 0; i < ArrayName.length; i++) {

unduped[ArrayName] = ArrayName;

};

var uniques = new Array;for (var k in unduped) {

   uniques.push(unduped);}

return uniques;

};

};

And one more:

// https://forums.adobe.com/thread/1018075

#target bridge 

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

clipPaths = MenuElement.create("command", "Sort Clipping Paths", "at the end of Tools","clipping"); 

clipPaths.onSelect = function () {  

app.document.deselectAll(); 

var thumbs = app.document.getSelection("psd, tif, jpg, eps"); 

var noPath = new Folder(app.document.presentationPath+ '/noPath'); 

var hasPath = new Folder(app.document.presentationPath+ '/hasPath'); 

var hasClip = new Folder(app.document.presentationPath+ '/hasClip'); 

if(!noPath.exists)  noPath.create(); 

if(!hasClip.exists)  hasClip.create(); 

if(!hasPath.exists)  hasPath.create(); 

for(var a in thumbs){ 

var tempFile = thumbs.spec; 

var Path = false; 

var Clip = false; 

tempFile.encoding='BINARY'; 

tempFile.open('r'); 

var str= tempFile.read(); 

tempFile.close(); 

var pathTag = '8BIM\x07\xd0'; 

var clippingPathTag = '8BIM\x0b\xb7'; 

var tagPos =str.match(pathTag); 

if(tagPos){ 

    Path = true; 

    tagPos =str.match(clippingPathTag); 

    if(tagPos){ 

        Clip = true; 

        }    

str = null; 

if(!Path) thumbs.moveTo(noPath); 

if(Path && Clip)  thumbs.moveTo(hasClip); 

if(Path && !Clip) thumbs.moveTo(hasPath); 

};

Stephen Marsh
Community Expert
Community Expert
April 10, 2018

And a couple of ExifTool options:

Conditionally Process If an image has a Photoshop work path or a saved path/clipping path entry – then add an Adobe Bridge Label of “Select” or “Review” (works in all subfolders under the top level input path). Perhaps backup first, as the processed files will be overwritten:

exiftool -overwrite_original -if '$workingpath' -label='Select' -execute -overwrite_original -if '$originpathinfo' -label='Review' -common_args -u -r '/Users/currentuser/Desktop/input-folder'

Conditionally Process If an image has a Photoshop work path or a saved path/clipping path entry – moving the processed files to new sub-folders within the source folder (works in all subfolders under the top level input path):

exiftool -if '$workingpath' -directory=%d'Photoshop Work Paths' -execute -if '$originpathinfo' -directory=%d'Photoshop Saved Paths' -common_args -u -r '/Users/currentuser/Desktop/input-folder'

These commands are for the Mac OS, for Win OS simply change the straight single quotes to straight double quotes and use an appropriate path to the source/top level folder.

To only process TIFF files, add  -ext .tiff  to the command. You can also ignore the processing of specific named sub-folders under the top level folder using the  -i  or  -ignore command.

Kukurykus
Legend
April 10, 2018

I tried it in CS6 EXTENDED only, but probably should work also in CC2018. Save it to yout Bridge StartupScripts folder then relaunch Bridge and you use it clicking right mouse button on a folder containing .tif files. Then you choose last command:

#target bridge

NtC = new MenuElement('command', 'Paths', 'at the end of Thumbnail')

NtC.onSelect = function() {

     function rec(sF, dst, i) {

          if (fld = io(sF)) sF = sF.getFiles(); for(; i < sF.length; i++) {

               if (io(fof = sF)) dst.push(fof.name), rec(fof, dst, 0)

               else if((r = /.tif$/i).test(fof)) {

                    (function(){

                         (fle = File(fof)).open('r'), fle.encoding = 'binary'

                         var r = fle.read(); var p = r.indexOf('8BIM\x04\x01')

                         if (!(p + 1)) var p = r.indexOf('8BIM\x07\u00D0\x06')

                         fle.close(); if (p + 1) fof.rename('_' + fof.name)

                    })()

               }

          }

          return dst

     }

    function io(v) {return v instanceof Folder}

    if (len = (sel = (ad = app.document).selections).length) {

          for(h = 0; h < len; h++) if (io(spec = sel.spec)) rec(spec, [], 0)

    }

}

It works for all level folders in chosen one. When it finds .tif with a (work)path it renames it, by adding _ at name beginning.

Participant
April 10, 2018

also running CS6 + cc2018 so flexible there, but pref for running in CS6

SuperMerlin
Inspiring
April 10, 2018