Import Kindle Clippings to Evernote
Attention Geeks: here is a crude, incomplete and not exactly terrific script I wrote that will import your “my clippings” file from your Kindle into Evernote using AppleScript. It’s really a terrible hack, but it gets the job done – at least enough to include your highlights, clipped articles and other notes into Evernote to make the universal search thing happen.
Pros: simple, works, open source
Cons: the kindle seems to strip all of the article formatting, so the imported articles are a big ugly mess.
Wish List: auto-import when device is connected, better formatting (paragraph breaks would be really, really nice)
Here’s the code:
(*
kindle-to-evernote - Import Kindle "My Clippings" into Evernote
This folder action will import "My Clippings.txt" files from the Kindle into Evernote's default notebook, with the tag 'kindle'
source: www.cjthomas.org; please let me know if you make any cool improvements
*)
set myFile to choose file
import_kindle(myFile)
on adding folder items to this_folder after receiving these_items
try
repeat with i from 1 to number of items in these_items
set this_item to item i of these_items
set the item_info to the info for this_item
if (alias of the item_info is false and the file name of the item_info is "My Clippings.txt") then
import_kindle_item(this_item)
end if
end repeat
on error error_message number error_number
if the error_number is not -128 then
tell application "Finder"
activate
display dialog error_message buttons {"Cancel"} default button 1 giving up after 120
end tell
end if
end try
end adding folder items to
-- subroutine to import file
on import_kindle(myKindleFile)
set fp to open for access myKindleFile
repeat
try
set eSource to read fp until "
" as text
set two to read fp until "
" as text
set x to offset of " | " in two
set eType to text 3 through x of two
set eDate to text (x + 12) through end of two
set three to read fp until "
" as text
set eNote to read fp until "
" as text
set five to read fp until "
" as text
set eAdd to offset of "Bookmark" in eType
if (eAdd is equal to 0) then
tell application "Evernote"
set result to create note with text eNote title eSource tags "kindle" created date eDate
set result's source URL to eType
end tell
end if
on error
close access fp
exit repeat
end try
end repeat
end import_kindle
Let me know if you make any improvements, it could sure use some assistance in the auto-detect/import (when the Kindle is connected to the Mac) and formatting departments!
[...] **NEW** Import Amazon Kindle clippings into Evernote [...]