Skip to content

Instantly share code, notes, and snippets.

@turadg
Created September 24, 2011 22:43
Show Gist options
  • Save turadg/1239959 to your computer and use it in GitHub Desktop.
Save turadg/1239959 to your computer and use it in GitHub Desktop.
OmniFocus integrations
-- based on post by iNik: http://forums.omnigroup.com/showthread.php?p=101947#post101947
global theTitle, theTaskNote
set theTaskNote to ""
tell application "Google Chrome"
-- activate
tell window 1 to tell active tab
set oldClipboard to text of (the clipboard)
log result
copy selection
set theTitle to title
set theURL to URL
set theTaskNote to theURL
set newClipboard to text of (the clipboard)
log result
if newClipboard is not equal to oldClipboard then
set theTaskNote to theTaskNote & (return) & (return) & newClipboard
end if
end tell
end tell
-- Make the task
tell application "OmniFocus" to tell default document
tell quick entry
set theTask to make new inbox task with properties {name:theTitle}
select last tree
set note of theTask to theNote
set note expanded of last tree to true
open
end tell
end tell
-- Make a new Omnifocus task from the current selection in Evernote
-- The selected text becomes the task body, the note title becomes the task title, and a link is provided back to the Evernote note
-- NOTE: you need to set up a key binding in your Keyboard preferences for the "Copy Evernote Link" menu item in Evernote to have the shortcut "Cmd-Option-Shift-Ctrl C".
global theTitle, theTaskNote
set theTaskNote to ""
tell application "Evernote"
set oldClipboard to text of (the clipboard)
log result
-- Evernote doesn't understand misccopy
--copy selection
-- so hack it
tell application "Evernote" to activate
tell application "System Events" to keystroke "c" using {command down}
set newClipboard to text of (the clipboard)
set noteList to selection
set currentEvernote to item 1 of noteList
set theTitle to title of currentEvernote
tell application "System Events" to keystroke "c" using {command down, control down, option down, shift down}
set theURL to the clipboard
set theTaskNote to theURL
log result
if newClipboard is not equal to oldClipboard then
set theTaskNote to theTaskNote & (return) & (return) & newClipboard
end if
end tell
-- Make the task
tell application "OmniFocus" to tell default document
tell quick entry
set theTask to make new inbox task with properties {name:theTitle}
select last tree
set note of theTask to theTaskNote
set note expanded of last tree to true
open
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment