Run ExifTool in Automator service

Started by deathrobot, February 14, 2015, 03:03:11 PM

Previous topic - Next topic

deathrobot

Hi. I'm trying to create an automator service to display exif data for a file. I've experimented with permutations of:

* * * * *
Service receives selected image file in Finder

Shell (pass input as arguments)
for f in "$@"
do
   data="$(exiftool -m "$f")"
   /usr/local/bin/growlnotify "$data"
done

Show Growl notification
* * * * *

I've obviously got this wrong. Would love to know how to make this work.

Thanks,
Michael

deathrobot

Getting closer here (and now this is really an automator question).

run shell script: exiftool "$@"

shows all the exif data. Now I just need to display that data with something like:

osascript -e  'tell app "System Events" to display dialog "$@"'

This doesn't display the exif data, just a "$@".

deathrobot

Solved it (in case this helps anyone). Really just needed datetimeoriginal so...

In Automator:
run shell script:
exiftool -p '$datetimeoriginal' "$@"
Display in large type (Launchbar)*

*Instead of using Launchbar, you could do:
Set value of variable
Display notification (insert the variable)

Phil Harvey

I'm glad you figured this out because I couldn't have helped here.

- Phil

P.S. I have moved this into the developers board because I think it is more appropriate there.
...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 ($).

deathrobot

Thanks, Phil. Another tweak you can do is to adjust the shell script so that the date is in the format you like, in my case:

exiftool -p '$datetimeoriginal' -d %Y-%m-%d' '%H.%M.%S "$@"

and if you're using Launchbar, it shows the data in a nice window overlay, where you can use command-c to copy it. It's now ready to paste into the file name.

AND, you can assign a keyboard shortcut to the service to make the whole process really fast.

1) select file
2) Run service keyboard shortcut
3) If there is exif data for datetimeoriginal, it shows in a launchbar window
4) Command-c
5) Hit return, and then paste into the file name

justmike

Deathrobot, This seems to be a very useful tool. Could it be modified to run on a schedule, say, every 24 hours, and then write the changes to a text file?