News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

Using exiftool with automator (osx)

Started by lobered, January 05, 2016, 12:42:21 PM

Previous topic - Next topic

lobered

I want to use exiftool with the mac automator to add Author and Copyright-Infos to my Photos via Mac Service.
But i habe a problem, it does not work:

i use

Run shell script:

for f in "$@"
do
  exiftool -overwrite_original -copyright="(c) my name" "$f"
done

Message (in german): Bei der Aktion ,,Shell-Skript ausführen" ist ein Fehler aufgetreten.

Can someone help me.

Phil Harvey

Why does everyone want to loop over the files in a script?

I don't know why your script doesn't work, but you should be able to do it without looping, like this:

exiftool -overwrite_original -copyright="(c) my name" "$@"

Here's another thread with someone using automator scripts.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Hayo Baan

The problem with Automator run scripts is that the environment is different from your normal shell. Paths are slightly different for one. As you don't see the output of your script, it is hard to see what really caused the issue. I suggest you redirect the output to a log file so you can see it. Use >> instead of > to keep appending to the file without overwriting earlier content.

Hope this helps,
Hayo
Hayo Baan – Photography
Web: www.hayobaan.nl

Phil Harvey

Right.  Good point.  ExifTool now installs in /usr/local/bin, which may not be in the default Automator path.

So specify "/usr/local/bin/exiftool" instead of just "exiftool" in the script.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

lobered

Thank you very much for your advice.
With path and no loop it works. Great!

mpwm64

#5
I too would like to use automator with exiftool commands. I tried adjusting the path as instructed in this thread, but I keep getting errors such as "no file specified" or another one, which I can neither remember nor reproduce at the moment.

I'm not sure which bin I should be selecting from the dropdown. Full disclosure: I don't know what bins are, really. I have a vague sense that different bins contain different sets of Unix commands for use in Terminal, but that's about it. These are the dropdown options I see in automator:
/bin/bash
/bin/csh
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh
/usr/bin/perl
/usr/bin/python
/usr/bin/ruby


Does it matter which one I choose? (I seem to get an error regardless of which I choose.)
Is it possible that the path has been altered for macOS Catalina?

UPDATE: Yes, it seems that Catalina has changed things to do with this. Still haven't solved the problem though: https://insights.dice.com/2019/06/12/macos-catalina-zsh-bash-xcode-11/

Phil Harvey

The "No file specified" error is from ExifTool.  So you are running it properly but just not giving it the name of an image file to read.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Hubert

#7
Quote from: mpwm64 on April 17, 2020, 04:02:27 PM
I too would like to use automator with exiftool commands.

I'm not sure which bin I should be selecting from the dropdown. Full disclosure: I don't know what bins are, really.

Does it matter which one I choose? (I seem to get an error regardless of which I choose.)
Is it possible that the path has been altered for macOS Catalina?

UPDATE: Yes, it seems that Catalina has changed things to do with this. Still haven't solved the problem though: https://insights.dice.com/2019/06/12/macos-catalina-zsh-bash-xcode-11/

Automator's Run Shell Script action defaults to /usr/bin/zsh, the default shell for MacOS 10.15, and you shouldn't need to change this. The change from 'bash' to 'zsh' in Catalina isn't relevant.

('bin' is short for 'binaries' - as I understand it, /usr/bin contains 'essential' ones required by the operating system, /usr/local/bin contains useful but not system-critical ones like scripting languages, and of course Exiftool itself.)

EDIT: not quite. /bin/ is for essential executable binaries, /usr/bin/ is for non-system critical, usr/local/bin/ is for binaries (like Exiftool) installed by the user.

One gotcha with Automator's Run Shell Script action is that you will almost certainly need to change the "Pass input" pull-down from the default "to stdin" to "as arguments".

Before getting fancy, try running this Automator workflow, matching all the settings to the screenshot:



It should return the version number for your installation of Exiftool. If that works, you're in business. If it doesn't, you may need to post the contents of your script. Hope this helps...