I found this script which opens the complete structure of an InDesign doc.
var items = app.activeDocument.xmlElements.everyItem();
while( items.xmlElements.length ) {
items = items.xmlElements.everyItem();
app.select(items.getElements());
if( items.xmlAttributes.length )
app.select(items.xmlAttributes.everyItem().getElements());
}
app.select(null);
Being a novice in InDesign/javascripting, how can I achieve the opposite?
In other words collapsing the entire structure?
Thank you n
EDIT: In case the above doesn't make sense at all, I would like to add that my goal is to automate the closing of the entire tree of a document in the InDesign Structure pane by a script. Effectively "alt + click" on the root of the tree. How could I do that?