Skip to content

Instantly share code, notes, and snippets.

@bachya
Created September 5, 2014 05:23
Show Gist options
  • Save bachya/7eb70e95f2ff12fce918 to your computer and use it in GitHub Desktop.
Save bachya/7eb70e95f2ff12fce918 to your computer and use it in GitHub Desktop.
Smart Applescript that allows tasks to be entered into OmniFocus, even if it's not open
-- Determine whether OmniFocus is running.
tell application "System Events"
set omnifocusActive to count (every process whose name is "OmniFocus")
end tell
if omnifocusActive > 0 then
-- OmniFocus is running, so insert a task into it directly.
tell application "OmniFocus" to tell document 1
make new inbox task with properties {name:"TASK TITLE"}
end tell
else
-- OmniFocus isn't running, so use the Mail Drop method.
do shell script "mail -s \"TASK TITLE\" " & mailDropAddress & " < /dev/null"
end if
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment