how to collapse a layer by javascript?
Hello,
I looking for the commands in javscript to collapse/fold and extend/unfold a layer and/or a group in Illustrator.
Thanks for any hints or tips in advance,
jens
Hello,
I looking for the commands in javscript to collapse/fold and extend/unfold a layer and/or a group in Illustrator.
Thanks for any hints or tips in advance,
jens
As @Charu Rajput said, collapsing layers is almost certainly not possible. I was however able to expand all layers with items in them. As an action, record the command "Locate object" from the layers panel menu. In the script, iterate the top level layers and call the action each time.
var layers = app.activeDocument.layers;
for (var i = 0; i < layers.length; i++) {
app.selection = null;
layers[i].hasSelectedArtwork = true;
app.doScript("Action 1", "Set 1");
}
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.