Oleg Atamanenko

thoughts about programming

Quick Entry Task to Omnifocus from Terminal

I use OmniFocus a lot and wanted to share with you simple automation that will allow to add tasks to OmniFocus without switching to the main window or using QuickEntry.

To achieve it, we will use AppleScript that comes with macOS out of the box.

  1. Create new Apple Script using Script Editor with the following content:
on run argv
  tell application "OmniFocus"
    tell default document
      parse tasks into it with transport text item 1 of argv
    end tell
  end tell
end run

Save it to a folder like ~/bin under the name omni.scpt (obviously, you can change it, just don’t forget to update the shell script below).

  1. Create a shell script omni and make it executable:
#!/bin/sh

# detect current folder.
script_path=$(dirname "$0")
# join all arguments to a single line
task="$*"
# invoke apple script and pass entry to it.
osascript "$script_path/omni.scpt" "$task"
  1. Add folder with both files to your $PATH.

  2. That’s it.

Example usage:

omni review agenda for meeting with Super team @review

Note that you can use tags when entering task.