Author Topic: exiftool as a baked-in AppleScript applet  (Read 3381 times)

wywh

  • Full Member
  • ***
  • Posts: 99
exiftool as a baked-in AppleScript applet
« on: November 08, 2020, 10:11:45 AM »
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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 18370
    • ExifTool Home Page
Re: exiftool as a baked-in AppleScript applet
« Reply #1 on: November 09, 2020, 03:54:00 PM »
Hi Matti,

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.

Quote
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?

It think this would be possible.

Quote
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)?

That is a question for an AppleScript forum.

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

Hubert

  • Full Member
  • ***
  • Posts: 73
Re: exiftool as a baked-in AppleScript applet
« Reply #2 on: November 11, 2020, 08:04:17 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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 18370
    • ExifTool Home Page
Re: exiftool as a baked-in AppleScript applet
« Reply #3 on: November 11, 2020, 08:29:34 AM »
Hi Hubert,

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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Hubert

  • Full Member
  • ***
  • Posts: 73
Re: exiftool as a baked-in AppleScript applet
« Reply #4 on: November 11, 2020, 08:57:14 AM »
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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 18370
    • ExifTool Home Page
Re: exiftool as a baked-in AppleScript applet
« Reply #5 on: November 11, 2020, 09:02:24 AM »
Ah, OK.  Worth a try maybe though.

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

Hubert

  • Full Member
  • ***
  • Posts: 73
Re: exiftool as a baked-in AppleScript applet
« Reply #6 on: November 11, 2020, 11:45:01 AM »
Feeling a bit more positive - I've emailed you a Dropbox link.

H

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 18370
    • ExifTool Home Page
Re: exiftool as a baked-in AppleScript applet
« Reply #7 on: November 11, 2020, 12:02:05 PM »
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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Hubert

  • Full Member
  • ***
  • Posts: 73
Re: exiftool as a baked-in AppleScript applet
« Reply #8 on: November 11, 2020, 12:25:23 PM »
 8)

Hubert

  • Full Member
  • ***
  • Posts: 73
Re: exiftool as a baked-in AppleScript applet
« Reply #9 on: November 11, 2020, 12:30:38 PM »
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.
« Last Edit: November 11, 2020, 06:47:42 PM by Hubert »

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 18370
    • ExifTool Home Page
Re: exiftool as a baked-in AppleScript applet
« Reply #10 on: November 11, 2020, 01:38:14 PM »
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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).