Skip to content

Instantly share code, notes, and snippets.

@dannysmith
Last active August 29, 2015 22:51
Show Gist options
  • Select an option

  • Save dannysmith/53d7dfd87360da086df1 to your computer and use it in GitHub Desktop.

Select an option

Save dannysmith/53d7dfd87360da086df1 to your computer and use it in GitHub Desktop.
AppleScript to Create new Evernote Project Support doc, tag and OmniFocus Project
display dialog "Project Name" default answer ""
set project_name to text returned of result
set project_tag to "/" & project_name
set project_note_title to "PROJECT - " & project_name
set evernote_note_link to missing value
tell application "Evernote"
-- Create Project Tag
if (not (tag named project_tag exists)) then
set evernote_tag to make tag with properties {name:project_tag, parent:tag named "- projects"}
end if
-- Create Project Note
set evernote_note to create note title project_note_title with text "OF:" notebook "2: Cabinet"
-- Assign tag to note
assign evernote_tag to evernote_note
-- Sync code from http://veritrope.com/code/get-note-links-in-evernote-for-newly-created-notes/
repeat until isSynchronizing is false
--Empty loop waits until any current sync is done.
end repeat
synchronize
repeat while evernote_note_link is missing value
--Wait until a value is assigned to evernote_note_link
set evernote_note_link to (note link of evernote_note)
end repeat
end tell
-- Build Link for OF
set of_note_link to evernote_note_link
-- Create OmniFocus Project
tell application "OmniFocus"
tell default document
set of_project to make new project with properties {name:project_name, note:of_note_link} at beginning of projects
end tell
set of_project_link to "omnifocus:///task/" & id of of_project
end tell
-- Add Link to OF Project to Evernote Note and Open the Note
tell application "Evernote"
tell evernote_note to append html "<a href='" & of_project_link & "'>OmniFocus Project</a>"
open note window with evernote_note
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment