Use AppleScript To Create a Custom Evernote PDF Menu Action

To optimize the workflow I wanted to be able to save a PDF directly from Mail to Evernote, name it with a custom name (so as to be in sync with our agenda) and automatically file it in the “MGG” notebook so that it syncs between John and me.

Evernote makes it pretty easy to add simple “Print to PDF” functionality by dropping an alias of the Evernote application right into the ~/Library/PDF Services folder (and yes, ~ is short for your home folder on your Mac). That, however, wasn't going to cut it with my custom naming and auto-filing requirements. AppleScript to the rescue (with a hat tip to screenshot number nine in Katie Floyd's excellent Evernote Tips article – once I saw that I knew it was possible!).

Thankfully, Evernote has very robust AppleScript support, but it's also very elegant and simple to use. A single line (“create note title theName from file theFile notebook hardcodedNotebook“) is really all it took to get the data into Evernote properly. Setting up that data took a few more lines, but not too many. The full script is in the screenshot below.

This simple AppleScript names and auto-files the PDF in Evernote.

As I mentioned, I want to be able to manually set the name (variable: theName) of the file (starting, by default, with “E-” because most of these start life as emails and that naming convention has been in use here at MGG for almost a decade). I also put the name on the clipboard so I can go paste it into our agenda after it's saved to Evernote. And yes, I could eschew the use of the hardcodedNotebook variable and just put “MGG” in that line, but I like to be consistent and use variables everywhere that I'm using variables, so I set a constant for that. Makes it easy to change just once (and in a conspicuous place) if I ever use this script for other purposes (or change the name of our MGG notebook).

I recommend using Script Editor to save this script (File Format: Application) into your Documents (or other) folder and then placing an alias to it in your ~/Library/PDF Services folder. You certainly can place the resulting Application directly into your PDF Services folder, but it may get deleted if you ever edit the Save to PDF menu (it's really only supposed to be aliases in that folder for this very reason, and that's what OS X expects).

Once the application or alias is in the PDF Services folder you'll see it in the “PDF” dropdown of every print dialog you encounter in OS X. When I'm finished answering a listener's email, just before I click “Send” I print this PDF to Evernote and it's saved – and synced – just as I like.

I've placed a finished copy of the script (as an Application) in our public drop. Double clicking it will simply run it, but opening this in Script Editor will let you edit to your heart's content. Have fun!

Simple and easy. Feel free to copy, modify and redistribute at your pleasure.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

WIN an iPhone 16 Pro Max!