exiftool as a baked-in AppleScript applet

Started by wywh, November 08, 2020, 10:11:45 AM

Previous topic - Next topic

wywh

In another forum users often ask why their images or movies sort incorrectly. A good way to troubleshoot this is to check the metadata dates with the following exiftool command:

exiftool -a -G1 -s -api QuickTimeUTC=1 -time:all -api RequestAll=2 movie.mov

But for most users that is too difficult because they must download and install exiftool and have some basic Terminal skills.

There are some online tools that use exiftool to display the tags but none of them seem to display just the time info at a glance and they are not practical for large movie files.

So I'd like to make an easy to use applet that has exiftool built-in and runs that command to a desired file and displays or saves the output as a text file that can be copied elsewhere.

There are three AppleScript applets at:

https://exiftool.org/List_Exif_Metadata.zip

But in Mojave for some reason they all have an alert like "List Exif Metadata (edit).app is damaged can can't be opened. You should move it to the Trash."

The applets also point to /usr/bin/ instead /usr/local/bin/.

Anyway, I tried to make a new applet based on the "List Exif Metadata (edit)" which is the best because inserts all info in a TextEdit.app window. ("List Exif Metadata (dialog)" and "List Exif Metadata (list)" are not so good because they either crop the list or don't allow copying).

Is it possible to bake exiftool inside such applet so I could tell another user to download it from my Dropbox (or preferably from the trusted exiftool.org), use it to grab the date info and post the results without having to learn any Terminal skills?

I tried to use Script Editor.app to save that script modified as an "exiftool_time.app" Application, and copied exiftool from /usr/local/bin/ to its /Contents/Resources/.

Question: But how do I then tell the app the path to the baked-in exiftool? A path like /Contents/Resources/ does not work (sh: Contents/Resources/exiftool: No such file or directory)?

on open the_files
   set exiftool_path to "/Contents/Resources/"
   set exiftool_args to "-a -G1 -s -api QuickTimeUTC=1 -time:all -api RequestAll=2"
   repeat with the_file in the_files
      set exiftool_args to exiftool_args & " " & quote & POSIX path of the_file & quote
   end repeat
   set the_md to do shell script exiftool_path & "exiftool " & exiftool_args
   tell application "TextEdit"
      activate
      set NewDoc to make new document
      set text of NewDoc to the_md
   end tell
end open

on run
   set chosen_file to choose file with multiple selections allowed
   open chosen_file
end run


- Matti

Phil Harvey

Hi Matti,

Quote from: wywh on November 08, 2020, 10:11:45 AM
But in Mojave for some reason they all have an alert like "List Exif Metadata (edit).app is damaged can can't be opened. You should move it to the Trash."

I get that error too on Mojave.  I hate it when system updates break things that once worked.

QuoteIs it possible to bake exiftool inside such applet so I could tell another user to download it from my Dropbox (or preferably from the trusted exiftool.org), use it to grab the date info and post the results without having to learn any Terminal skills?

It think this would be possible.

QuoteQuestion: But how do I then tell the app the path to the baked-in exiftool? A path like /Contents/Resources/ does not work (sh: Contents/Resources/exiftool: No such file or directory)?

That is a question for an AppleScript forum.

- 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

Quote from: wywh on November 08, 2020, 10:11:45 AM


There are three AppleScript applets at:

https://exiftool.org/List_Exif_Metadata.zip

But in Mojave for some reason they all have an alert like "List Exif Metadata (edit).app is damaged can can't be opened. You should move it to the Trash."

The applets also point to /usr/bin/ instead /usr/local/bin/.

The embedded scripts can be extracted from the script applications in Finder by right-clicking, choosing 'View package contents' and drilling down to the Scripts folder.

I changed /usr/bin/ to the more recent installation path for exiftool  - /usr/local/bin/ - and they run fine both as scripts and as newly saved script applications.

I suspect the original script applications throw errors on Mojave because of Apple's heavy-duty security policies with regard to unsigned apps.

I've PM'd Matti with regard to his final question.

Phil Harvey

Hi Hubert,

Quote from: Hubert on November 11, 2020, 08:04:17 AM
The embedded scripts can be extracted from the script applications in Finder by right-clicking, choosing 'View package contents' and drilling down to the Scripts folder.

I changed /usr/bin/ to the more recent installation path for exiftool  - /usr/local/bin/ - and they run fine both as scripts and as newly saved script applications.

I suspect the original script applications throw errors on Mojave because of Apple's heavy-duty security policies with regard to unsigned apps.

I tried this but I couldn't get it to work.  Could you upload the fixed apps so I can replace them on the ExifTool web page?

Thanks

- 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

Will do Phil, but..

(a) it may be a few hours (real life chores...);

and (b) I don't think that script applications saved by one person will run on other people's Macs (at least on Mojave, Catalina and later) because of Apple's recent security policies.

I'm not a registered Apple developer so I can't sign the script apps myself.

Worth a try, but the best thing might be to upload the text of the scripts and let others download and save them as apps. Happy to write some explanatory notes if needed.

Cheers,

H

Phil Harvey

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

Feeling a bit more positive - I've emailed you a Dropbox link.

H

Phil Harvey

Hi Hubert,

That worked, thanks!  I've updated the List_Exif_Metadata.zip file linked from the ExifTool home page.

- 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


Hubert

#9
The Read Me still gives the old ExifTool installation path - /usr/bin/. Might be worth updating as the newer path used in my updated scripts - /usr/local/bin/ - is the default installation.

Phil Harvey

Good point.  Also updated the URL in the README to the current ExifTool web site.

- 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 ($).