A Script use exiftool to change PDF file Metadata In DEVONthink

I know. But I was referring to this:

set metadataField to text returned of (display dialog "Please Input Metadata Fields(Example:Author, Title, Subject):" default answer "")

Since there’s only a limited number of metadata fields in a PDF, it would be more appropriate imo to provide a list of those fields, instead of relying on the user to type in the correct one.
Something like

set metadataField to chose from list with title "Please select metadata Field" default items {"Autor", "Title", "Subject", "Producer"…}  multiple selections allowed false empty selection allowed false

Not tested, though. But expecting users to not make errors when typing something in is very optimistic.

And here’s a different implementation in JavaScript that doesn’t rely on exiftool. The first post in this thread does more or less the same thing in AppleScript, also without exiftool.

I like exiftool, but imo it’s a bit convoluted to install an external tool if the same goal can be achieved with a different approach to coding.

2 Likes