Skip to content

Instantly share code, notes, and snippets.

@sttts
Last active December 24, 2015 08:09
Show Gist options
  • Save sttts/6768882 to your computer and use it in GitHub Desktop.
Save sttts/6768882 to your computer and use it in GitHub Desktop.
Install terminal-notifier by "sudo gem install terminal-notifier". Then put this script to ~/Library/Scripts/Applications/OmniFocus and bind a shortcut like Alt-Cmd-Enter to it using FastScripts. Originally based on Curtis Clifton's "What am I doing" script my largely adapted and extended.
tell application "OmniFocus"
if quick entry of front document is visible then
set theSelectedItems to selected trees of quick entry
else
tell front document
tell (first document window whose index is 1)
set theSelectedItems to selected trees of content
if ((count of theSelectedItems) ≠ 1) then
-- try sidebar selection
set theSelectedItems to selected trees of sidebar
end if
end tell
end tell
end if
if ((count of theSelectedItems) < 1) then
display alert "You must first select a project or action." message "Select a project or action to highlight." as warning
return
end if
if ((count of theSelectedItems) > 1) then
display alert "You must select just one project or action." message "Select a single project or action to highlight." as warning
return
end if
set selectedItem to value of item 1 of theSelectedItems
set theName to name of selectedItem
set theId to id of selectedItem
set flagged of selectedItem to true
my notify(theName, "", "omnifocus:///task/" & theId, theId)
end tell
on notify(theTitle, theDescription, theUrl, theId)
do shell script "/usr/bin/terminal-notifier -sender com.omnigroup.OmniFocus -title \"" & theTitle & "\" " & "-message \"" & theDescription & "\" -group \"" & theId & "\" -open \"" & theUrl & "\""
end notify
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment