A very rough first draft of a script to import the notes selected in the Evernote OS X application GUI to a series of OmniFocus tasks, either in the Inbox, or in a date-stamped import folder.
(In this draft the notes come across as plain text. It's easy enough to get a formatted RTF version into the clipboard, but I haven't spent enough time on it to detect an obvious route from the clipboard into the rich text of the OF note).
[I don't use Evernote, so this draft is offered out of curiosity, as a rough suggestion, but may not be much supported or developed]
Code:
-- Ver 0.2
-- Rough draft of a script to import selected EverNote notes to OF
-- If the following property is set to false, a date-stamped import folder is created
-- containing a project (named after the relevant Evernote notebook) which in turn contains the selected items
-- If it is set to true, the imported items will be placed in the OF Inbox
property pblnToInBox : false
on run
set lstEv to EvNoteSeln()
PlaceInOF(lstEv)
end run
on EvNoteSeln()
tell application id "com.evernote.Evernote"
set lstSeln to selection
if length of lstSeln > 0 then
tell front notebook
set lstEv to {its name}
repeat with oNote in lstSeln
tell note id (local id of oNote)
set end of lstEv to {title, HTML content}
end tell
end repeat
end tell
return lstEv
end if
{}
end tell
end EvNoteSeln
on PlaceInOF(lstEv)
set lngNotes to length of lstEv
if lngNotes > 1 then
set dte to current date
tell application id "com.omnigroup.omnifocus"
tell front document
if pblnToInBox then
repeat with i from 1 to lngNotes
set {strTitle, strHTML} to item i of lstEv
set the clipboard to strHTML
set strTxt to my GetText()
set oTask to make new inbox task with properties {name:strTitle, note:strTxt}
end repeat
else
set oFolder to make new folder with properties {name:"Evernote Import " & dte as string}
tell oFolder
set oProj to make new project with properties {name:first item of lstEv}
end tell
tell oProj
repeat with i from 2 to lngNotes
set {strTitle, strHTML} to item i of lstEv
set the clipboard to strHTML
set strTxt to my GetText()
set oTask to make new task with properties {name:strTitle, note:strTxt}
end repeat
end tell
end if
end tell
end tell
end if
end PlaceInOF
on GetText()
(do shell script "pbpaste | textutil -format html -convert txt -stdin -stdout") & return
end GetText