Monday, October 17, 2011

Exporting RedNotebook notes to Evernote using Applescript

I've recently switched my work environment from Ubuntu to Mac OS. While I was using Ubuntu, I used RedNotebook for taking notes about the various things I was working on, code snippets, to do lists, etc. I am now using Evernote, which has some nice features and better userability (in my opinion). Sadly, there is no easy way to import my notes from RedNotebook.

What I've done to accomplish this is to use Mac's Applescript and I pieced together a hacky, but workable, way to do just this.  It's not entirely pretty, and I'm sure it could be done better, but it does work with one caveat and some instructions (it's unfortunately not an entirely automatic procedure).  So here it is for anyone else who wants an already working way to do the same thing.

First off, the caveat:  The very first note imported into Evernote ends up being an HTML attachment, instead of the text.  And the formatting gets a little bit screwy in the imported files, but in my opinion, that's acceptable since what I want is to have this information for future reference.


  1. Create a new directory, this will be your input directory, and export the notebooks from RedNotebook you want imported as HTML.  This will create one large XML file for all the notes for each notebook you want imported.
  2. Create a new directory, this will be your output directory, and save this file to it.  This file is the top portion of the xml file that will make up each of the individual notes in the evernote notes.
  3. Download the applescript or copy and paste from below to your computer.
  4. Run the script, you will be prompted for the following:
    1. The header file, which is the template file you downloaded to your output directory.
    2. The output directory you created.
    3. The input directory containing the html files form RedNotebook
  5. Once the script is done, it is necessary to manually open the first exported file in your export directory and copy and paste this into the first note imported in Evernote, as mentioned earlier.
What the script does:

  1. Creates a new notebook in Evernote with the same name as the HTML file it is importing.  If you have multiple HTML files, it will create a new notebook for each of these files.
  2. For each HTML file, it will create a new note in the new notebook.  The new note will be named the date the note was created and the creation date of the note will be modified to reflect this, so this metadata is not lost.
Here is the applescript code: