Solved: Evernote Tasks -> Omnifocus

I thought that would be a general problem but so far I did not find a suitable script for that. What I want to do is setting tasks in Evernote that show up automatically in Omnifocus with the note attached.

In detail it would look like that:

I would set an alarm to a note in Evernote - with or without due date.

Then I would run the script that…

  1. adds an Omnifocus task for every alarm in Evernote and setting the due date accordingly if specified and including the URL to the note to the task
  2. deletes the alarm in Evernote
  3. adds the tag “inOF” within Evernote.

A start could be that script of Frank Meeuwsen:

Has anybody an idea how to solve that? Any help greatly appreciated!

Best,
David

Solved: I used a script made by Frank Meeuwsen and just tuned it a bit to select reminders, transfer the due date correctly and leave a tag “inOF” in Evernote afterwards. Adaptation is very basic, but working: All your Evernote reminders will result in a OF inbox item, reminders in Evernote are deleted. Try on your own risk.

The Credit goes to Frank Meeuwsen at lifehacking.nl for the main code. See his untouched version at https://github.com/frankmeeuwsen/Evernote2Omnifocus

########### SETTINGS ###########
– this is the tag you use for flagging in Evernote
– here I use review (case sensitive)
property todoTag : “review”
property transferTag : “inOF”

– the name of the task starts by default with "Review: " (without quotes)
– change this to your liking
property taskPrefix : "Review: "

– Do you want to transfer the original reminder? Default = true
property transferReminder : true

– Do you want to delete the original reminder? Default = true
property deleteReminder : true

#############################

set enReminderDone to current date
set theTodoList to {}

try

tell application "Evernote"
	
	set savedDelimiters to AppleScript's text item delimiters
	set AppleScript's text item delimiters to {"/"}
	
	-- find all notes tagged with todo tag
	set foundNotes to find notes " reminderOrder:* -reminderDoneTime:* -tag:\"" & transferTag & "\""
	
	
	repeat with aNote in foundNotes
		set enTitle to (the title of aNote)
		set enTitle to taskPrefix & enTitle
		set enTags to (the tags of aNote)
		set enId to (the local id of aNote)
		set enLink to note link of aNote
		if transferReminder is true then
			set enReminder to reminder time of aNote
			set end of theTodoList to {theTitle:enTitle, thelink:enLink, theTags:enTags, theReminder:enReminder}
		else
			set end of theTodoList to {theTitle:enTitle, thelink:enLink, theTags:enTags}
		end if
		set ennotename to taskPrefix & enTitle
		-- display alert "Done: " & enTitle & "" giving up after 3
		
		set AppleScript's text item delimiters to savedDelimiters
		
		
		try
			tell front document of application "OmniFocus"
				if transferReminder is true then
					set newtask to make new inbox task with properties {name:(enTitle), note:"", due date:(enReminder)}
				else
					set newtask to make new inbox task with properties {name:(enTitle), note:""}
				end if
				tell the note of newtask
					set note of newtask to enLink
				end tell
				
			end tell
			
		on error errmsg
			display dialog errmsg buttons {"Oops. Did you create the context?"}
		end try
		
		try
			tell application "Evernote"
				set reminder done time of aNote to enReminderDone
				assign tag "inOF" to aNote
				
			end tell
		end try
		
	end repeat
	
	
end tell

on error errmsg
display dialog errmsg buttons {“Oops. Couldn’t find Evernote! Try changing paths.”}

end try