Félix Chénier PhD

Divers

OmniFocus AppleScript: SendToCalendar

Publié le 2018-10-23

Here is an OmniFocus Applescript that may interest OmniFocus Pro users.

This AppleScript syncs all due items to an external calendar so we can see what items are due, not only in OmniFocus but also in the macOS Calendar application. If the calendar is hosted on iCloud or any cloud syncing service (e.g. Google Calendar), then as an additional benefit all due items will also be available on all synchronized devices.

This script checks for all non-completed and non-dropped items with a due date and adds them to a calendar of your choice (by default, the calendar "OmniFocus") in the calendar app. The calendar must be already created before running the script.

Usage

  1. Create a calendar named OmniFocus in the macOS calendar application. Important: Do not manually add events to this calendar, since it will be regularly wiped by the script.

  2. Download the script here: SendToCalendar.scpt.

  3. Run the script. Personally I run this script each hour as a cron job. See how to do it below. It could also be run automatically using a more intuitive servicing application such as Hazel, or manually.

I advise against running the script too often (i.e., every minute or so), because it takes a few second to run during which all the OmniFocus calendar items are first deleted then recreated. Running it too often would cause calendar items to keep deleting are come back a few seconds later, which could be bothersome.

Running the script automatically using cron

This is for somewhat advanced users who want to run the script automatically each hour without using additional software.

  1. Launch a terminal and run this command:

    crontab -e

  2. Press i, then write:

    0 * * * * osascript ~/scripts/SendToCalendar.scpt > /dev/null

by changing ~/scripts/ to the absolute folder where you saved the script.

  1. Press ESC Shift+Z Shift+Z

  2. If all went well, the script should be run every hour from now on.

Enjoy and please feel free to contact me for more information.