It’s hard to see what Javascript/ECMAScript features are supported in JXA. It seems like there is an import() function available but I can’t find what it does. I tried using module exports & imports but they don’t work. push()‘ed onto the end of a Javascript array of all the stats and stored on disk as a JSON file. Once all the tasks are filtered the current stats put into a Javascript object, which is. I tried iterating over the tasks and checking the effectivel圜ompleted property on each one, thinking it would be faster, but effectivel圜ompleted has to send a message to OmniFocus to get a response, and doing that for my entire library is much slower than a single. for completed tasks, and tasks completed/added/dropped in the past day.įiltering with whose is pretty slow so this can’t be run every few seconds, (it takes several seconds to run), but for now I’m only updating daily so it’s fine if it’s slow. (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.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |