I have this script, which is displaying the View --> Show Structure pane:
with(obj.doc.xmlViewPreferences)
{
// this opens the View --> Show Structure pane
showStructure = true;
showTagMarkers = true;
showTaggedFrames = true;
showTextSnippets = true;
}
However, the root node remains minimized. I found that holding the Alt key and clicking on this root node will expand the entire tree though.
So is there a way to programmatically execute “Alt + click” on this root node? I am using Windows, and CS5.
You can get close by selecting nodes. E.g. to select all elements at the 3rd level and on the way expanding all on the levels above you would use
Repeat for the indicated line for deeper levels. With the following snippet you could also select XML attributes of those elements without children:
Finally deselect to clean up the selection highlights.
Edit: For an arbitrary depth you can use a loop. It just should ensure there are elements in the XMLElement / XMLAttribute collections before asking for them. The resulting code: