This started out as a “proof-of-concept thought exercise”. A large amount of my Evernote stack consists of PDFs that are scanned or downloaded at home or at work. I wanted a quick way to drop those PDFs into Evernote and have them get filed and tagged appropriately, with minimal intervention on my part.
While the automatic sorting and tagging is relatively easy to do, I wanted to take it a step further and have the PDFs get sorted into the correct Evernote notebook depending on where I was currently working with my laptop: if I’m at work, sort those PDFs into my work stack. If I’m at home, put them in my personal stack. That saves me having to go back into Evernote and manually “drag and tag”.
In March of last year, David Sparks wrote about how he went paperless with Hazel and Evernote, and shared some really awesome Hazel rules that automate the renaming of his downloaded PDFs before passing them off to Evernote and into the right notebook with the correct tags. His examples are the base of what I’ve done here.
In January of this year, the Smile Software blog highlighted an app called Location Helper for AppleScript, which can be used in their snippets to get your lat/long coordinates. Using Location Helper is the glue that brings it all together.
All of this runs off of a watched folder in my Dropbox called PDF2EN and works on any file with a PDF extension that is dropped in there. Dropbox isn’t necessary, I just put all my stuff there.

The Embedded Script

tell application "Location Helper"set listCoords to get location coordinates
copy (item 1 of listCoords as text) to savedResult1
copy (item 2 of listCoords as text) to savedResult2
if (savedResult1 contains xxxx and savedResult2 contains yyyy) then
tell application "Evernote"
create note from file theFile notebook {"work_notebook"} tags {"PDF", "sort", "work"}
end tell
else if (savedResult1 contains xxxx and savedResult2 contains yyyy) then
tell application "Evernote"
create note from file theFile notebook {"jimchristian"} tags {"PDF", "sort", "personal"}
end tell
end if
end tell

Where xxxx and yyyy are the first four digits of your latitude and longitude, respectively.
After the script has run, it moves the PDF to the Trash.
In the screenshot below, you can see that I’ve commented out a couple of lines, which were used for testing. Rather than continually drop PDFs in the watch folder and see if they were moved to the correct notebook, in testing, the script will return “work” or “home” if successful.

Taking It Further

There’s probably a greater amount that could be done using Hazel and Location Helper, but as I mentioned, this was intended as a thought exercise.
While working on this, I wondered if it would be possible to tag Finder items depending on the location where they were created so that they could be filed away into specific folders – but exploring that will have to wait until another day.


  • I’m not a programmer. The scripting could likely be simplified.
  • I’m not an expert on how latitude and longitude coordinates function either. I do know that this works for me.
  • I couldn’t get this to work when linking to a script elsewhere on my hard drive – it would only function when embedded into the Hazel rule.
  • I’m only using the first four digits that are returned with Location Helper, rather than the full set of coordinates. So, “fuzzy” GPS.
  • I got inconsistent location results when using OpenDNS and no results on a Thunderbolt Ethernet connection. YMMV.