kindle clippings to devonthink

Hi,
Is there any script which can extract every note from kindle’s myclippings.txt to separate file?
I tried script from this post
viewtopic.php?f=3&t=11478&start=0
but for some reason it doesn’t works for me. Once I run the script on myclippings file in devonthink it finished with this result… {""} …and nothing seems to happened. Thanks for any suggestions. Ben

Here is my modification:

on replaceText(find, replace, subject)
	set prevTIDs to text item delimiters of AppleScript
	set text item delimiters of AppleScript to find
	set subject to text items of subject
	
	set text item delimiters of AppleScript to replace
	set subject to "" & subject
	set text item delimiters of AppleScript to prevTIDs
	
	return subject
end replaceText

tell application id "com.devon-technologies.thinkpro2"
	set theSelection to the selection
	if theSelection is {} then error "Please select some contents."
	set SplitPointRegEx to "=========="
	set OldDelimiters to AppleScript's text item delimiters
	repeat with CurrentItem in theSelection
		set AppleScript's text item delimiters to SplitPointRegEx
		set theSource to the plain text of CurrentItem
		set RepeatCount to 0 as integer
		set TotalCount to (count each text item of theSource) as integer
		repeat until RepeatCount is equal to TotalCount - 1
			set RepeatCount to RepeatCount + 1
			set CurrentText to (text item RepeatCount of theSource)
			if length of CurrentText is greater than 0 then
				if paragraph 3 of CurrentText does not contain "Bookmark" then
					
					set ShortText to (texts from paragraph 5 to end of CurrentText)
					set TargetGroup to create location ("reference/kindle clippings/" & my replaceText("/", "\\/", paragraph 2 of CurrentText)) in current database
					set theRecord to create record with {name:ShortText & " - " & paragraph 2 of CurrentText, type:rtf, content:ShortText} in TargetGroup
					if (number of duplicates of theRecord) is greater than 0 then
						delete record theRecord in TargetGroup
					end if
				end if
			end if
		end repeat
	end repeat
	set AppleScript's text item delimiters to OldDelimiters
end tell

Some things to note:

  • this script stores the clippings in a group named reference/kindle clippings/Title (Author Name) rather than using tags
  • I have to add a blank line at the beginning of My Clippings.txt otherwise the script will create one junk record and miss one real record (with the rest of them working fine)

Works like a charm. Thank you.

Because I don’t use a Kindle but instead Kindle for Mac, iPad and iPhone, I am still wondering how I get the highlights and notes into DTP. There doesn’t appear to be a MyClippings.txt file to run the script on

I have no idea. Sorry

Kindle for Mac writes MBP files in its folder in /Documents.

Here’s some info about extracting notes from the files, but it looks pretty un-fun:

http://www.angelfire.com/ego2/idleloop/mbp_reader.html

HTH, Charles

I’ve gone ahead and updated the NoteScraper for Evernote script to work with DEVONthink. Instructions are on my blog:

digitalnotions.net/importing-kin … think-pro/

This should pull the kindle notes off the webpage and there will be no need for any MyClippings.txt file.

Hope this helps!