Hi all,
I am trying to use OmniOutliner to manage a product backlog for a project plan. I've created an outline with a hierarchical list of topics, owners, sprint due, and some other columns. I am trying to write an AppleScript (well, really a Python script using appscript to interface with the AppleScript API) that allows me to print a filtered version of the outline to a text file. It appears there is a way to easily filter for a list of rows directly using something like this Python code:
te.documents[2].rows.cells[its.value.contains("Bob") or its.value.contains("Steve") or its.ancestors()].value()
[[u'Bob, Steve'], [], [], [u'Bob, Rich, Steve, others'], [u'Bob, Rich, Steve, others']]
But what I really want is to get a list of rows in a parent-child relationship so I can print the any portion of the hierarchy where the search terms appear anywhere at a given level or below. So:
1. Top topic
1.1 Foo | Andy
1.2 Bar | Joe
2. Second topic
2.1 foobar | Bob
2.1.1 abc
2.2 blah | Robin
If I search for "Bob", I want to see:
2. Second topic
2.1 foobar | Bob
2.1.1 abc
Is something like that possible using AppleScript? Or am I limited to just getting a list of matching rows with no hierarchy? I have searched through these forums, AppleScript documentation, Google, and Safari Books Online. I'm new to this type of scripting (but not programming in general), and may be missing something obvious. I did find a few scripts in this forum that filter a doc based on a search string, but they don't seem to keep the hierarchy intact. Any help would be greatly appreciated.
The solution I'm converging on now is to make a tree in Python that I manage myself, prune the tree based on a search, and finally print the pruned version of the tree.
Thanks,
JL
I am trying to use OmniOutliner to manage a product backlog for a project plan. I've created an outline with a hierarchical list of topics, owners, sprint due, and some other columns. I am trying to write an AppleScript (well, really a Python script using appscript to interface with the AppleScript API) that allows me to print a filtered version of the outline to a text file. It appears there is a way to easily filter for a list of rows directly using something like this Python code:
te.documents[2].rows.cells[its.value.contains("Bob") or its.value.contains("Steve") or its.ancestors()].value()
[[u'Bob, Steve'], [], [], [u'Bob, Rich, Steve, others'], [u'Bob, Rich, Steve, others']]
But what I really want is to get a list of rows in a parent-child relationship so I can print the any portion of the hierarchy where the search terms appear anywhere at a given level or below. So:
1. Top topic
1.1 Foo | Andy
1.2 Bar | Joe
2. Second topic
2.1 foobar | Bob
2.1.1 abc
2.2 blah | Robin
If I search for "Bob", I want to see:
2. Second topic
2.1 foobar | Bob
2.1.1 abc
Is something like that possible using AppleScript? Or am I limited to just getting a list of matching rows with no hierarchy? I have searched through these forums, AppleScript documentation, Google, and Safari Books Online. I'm new to this type of scripting (but not programming in general), and may be missing something obvious. I did find a few scripts in this forum that filter a doc based on a search string, but they don't seem to keep the hierarchy intact. Any help would be greatly appreciated.
The solution I'm converging on now is to make a tree in Python that I manage myself, prune the tree based on a search, and finally print the pruned version of the tree.
Thanks,
JL