I've been making a lot of use of my Amazon kindle, but I was mildly annoyed that only annotations and highlights from Amazon purchased books end up on the kindle.amazon.com site.  After doing a bit of reading, I discovered that the highlights and annotations are stored in 2 places on the kindle itself.  Firstly embedded in the .mbp files that can be found in the Documents folder when the kindle is mounted, and secondly in the My Clippings.txt file, found in the same place.

The applications and scripts I found to query the mbp files seemed to only return the last few annotations/highlights, which wasn't what I wanted.  I found a few applications that were windows based, but couldn't find anything for the mac, so, I decided to roll up my sleeves and do battle with applescript to write something that did what I wanted.

What I wanted was :

  • To use the My Clippings.txt file so I got all the highlights/annotations
  • To produce a text file per book listing highlights and annotations ordered by location
  • Optionally add the location to the end of the highlight/annotation

I used a couple of my Wednesday afternoon's at home to write the script, learnt quite a lot about applescript in the process, and polished my swearing as I got more and more frustrated with applescript and myself.  

Originally I intended to spend some time refactoring and making it look prettier, but I've got it doing pretty much what I wanted, and having spoken to a few people, they thought it was probably useful as a starter for anyone else who wanted to do something similar.

So, I've made it available here.  The usual disclaimer applies - use at your own risk.  If you refactor this to be prettier/more efficient I'd love to see the changes.

applescript editor

To use it:

  • Open the file in the applescript editor
  • Take a look at the code if you wish - I've tried to comment the methods etc
  • Run the code
  • A dialog will be displayed asking you to select your My Clippings.txt file - I've been copying this off the kindle and on to my desktop to ensure I can't destroy the original at all
  • A second dialog will be displayed asking you to select an output folder to put the text files in
  • A message box will be displayed asking you if you want to delete all files currently in the folder - the default is no
  • A message box will be displayed asking you if you want the location data appending to the end of a highlight/annotation - the default is yes
  • The script will then work through the My Clippings.txt file producing a text file per annotated/highlighted book (no bookmarks are output)
  • A final message box will be displayed telling you how many files it has output

Hope this script proves useful to someone.