Good people of the forums,
I am working on a script that simplifies/consolidates art objects in documents that we eventually convert into FXG files. I have run into a strange problem with a compound shape in one document.
Normally upon encountering a "plugin item," the script selects the item and then runs an Expand Appearance so that it can begin to break it down to easier items. In this case, Expand Appearance will not run, because the script seems to be unable to select the plugin item plus all of its children. If I use the Layers palette to select the compound shape manually, outside of the script, Illustrator will select the compound shape and everything contained within it, like normal:
Yet, if I set the 'selected' property to true within the script, it selects the compound shape and any first-level children, but leaves any second level children (children of children) unselected, which makes Expand Appearance disabled:
selection/expansion code looks like this:
doc.pageItems[x].selected = true
app.executeMenuCommand('expandStyle')
I thought of putting together a quick function that would accept a page item as an argument and select it along with all of its children, but in the case of plugin items I have been unable to access its children directly since there doesn't appear to be any such thing as [pluginItem].pageItems or [pluginItem].pathItems.
I then figured maybe I could encapsulate the whole mess into a group so that I would have access to the groupObject.pageItems list and could select everything that way, but without selecting all the sub-children objects, Illustrator won't allow me to group them.
I'm starting to feel like Yossarian with this thing.