Jump to content
  • 0

(Archived) Set note contents through applescripts


democrite

Idea

Hi,

 

I am moving all my notes from Day One to Evernote. Thru Scrivener I was able to import to it and then export individual notes. After getting them all into Evernote, they take the form of this:

 

Date: 28 avril 2013 10:20
Tags: [tags] - this line is there only if there were tags from Day One.

[note contents]

 

Now I'm trying to modify the note contents by setting it's date and then removing the first line indicating the date (will deal with tags afterwards). I'm using the following script:

tell application "Evernote"	set thenotes to selection	if (thenotes) is not {} then		repeat with thenote in thenotes			set oldnote to HTML content of thenote as string			set oldnote to do shell script "echo " & quoted form of oldnote & space & "| textutil  -convert txt  -stdin -stdout"			set line1 to paragraph 1 of oldnote			set thedate to text 7 thru -1 of line1 as string			if word 1 of line1 is equal to "Date" then				set creation date of thenote to date thedate				set modification date of thenote to date thedate				if word 1 of paragraph 2 of oldnote is equal to "Tags" then					set newnote to paragraphs 2 thru -1 of oldnote				else					set newnote to paragraphs 3 thru -1 of oldnote				end if				try					set title of thenote to newnote as string					set HTML content of thenote to newnote				end try			end if		end repeat	end ifend tell

It works if I run it on a note that I had copy and pasted (of the same format). But with all the imported text files, it fails at setting the note contents (cannot make {"[text]"} into type text.

 

 

Anyone have any ideas? Thanks.

 

Gary

Link to comment

0 replies to this idea

Recommended Posts

There have been no replies to this idea yet

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...