I want my OmniOutliner automation script to select the siblings following the currently selected row.
Note:a way to get the ItemTreeNode corresponding to an Item is a sufficient answer to the problem posed below; if you can give me that you can ignore the rest.
// Given
editor = document.editors[0]
// the currently selected ItemTreeNodes:
editor.selectedNodes
// another way to get the currently selected ItemTreeNodes:
editor.selection.nodes
// the currently selected Items:
editor.selection.items`
// or, getting fancy:
editor.selectedNodes.map(function(node){return node.object})
// the siblings following the (first) selected Item
editor.selection.items[0].followingSiblings
The last expression yields an Array
of Items
. But Editor.select()
takes an Array
of ItemTreeNodes
. I don’t know how to get siblings of an ItemTreeNode
(or other related ItemTreeNodes
). And I don’t know how to get the ItemTreeNode
corresponding to an Item
. So I can’t figure out how to select siblings of a selected row.