And new versions- fixed a couple of bugs that Greg pointed out, no longer looping exiftool when processing multiple files, other minor improvements.
/*
Utility Pack Scripts created by David M. Converse ©2018-23
This script displays an EXIFTool info panel in the Bridge browser.
Last modified 3/28/23
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#target bridge
if(BridgeTalk.appName == 'bridge'){
try{
var EXIFInfo = new Object; //id object for this script
EXIFInfo.built = false;
var menuexifInfo = MenuElement.create('command', 'EXIFtool Info', 'at the end of Tools'); //create new menu command
}
catch(e){
alert(e + ' ' + e.line);
}
}
app.eventHandlers.push({handler: exifOpenDocument}); //runs on change in selections
menuexifInfo.onSelect = function(){
exifInfo();
}
function exifInfo(){
try{
this.paletteRefs = new Array();
var exifWrapper = this;
addexifInfoPalette(app.documents[0]);
function addexifInfoPalette(doc){ //create tabbed palette
if(Folder.fs == "Windows"){
var loc = "exiftool"; //exiftool.exe MUST be in Windows $PATH
}
else{
var loc = "/usr/local/bin/exiftool"; //Mac location
if(!File(loc).exists){ //exiftool MUST be installed in default location
Window.alert("EXIFTool must be installed to use this script. Please visit exiftool.org/install.html for more info.");
return;
}
}
if(EXIFInfo.built == false){ //first run
if(BridgeTalk.appVersion < 13){
var exifScriptPalette = new TabbedPalette(doc, 'EXIF Info', 'exifPre', 'script', 'center', 'top'); //place in center temporarily
exifScriptPalette.setLocation('right', 'top'); //move to final position, works around Bridge bug
}
else{
var exifScriptPalette = new TabbedPalette(doc, 'EXIF Info', 'exifPre', 'script');
}
var flags = " -a -ALL -G -s2 "; //flags
exifWrapper.paletteRefs.push(exifScriptPalette);
exifScriptPalette.content.orientation = 'column';
exifGroup = exifScriptPalette.content.add('group', undefined, '');
exifGroup.alignment = ['fill', 'top'];
exifGroup.alignChildren = ['fill', 'fill'];
exifGroup.orientation = 'row';
exifGroup.margins = [15, 15, 0, 0];
exifGroup.button = exifGroup.add('button', undefined, 'EXIFTool');
exifGroup.button.maximumSize = [75, 15];
exifGroup.checkbox = exifGroup.add('checkbox', undefined, 'Edit flags');
exifGroup.checkbox.value = false;
exifGroup.flagstxt = exifGroup.add('edittext {justify:"left"}');
exifGroup.flagstxt.text = flags;
exifGroup.flagstxt.visible = false;
exifGroup.flagstxt.minimumSize = [120, 15];
exifGroup2 = exifScriptPalette.content.add('group', undefined, '');
exifGroup2.alignment = ['fill', 'fill'];
exifGroup2.alignChildren = ['fill', 'fill'];
exifGroup2.orientation = 'column';
exifGroup2.txtField = exifGroup2.add('edittext', undefined, '', {multiline:true, readonly:true});
exifScriptPalette.content.layout.layout(true);
var exifc = exifScriptPalette.content.bounds
exifGroup2.bounds = [exifc[0] - 2, exifc[1] - 2, exifc[2] - 2, exifc[3] - 4];
var exifb = exifGroup2.bounds;
exifGroup2.txtField.bounds = [exifb[0] - 10, exifb[1] - 10, exifb[2] - 45, exifb[3] - 40];
exifScriptPalette.content.layout.layout(true);
EXIFInfo.built = true;
exifScriptPalette.content.onResize = function(){ //dynamic resizing
exifGroup2.bounds = exifb;
exifGroup2.txtField.bounds = [exifb[0] - 10, exifb[1] - 10, exifb[2] - 45, exifb[3] - 35];
this.layout.resize(true);
exifScriptPalette.content.layout.layout(true);
}
exifGroup.checkbox.onClick = function(){
if(exifGroup.checkbox.value == true){
exifGroup.flagstxt.visible = true;
}
else{
exifGroup.flagstxt.visible = false;
}
}
exifGroup.button.onClick = function(){
try{
var sel = app.document.selections; //Bridge selections
if(sel.length == 0){
return;
}
var cmd = loc; //base command
flags = exifGroup.flagstxt.text;
var tempFile = new File(Folder.temp + '/exiftemp.txt');
var imgPath = ""; //initialize image path
var img = ""; //initialize quote path
imgPath = sel[0].spec.fsName; //image path
img = " \"" + imgPath + "\""; //quote path
//composite command
cmd = cmd + flags + img + ' > ' + tempFile.fsName;
app.system(cmd);
tempFile.open ('r')
var exifresult = tempFile.read();
exifGroup2.txtField.text = exifresult;
tempFile.close();
tempFile.remove();
}
catch(e){
Window.alert(e + e.line);
}
}
exifScriptPalette.onClose = function(){
EXIFInfo.built = false;
}
}
}
}
catch(e){
alert(e + ' ' + e.line);
}
}
function exifOpenDocument(event){ //new selection
if(event.object instanceof Document && event.type == 'selectionsChanged' && EXIFInfo.built == true){
try{
exifGroup2.txtField.text = '';
}
catch(e){
alert(e + ' ' + e.line);
}
return{handled:false};
}
}
/*
Utility Pack Scripts created by David M. Converse ©2018-23
This script strips EXIF/XMP camera data using EXIFTool
Last modifed 2/28/2023
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#target bridge
if(BridgeTalk.appName == 'bridge'){
//create menu
var exifStrip = MenuElement.create('command', 'Strip EXIF', 'after Thumbnail/Open', this.menuID); //add to Contextual menu
if(ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript'); //load library for metadata
exifStrip.onSelect = function(){
if(Folder.fs == "Windows"){
var loc = "exiftool"; //exiftool.exe MUST be in Windows $PATH
}
else{
var loc = "/usr/local/bin/exiftool"; //Mac location
if(!File(loc).exists){ //exiftool MUST be installed in default location
Window.alert("EXIFTool must be installed to use this script. Please visit exiftool.org/install.html for more info.");
return;
}
}
exifMain(loc);
}
exifMain = function(loc){
var flags = " -XMP-exifEX:All= -XMP-aux:All= -EXIFIFD:LensInfo= -EXIFIFD:SerialNumber= -EXIFIFD:LensModel= -XMP-xmpMM:All= -EXIF:All= -tagsfromfile @ -EXIF:ImageWidth -EXIF:ImageHeight -EXIF:XResolution -EXIF:YResolution -overwrite_original ";
var Thumbs = app.document.selections; //apply to all selected thumbs
var cmd = loc + flags;
try{
for(var a = 0; a < Thumbs.length; a++){
if(Thumbs[a].hasMetadata){
cmd = cmd + '\"' + Thumbs[a].spec.fsName + '\" ';
}
}
app.system(cmd);
}
catch(e){
alert(e + ' ' + e.line);
}
}
}