• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
2

Running EXIFTool from Bridge with app.system()

LEGEND ,
Feb 21, 2023 Feb 21, 2023

Copy link to clipboard

Copied

:EDIT: Got it working, the entire executable path is required.

 

 

Since I discovered that Bridge can't perform a bunch of operations on XMP/EXIF data, I have been working on hooking up EXIFTool to Bridge. I have been going round and round and CANNOT get EXIFTool to run using app.system().

 

I do use this function in other scripts, and I'm able to call other executables (I've used it with Adobe DNG Converter, cURL, and have been able to run simple things like dir/ls and redirect the output to a file.

 

If I call the command, it just silently fails. Bridge doesn't have a way for commands to send an error message back so I'm just in the dark. Writing the command to an alert window, copying it, then running THAT in a command window works on both platforms.

 

This is a very simple command that fails (on the Mac, its installed in the command path so just calling "exiftool" works in Terminal.)

 

    var cmd = "C:/Users/converse/Downloads/exiftool.exe -a -ALL -G1 -s C:/Users/converse/Desktop/04068.jpg > C:/Users/converse/Desktop/log.txt";
    app.system(cmd);

 

Adding single or double quote marks to the filename is no help. Copying that and running it on the command line works on both platforms. Replacing the exiftool call with "dir" or "ls -la" will write correctly to the log file. Same result with processing files, can't call a working command with app.system().

 

I'm wondering if anyone has gotten this working and how? It seems like it SHOULD work ok.

TOPICS
How to , Scripting

Views

1.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Feb 28, 2023 Feb 28, 2023

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
...

Votes

Translate

Translate
Community Expert ,
Feb 22, 2023 Feb 22, 2023

Copy link to clipboard

Copied

I've been trying to get this to work too.  I tried simple commands using ffmpeg and got the same result - nothing. I wonder if app.system() has been locked down because of security concerns, or perhaps it's just broken.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 22, 2023 Feb 22, 2023

Copy link to clipboard

Copied

I actually got it working on Windows, and even was able to direct error output to a text file. Of course you get the stupid command window stealing focus over and over since I haven't done the Powershell/Windows Script Host wrapper.

 

Still banging away on the Mac version.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 22, 2023 Feb 22, 2023

Copy link to clipboard

Copied

Nice! I'm curious to see your solution

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 23, 2023 Feb 23, 2023

Copy link to clipboard

Copied

And got it working on the Mac, had to manually specify the path to the exiftool executable even though I didn't need to in Terminal. :sigh:

I'm gonna do at least a minimal wrapper for using exiftool in Bridge. Not sure how much time I have to work on this.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 23, 2023 Feb 23, 2023

Copy link to clipboard

Copied

This is working on Mac. Still needs a bunch of plumbing but I think that's the basic thing.

 

