Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
also running CS6 + cc2018 so flexible there, but pref for running in CS6
Copy link to clipboard
Copied
Have a look at this thread...
Bridge show/notify if a PS work path is present in a .tif file.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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:
#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);
}
};
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
I love some of those guys looking for answers. Then we make effort to solve their problems, often learning new uneeded stuff for us to see they don't care even to check anyone answered anything. Not to mention marking some reply as correct one. What's their point of coming here, if even questions answered in few hours are not too late answered they appreciated it. It's the same with topic where jojoa16568050 got all he wanted but wasn't interested to let others some answer is correct. Wait, saying whatever what they think of replies they got How do I finish this script to open the images in photoshop?
Copy link to clipboard
Copied
Kukurykus wrote:
I love some of those guys looking for answers. Then we make effort to solve their problems, often learning new uneeded stuff for us to see they don't care even to check anyone answered anything.
I hear what you are saying Kukurykus and the bit in red above is a good part of the reason that I interact in the forums.
I obviously like helping others. Even though software support is part of my day job, I don’t mind it as a hobby with Adobe software. But it is not just about that. As I am no longer in day to day production, staying active with these issues helps to “keep me sharp”. I could not make up many requests, end users always come up with much more interesting puzzles than I can create for fun. I too learn something new, which is the only “reward” that is guaranteed – anything else is a bonus!
Copy link to clipboard
Copied
Apologies for the delay in reply, and trust me the effort put in is tremendously appreciated. Just attribute it to me being distracted with work and forgetful. Thank you so much.
Copy link to clipboard
Copied
So which answer you consider as correct? as I see you marked your original post / question as acknowledged for sloved?
Normally that's an option when original poster find eventually a solution himself without others help but here it's not like it.
Copy link to clipboard
Copied
Hey @Stephen_A_Marsh , thank you for all these codes.
I've tried your scripts but unfortunately the "moveTo" command at the end of the code doesn't work.
Is there a way to fix this? I'm working on windows 11 with Adobe Bridge 2023.
Copy link to clipboard
Copied
Try an earlier version of Bridge, the scripts are old and v2023 has changed many things. I don't have any idea what needs to be updated for the latest version. An alternative solution is ExifTool.