The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniFocus > OmniFocus Extras
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Using ScriptingBridge to iterate tasks in the right pane Thread Tools Search this Thread Display Modes

I want to export data from the right pane in OF, using shell scripting and Python.

So far I have:

#!/usr/bin/env python
from ScriptingBridge import *

def process_tree(tree):
for el in tree.trees():

of = SBApplication.applicationWithBundleIdentifier_("co m.omnigroup.OmniFocus")
doc = of.defaultDocument()
tree = doc.documentWindows()[0].content()

But I can't find a way to get the actual task from a tree element. does work, but other properties (deadline, note) doesn't.

What is the correct syntax?

Thanks for any help
I couldn't solve it, so I changed the strategy - instead of the selection in the right pane, I am querying all tasks in OF through contexts. It works this way. This is first time I use ScriptingBridge, so I probably shouldn't get too excited... but man, this is really cool - adding functionality to your favorite app using your favorite programming language... :-)

In case anyone interested, my script tries to "visualize" time data from OF. The part I miss the most in GTD in general and in OF in particular is the ability to query my trusted system and withing 5 minutes answer the question "When can I expect it to be ready?"
So the script does the following:

- Loop through all tasks in OF and filter only those with due dates (or with parent that has due date)
- Create iCalendar vevent entry from every task, calculate start and end according to the deadline, duration of the task AND duration of other tasks (you can only do one thing at a time)
- Schedule those events ONLY during working hours (according to iCal setting)
That means that if I have two tasks, both 8 hours long, both with deadline on friday 9:00, one will be scheduled on wednesday, and one on thursday.
To make the updates more easy, the script serves generated iCalendar data on the fly through local Python http server. So I've subscribed to this local server (e.g. http://localhost:8888) in iCal, and now the calendar is auto-magically updated every 5 minutes with fresh data from OF.

I am only using it few hours now, but even at this point seeing my tasks automatically appear as scheduled blocks in iCal is awesome. A lot needs to be done, but when it's ready I'll package the script and release it, to share the joy :)
But I can't find a way to get the actual task from a tree element. does work, but other properties (deadline, note) doesn't.
Trees are sort of XML constructs and are not identical to the task/project/context they represent.

What you're looking for is the "value" property of the tree element you're looking at. That will be a reference to the actual object.

No idea how to implement this in Python, but it should send you in the right direction.

Also, tree scripting is substantially faster for just iterating through a list than recursing by context, project, or whatnot.

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
switching from context or project pane to actions pane adept OmniFocus 1 for Mac 1 2011-05-05 06:47 AM
How to show "parent" tasks [A: Data pane of OF preferences in v1.9 or later.] msurtees OmniFocus 1 for Mac 4 2011-04-19 04:53 PM
How do I iterate over ALL shapes in a canvas? OmniGraffle Extras 1 2007-08-20 10:59 AM
Notes in Pane commensal OmniFocus 1 for Mac 0 2007-07-16 01:09 PM
Tabs in a pane climbingtractor OmniWeb Feature Requests 2 2006-07-13 10:35 PM

All times are GMT -8. The time now is 07:45 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2023, vBulletin Solutions, Inc.