I have a layer "design" with several groups named "orderno" in there.
I want a script that would only select those.
I tried this code but I fail at selecting more than 1 group "orderno"
var docRef = app.activeDocument;
var layers = docRef.layers;
var myLayer = layers["design"]; //this defines the layer that you want to get the selection from
var myGroup = myLayer.groupItems["orderno"];
docRef.selection = null; //ensure there is nothing in the document selected already. this way you only get the selection you want.
for(var a=0;a<myGroup.pageItems.length;a++){ //here we are looping through each pageItem of myLayer.
var currentItem = myGroup.pageItems[a];
currentItem.selected = true;
}
I think I'm missing something at the 'currentItem' line...
please help!
You want to test the name of each group as you loop through them:
var docRef = app.activeDocument;
var layers = docRef.layers;
var myLayer = layers["design"]; //this defines the layer that you want to get the selection from
docRef.selection = null; //ensure there is nothing in the document selected already. this way you only get the selection you want.
for(var a=0;a<docRef.groupItems.length;a++){
if (docRef.groupItems[a].name == "orderno"){
docRef.groupItems[a].selected = true;
}
}