Use Mac OS X Services to Import Files into Evernote

During my recent foray into rediscovering Evernote, I experimented with Evernote's Applescript dictionary and Snow Leopard's updated Services architecture.  My goal was to write a service that made capturing data into Evernote even easier.

I was pretty excited to see how easy it was to write a service and created one that directly import files from the Finder into Evernote.

Here's how to set it up:

1) Launch Automator and select "Service"

The Service template in Automator is new to Snow Leopard and lets you create services from scratch.

Select Automator Template

2) Change "Service receives selected" to "files and folders".  Leave "any application" selected and "replaces selected text" unchecked.

The new Services template can handle a number of data types, but for us files or folders is what we want.

Receive Selected Files or Folders with Automator Service

3) Pick the "Run Applescript" action from the Utilities Library and copy and paste the below applescript into the input box.

This script has error handling built in (that's the try... end try statement), so if you pass something that Evernote can't handle, you will get an alert box telling you what is wrong.  The most common error you may see is if you try to pass the service an unsupported file type.  For example, if you are not an Evernote Premium user and try to pass it a Word doc you will get an error, or if you try to pass it a folder, you will get an error.

The script supports passing multiple files (and if one of the files creates an error condition it will only fail that import, not the entire batch).

on run {input}
     tell application "Evernote"
          repeat with x in input
               try
                    create note from file x
               on error error_message number error_number
                    display alert "Send to Evernote Failed" message "Error:     " & error_message & "
" & "Error Number:  " & error_number as warning
               end try
          end repeat
     end tell
end run

When you are done in Automator, it will look like this:

Import To Evernote Service

That's it!

4) Go to File > Save As and name the service "File | Import to Evernote"

This saves the service so it is available throughout OS X.

5) Set a Keyboard Shorcut via Automator > Services > Services Preferences

This is not required, but if you want to create a keyboard shortcut, just find the "File | Import to Evernote" Service and double-click the keyboard shortcut column.  I assigned shift-command-E, but you can do whatever makes sense for you.

Assign Evernote Service Keyboard Shorcut

6) Try it out!

Now when you are in the Finder, you can click your keyboard shortcut and/or right click and pick the service from the context-menu and import files direct into Evernote.

Evernote File Service in Context Menu

Last Tip:  If you have Growl installed and have it configured for Evernote, you will get a Growl notification once the import is successful.  It puts a nice finishing touch to the service.

Growl Notification of Evernote Import

Newer: An Evernote GTD Tip: Create an Inbox Notebook

Previous: The Device Driver Got Stuck In An Infinite Loop