PDF metadata editor/importer for DevonThink

This macro watches a directory and when files are dropped in it does some stuff, asks the user to do some stuff and stuffs it in DevonThink. It uses PDFtk to read and write basic metadata to the PDF; so you will need to install it if you want to use this macro. I had problems reading with Finder (it didn’t read the metadata for newly created files quickly enough.)

It works something like this:

  1. Check the file has a .pdf extension
  2. Use PDFtk to dump it’s metadata
  3. Parse the file’s infoKey/infoValues into a KM variable
  4. Popup a dialog in which they can be edited (or added.)
  5. Optionally, and by default, start a non-forking MacVim to make more significant edits
  6. Write the metadata update to the file with PDFtk
  7. Re-parse the metadata and check that, at least, the title metadata was set
  8. Rename the file to the set title
  9. Add it to a specified DevonThink database and group
  10. Deletes temporary files and move the trigger file into the trash

I guess it’s pretty complicated and no doubt has room for improvement. Some common error conditions are trapped but I bet I’ve missed some obvious ones. It seems to work for me and I’m tired :grin:

The macro github is here.

Hi - this looks very useful, thanks!

Really silly question right off the bat - the PDFtk download, am I missing something?
Hitting that link takes me to their site, but it only appears to have Window’s versions available?

Edit: Yip - I’m missing something!

See the book that is available on the site, speaks of OSX. The download description says “now also available for Windows”, which implies it’s been added. The installer file that wants to download though, reads as “pdftk_free-2.02-win-setup.exe”, which has me all sorts of confused…

Any suggestions?

I think, if I remember correctly, you want the server version. It’s not a server at all but I think the command line = server in some way :persevere:

Ah - thanks - that would make (more) sense then - will have a look!

I forgot; the version on their website is totally broken. I’ve got some links and tips to getting the macro working on my github.

Frankly, it’s a bit of a mess of a macro. It does way to much using too many tools which could be all over the place. It does work though if all the ducks are lined up :grin: