Evernote Export to HTML AppleScript

Judging from some of the comments that I’ve been reading on the Evernote forum, HTML export can’t get here soon enough!  And even though I’m pretty sure it’ll be officially released soon, there has to be a way that we can get the job done now, right?

Well everyone — Native HTML Export is now here! I’m leaving this page up in case:

  1. The code is helpful to someone, or
  2. People are interested in me adapting this into a “Bulk Webarchiver” (e.g., taking a bunch of Evernote items and saving them into self-contained “.webarchive” files

If you’re interested in that, leave a comment on this page! Otherwise, Evernote’s built-in exporter will probably do the trick for you….

And now….the original project below!

The Big Picture (With Details)

I’ve designed a script that looks into the current application directory for Evernote, copies the HTML file and constituent elements, puts it in a folder named after the note, and then bundles everything up into a single Web archive file.

(Pretty cool, huh?)

This isn’t designed to replace the forthcoming “Export to HTML” feature; I wrote it in order to facilitate some of the other scripts that I’ve been working on for my clients (keep your eyes peeled for those!). 

However, I realized that it would provide a stop-gap solution until the export HTML feature is activated and so I am releasing it to the community in case someone finds it helpful! When Evernote adds HTML Export into the program, use it!

That said — this script works really well for me! “Web Archiving” (a.k.a., everything into one file) was the feature that I was most excited about and so, following some sort of Murphy’s Law of AppleScript Coding, it also ended up being the thing that took me the longest to get working properly. 

This script differs from my previous releases in that it also bundles a file known as “webarchiver” into the script file itself.  Without it, the script doesn’t work — something to keep in mind if you are trying to cut and paste the source code into the script editor.

What is “webarchiver”?

Webarchiver is a program that allows you to use Safari’s  “Save As Web Archive” command from the command line in Terminal (or, in our case, from a “do shell script” command inside of AppleScript). Paul William from Entropy, The Blog, webarchiver’s creator, was incredibly gracious in assisting me with the implementation of it into the AppleScript.  With his help, everything finally worked!  Moreover, webarchiver itself is a wonderful, useful program and, without it, this project would not have turned out as well as it did. Thanks Paul!


  • This script copies the selected Evernote items and saves them in 2 HTML formats: It consolidates all of the elements into a “Web Archive” so that everything is contained in one file, and it also creates a Folder named after the note containing all of the “non-Evernote” elements (e.g., everything except the recognizer and ENML files). For the purposes of this script, I figured it would be better to let people have the choice of *how* they wanted their data — thus the Folder/Web Archive output;
  • The script lets you select where you’d like to export your files. I had to use shell scripting to clean up some file name weirdness that was causing the script to fail. As a result, you’ll see that typographical characters are sometimes removed from the original file name. Don’t let it freak you out.
  • Automatic Growl detection has also been enabled which will save you a trip to the Script Editor to enable/disable it.
  • finderscreensnapz001

Current Limitations and Open Issues

(Otherwise known as “Places Where You Could Help Out!”)

  1. The file names are sometimes altered in the exported version if they include typographical characters that would halt the file creation process;
  2. The script is looking to the current folder structure for the files to copy.  When Evernote updates the database structure, the script will probably stop working until I update it.  Then again, my guess is that they’ll have a working “Export HTML” feature when that happens…which will probably eliminate the need for this script in the first place!
  3. Errors that will undoubtedly arise when you do something that I didn’t think of (or test for)! 😉

How to Install and Use

Just run the script, highlight the notes you want to export from Evernote, and tell the script where you’d like the files saved!

  1. You can highlight multiple notes;
  2. You can save this script to /Library/Scripts/ and launch it using the system-wide script menu from the Mac OS X menu bar (The script menu can be activated using the AppleScript Utility application). Keyboard shortcuts can also be assigned to AppleScripts in the script menu using the System Preferences “Keyboard & Mouse Settings”.

FastScript link and support

Do yourself a favor and download and install FastScripts from Red Sweater. Triggering the script from the keyboard really makes things almost second-nature: you’ll watch items practically fly into and out of Evernote with a few keystrokes!

Here’s how you set it up:

  • Copy script or an Alias to ~/Library/Scripts/Applications/Evernote
  • Set up your keyboard shortcut in the FastScripts Preference menu

For my FastScripts workflow, I am using ⌘ H (as in HTML).

Source code and download link on the next page!

8 Responses to “Evernote Export to HTML AppleScript”

  1. Marc April 21, 2012 at 7:08 am #

    Hello there,

    Following your suggestion, I leave a comment requesting your help. Do you think your script could be modified so that what I requested in the user forum could be performed?


    I was pointed to this resource, and even though it is very cool, it is not exactly what I was looking for (It is close though)


    • Justin Lancy April 21, 2012 at 8:17 am #


      Evernote recently added the ability to save multiple attachments without the need for an AppleScript!

      Highlight the items you want the attachments for and you should see an option to save those attachments directly:
      Save Attachments

      • Marc April 22, 2012 at 6:09 pm #

        Euuum, I don’t see that option… I’m using the App Store version of Evernote, can this be the reason?

        Even if I ever manage to get that feature working, that won’t solve completely my problem because it needs some manual interaction…

        Let me explain. This is what I’m looking for: I want to find a way to periodically export all my notes and attachments and store every note with its attachments in a different folder named after the name of the note. This is pretty much what the Evernote App does, but it uses some sort of random name convention for privacy reasons I imagine…

        If anything is unclear, just let me know. Not being a native speaker represents quite of a challenge when trying to get to the point.

        • Justin Lancy April 23, 2012 at 1:52 pm #

          Hi Marc,

          First off — my apologies! You’re correct in saying that the “Save Attachments” feature isn’t in the App Store version of Evernote yet. (I usually try to double-check my advice against both versions, but I was answering you from the road and have the Beta version on my MacBook!)

          Now that I’m back in NYC, I’m in front of the App Store version… so let’s dig in!:

          1. I’m not seeing the “random naming” here — Evernote asks me to choose an export folder. Once I do, it exports all the items as HTML files named after the title of the note. If that note has attachments, it also creates a “resources folder” which is also named after the note’s title.
          2. The export process also creates a file called “index.html”, which is a page with links to each item.

          To write a script which archives every single item in Evernote into different folders becomes more complicated: Evernote has to export everything into a main export folder first and then the script would have to sort files into individual folders. You’d also have to decide how to handle notes with the same name (i.e., “Untitled”) and, depending on if you wanted to mirror the structure inside your Evernote collection, whether or not to further sub-divide the folders into notebook folders.

          If enough people ask for it, I may try to write something like this. (Of course, you can also commission it for the community if you don’t feel like waiting!)

          One more thing — I want everyone to feel welcome here and to share and to benefit from our community, and so I am working on making Veritrope.com friendlier to readers who aren’t native English speakers. If you (or anyone else reading this) wouldn’t mind sharing some thoughts on this project, could you please let me know via the Contact Form or by sending me a message on Twitter?

          • Marc May 1, 2012 at 3:10 pm #

            Hi there,

            I’m afraid that not being a native speaker isn’t helping me much for I don’t think I made myself clear.

            Just do this. Browse: /Users/[user]/Library/Application Support/Evernote/data and you will see the randomly named file structure that I’m referring to.

            I just wish I could find a script that I could periodically run in order to generate a organized folder structure with my order and not theirs. I want the folders to use note names. Why? because I’m paranoid about not being able to access my notes unless I don’t use the Evernote client…

            Lets say that even since I migrated to Mac -folder watch is not available for the Mac world to my bitter surprise- I have broken my workflow, which previously relied on scanning files locally and have the Evernote client import them. That allowed me to keep my order in my scanned files.

            Now, since watched folders isn’t an option, I upload the files to Evernote directly (when they don’t contain important information) and therefore I’m pretty dependent on their will.

            I hope this time I managed to describe my problem.


          • Justin Lancy May 1, 2012 at 3:53 pm #

            I think I understand now, Marc — and I appreciate you making the effort to communicate in English. (T’ho agraeixo molt!):

            You are looking at Evernote’s own local directory, which is not really intended for direct access by users. (This is why you are seeing a file structure which is not friendly to us humans!)

            I can think of two suggestions…

            1. Even though the Mac version of Evernote doesn’t have “Watched Folders”, I made my own workflow using Mac’s “Folder Actions” to try and duplicate this function. You can scan your files into your own folder structure and then copy the folder into this Watched Folder to import to Evernote;
            2. You can use Evernote’s export function to periodically archive your items as I described in my earlier response.

            Please let me know if this works for you — and if you’re interested in helping to translate some of these tools and instructions for your fellow Mac users!

          • Marc May 2, 2012 at 3:47 pm #

            Hello again,

            My jaw almost reached the floor when I saw those words in Catalan language!! (M’has deixat bocabadat!!)

            Today something I read some weeks ago dawned on me. I read about this app called Hazel (http://www.noodlesoft.com/hazel.php) which is intended to monitor your hard drive for a certain pattern, and once something matches one of your rules, it automagically performs a custom action.

            I could have it monitor my Evernote folder and then grab only my pdf files and drop them into a particular folder… eeeuuummm, I have to think about this.

            Regarding your script for overcoming Evernote Mac lack of Watched Folders, I actually stumbled upon this article looking up information about Evernote Watched Folders in the Evernote forum 🙂 The script is pretty cool, but I struggle a lot when trying to bend my own workflow to match what your script enables… If I recall it correctly, your script uploads all what it comes across to Evernote (local notebooks can’t be accessed, can they?).

            Regarding translating the tools, why not? I imagine you can access my email address… drop me a line or two! 🙂

            Thanks a lot for your prompt answers