(this will change a lot when you archive old tasks) now tasks.length is the total number of tasks in the DB To extract the data we can use OmniFocus’s flattenedTasks list, which gets a flattened list of all tasks in the database, then we can filter that list of tasks by status, creation date, completion date, and so on: // Get the "document" that we need to work with.Ĭonst ofdoc = Application('OmniFocus').defaultDocument It works ok, but documentation of how it actually works, and what parts of modern Javascript are supported, is hard to find. Save your work often.Īpplescript is foreign to me so I opted for Javascript for Automation, aka JXA, Apple’s, (maybe abandoned?), attempt to get a Javascript version of Applescript running. Script Editor lets us create an app bundle with somewhat modularized code, but isn’t the greatest IDE and crashes more than it should. For the completed task list I used Automator, but I don’t like editing Java- or Apple- script in the tiny Automator windows, so I tried out Script Editor. There are a few ways to build a program that interacts with other programs on a Mac. Steps 1 & 2 are handled by a Javascript for Automation application written in Script Editor. Show the chart on my desktop, (next post).
Use that snapshot to create a text-based chart, (next post).Extract a snapshot of the status of the database every day, (this post).The charts are created in 3 steps, and I am breaking these up into two posts: My desktop has been home to a list of today’s completed OmniFocus tasks for a long time, and now it’s home to a pair of charts: remaining items over the last 30 days, and items completed per day for the last 30 days. I want to see how many things are in my OmniFocus library and if it’s trending larger or smaller.