/*

DEVELOPMENTAL CODE

-----------------------------------------------------------------------------

Utility Pack Scripts created by David M. Converse ©2018-23

Developmental code to integrate EXIFTool with Adobe Bridge.

Last modifed 2/24/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

// var exiftmenu = MenuElement.create('command', 'EXIF test', 'after Thumbnail/Open', this.menuID); //add to Contextual menu

// exiftmenu.onSelect = function(){
//     exiftst();
//     }

// exiftst(){
    try{
        var sel = app.document.selections; //Bridge selections
         //need executable location for both platforms
        var loc = "/usr/local/bin/exiftool"; //mac location
        var cmd = loc; //base command
        var flags = " -a -S"; //flags
        //log files
        var logFile = " > /Users/dmc/Desktop/log.txt";
        var imgPath = ""; //initialize image path
        var img = ""; //initialize quote path
        for(var i = 0; i < sel.length; i++){
            imgPath = sel[i].spec.fsName; //image path
            img = " \"" + imgPath +  "\""; //quote path
            //composite command
            cmd = cmd + flags + img + logFile;
            app.system(cmd);
            cmd = loc; //reset
            
        var img = " \"" + imgPath +  "\""; //quote path
            }
        }
    catch(e){
        Window.alert(e + e.line);
        }
    // }

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 25, 2023 Feb 25, 2023

Copy link to clipboard

Copied

This is great! I struggled with this for a long time.

 

For Windows, the only thing that works for me is:

var loc = "/exiftool";

This assumes exiftool is in the user directory. I would like to find a way to specify the exiftool directory so that it could be included in a Startup Scripts package, like your Utility Scripts. That way the user would have to install exiftool separately.

 

I think this will work for Windows and Mac. Maybe var loc isn't needed here?

if (Folder.fs == "Windows"){
            var loc = "/exiftool"; //windows location (assuming exiftool in in the user directory)
            var cmd = loc; //base command
            }
        else{
            var loc = "/usr/local/bin/exiftool"; //mac location
            var cmd = loc; //base command
            }

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 25, 2023 Feb 25, 2023

Copy link to clipboard

Copied

As long as exiftool is in the Windows $PATH, you can call it with 'exiftool' by itself. You could always have the user manually locate it in, say, the Downloads folder or wherever.

I'm working on a palette where exiftool would write to a temp file and Bridge would read that (I wrote Text Preview which does exactly this.) I'm using shell redirect because I get an error when trying to write a file with the built-in file command. I'm a newb to exiftool so this is just a start.

I was NOT able to get it working on Windows via my Powershell/vbs technique. Not being a Windows guy, its not a big priority for me, it just means the Command window pops up everytime.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 25, 2023 Feb 25, 2023

Copy link to clipboard

Copied

I was thinking of writing exiftool to a json file which could be parsed into different layouts including edittext boxes. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 27, 2023 Feb 27, 2023

Copy link to clipboard

Copied

Test versions:

/*
Utility Pack Scripts created by David M. Converse ©2018-23

This script displays an EXIFTool info panel in the Bridge browser.

Last modified 3/27/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(vers[0] < 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 = [50, 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/27/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

        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 Thumbs = app.document.selections; //apply to all selected thumbs
            if(ExternalObject.AdobeXMPScript == undefined)  ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript'); //load library for metadata
            for(var a = 0; a < Thumbs.length; a++){
                try{
                    if(Thumbs[a].hasMetadata){
                        var cmd = loc + " -XMP-exifEX:All= -XMP-aux:All= -EXIFIFD:LensInfo= -EXIFIFD:SerialNumber= -EXIFIFD:LensModel= -XMP-xmpMM:All= -ext jpg -overwrite_original ";
                        cmd = cmd + '\"' + Thumbs[a].spec.fsName + '\"';
                        app.system(cmd);
                        }
                    }
                catch(e){
                    alert(e + ' ' + e.line);
                    }
                }
            }
        }

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 27, 2023 Feb 27, 2023

Copy link to clipboard

Copied

@Lumigraphics EXIFInfo is very useful - nice solution.

Some small tweaks I made:

 

if(vers[0] < 13) is undefined (only a problem if Utility Script Pack is not installed). To run independently, I added:

var vers = BridgeTalk.appVersion;

 

Windows loc needs a forward slash before exiftool:

var loc = "/exiftool";

 

The EXIFTool button text was cutoff.

gregreser_0-1677535771145.png

so I increased the width:

exifGroup.button.maximumSize = [75, 15];

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 27, 2023 Feb 27, 2023

Copy link to clipboard

Copied

Oh thanks! Yeah I pulled the include file but forgot to define the version. It's working for me with just "exiftool" no forward slash. I copied the executable into the \Windows folder which is probably some sort of sin. And yeah I saw the button. Bridge 13 won't launch on my Windows machine at work so testing has been a little hit or miss.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 28, 2023 Feb 28, 2023

Copy link to clipboard

Copied

Where do you have exiftool installed on Windows? I added the slash and it doesn't work, I have to JUST use "exiftool" only.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 28, 2023 Feb 28, 2023

Copy link to clipboard

Copied

Ah, that's it. Through my experiments with exiftool, I had installed it different places and it was in my user folder. Once I put it in Windows $PATH, it worked without the slash.

 

I found that you can put exiftool in either the C: or user folder and it will work with the slash. Do you think that it would be best to put it in the user folder so that admin priviledges aren't required for installation?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 28, 2023 Feb 28, 2023

Copy link to clipboard

Copied

The command prompt will run it from anywhere with just filename if you cd to that directory. The default is C:\Users\<username> so that's why it works in the user folder.

There is a command to add to the $PATH, I'm not sure if that's the way to go? And if it needs admin privileges?

https://www.maketecheasier.com/what-is-the-windows-path/

I posted a question on the exiftool forum about this problem. The Mac version uses a known install location which of course makes it easier.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 28, 2023 Feb 28, 2023

Copy link to clipboard

Copied

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);
                }
            }
        }

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 06, 2023 Mar 06, 2023

Copy link to clipboard

Copied

@Lumigraphics 

 

David, I know that you know this, however, you have created a thing of beauty here! Kudos to you.

 

I personally consider a GUI for ExifTool to be a crutch, however, I do completely understand how daunting and offputting a CLI is for the "average user".

 

Providing a link between Bridge and ExifTool is a huge thing, you have provided a great service to the image editing community with this project.

 

Thank you!

 

 

@gregreser – I'd also like to thank you too for your contributions here!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 06, 2023 Mar 06, 2023

Copy link to clipboard

Copied

Thank you, most of the tools I've written have been for my production use or for me to learn. I know exiftool a lot better than I did a few weeks ago.  I'm glad if people can use them.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 06, 2023 Mar 06, 2023

Copy link to clipboard

Copied

Agreed! Being able to integrate Exiftool into a Bridge script opens up a lot of possibilites. Thanks for solving this puzzle, David.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 06, 2023 Mar 06, 2023

Copy link to clipboard

Copied

quote

Agreed! Being able to integrate Exiftool into a Bridge script opens up a lot of possibilites. Thanks for solving this puzzle, David.


By @gregreser

 

You are very correct in that @gregreser !

 

I learnt ExifTool before scripting, most of my scripting is in Photoshop, I find Bridge scripting much harder.

 

I have always been amazed at the power of ExifTool, and what it can achieve with a single CLI code compared to hundreds of lines of script code in Bridge.

 

With the basic groundwork provided by @Lumigraphics it is now possible to use his scripts as a "framework" and simply swap out the ExifTool commands as required to create a brand new script with new functionality in a very short time with little work and effort when compared to standard Adobe metadata scripting.

 

This is huge!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 06, 2023 Mar 06, 2023

Copy link to clipboard

Copied

I will likely do a merge of the two separate scripts, save settings and presets, and so on.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 06, 2023 Mar 06, 2023

Copy link to clipboard

Copied

@Lumigraphics – Some feedback, first on the Strip EXIF.jsx script as it has less to comment on or discuss...

 

Version Support:

* 2019 Mac – Loads without error, right-click works and the command is successfully executed, all good!

* 2021 Mac – Loads without error, right-click works and the command is successfully executed, all good!

* 2022 Mac – Loads without error, right-click works and the command is successfully executed, all good!

* 2023 Mac – Loads without error, right-click works and the command is successfully executed, all good!

* Windows – Currently untested.

 

Right-Click Menu Name:

Although it is easy enough to edit the script myself, I personally prefer the right-click menu item name to identify that this is using ExifTool, just in case there is confusion with other scripts previously installed that may have been using standard Adobe scripting metadata edits rather than ExifTool. Not a big deal if you don't agree, I just think that it is more transparent putting ExifTool in the script menu name.

 

P.S. Thanks for mentioning in your PM the "advanced" CMD/CTRL Easter Egg feature, I haven't explored the code in detail yet and didn't notice it in there!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 06, 2023 Mar 06, 2023

Copy link to clipboard

Copied

Ok cool! I'm not sure on names, something short and descriptive is best I guess.

I still have a bunch of work to do on both platforms, but these versions are at least usable.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 06, 2023 Mar 06, 2023

Copy link to clipboard

Copied

Usable it is!

 

I'll come back to you soon on my initial tyre kicking of the "EXIFInfo.jsx" script.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 06, 2023 Mar 06, 2023

Copy link to clipboard

Copied

@Lumigraphics – OK, here are my initial findings from playing with the EXIFInfo.jsx script:

 

Version Support Comments:

 

* 2019 Mac – Loads without error, but no results from GUI, so no good! I understand that this is an old version and that you may only be programming for 2023 as the main version as Adobe has made so many changes to how Bridge 2023 supports scripts compared to old versions.

 

* 2021 Mac – Loads without error, the panel has to be manually made visible (Window > EXIF Info Panel), it works from the GUI, so all good!

 

* 2022 Mac – Loads without error, the panel has to be manually made visible (Window > EXIF Info Panel), it works from the GUI, so all good!

 

* 2023 Mac – Loads without error, and the panel is automatically made visible (but it is not visible under Window > EXIF Info Panel as with older versions) – it works from the GUI, so all good!

 

Windows – Untested.

 

Flag Options:

 

The default arguments in your script are:

 

-a -ALL -G -s2
 
I mostly use:
 

-a -G1 -s -u

 

These are basically the same, I'll need to refresh my memory on the pros/cons of Group tags vs Group1 or Group2 tags etc.

 

I also use the -u or -unknown flag in order to extract the most info that I can.

 
Miscellaneous Hack: 

 

I found that it is also possible to hack this into a GUI front end by showing the flags and putting in totally different arguments... but it is a little fussy as it isn't intended for that purpose and one then has to put back in the original flags afterwards, or at least just -All for a quick reset.

 

I think that it is useful to have a version that can just be used as a GUI to select files/folders and offer a blank "command line" to manually enter user commands as required (obviously only for more advanced users).

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines