Copy link to clipboard
Copied
Hello everyone!
I am importing PDFs to illustrator using a script, and up until now I have been embedding the PDF as a groupItem. I have only been importing PDFs with one group of items to apply effects to, so everything has worked fine until now.
However, now I want to import PDFs with two or three groupItems. I have been trying to select these by iterating through all the groupItem elements in the document, but I many more than the three I want to select (I get over 20).
This is my document, and there are three designs which occupy a third of the document each:
Any ideas how I can go about selecting these three designs and applying effects to them individually?
Thank you!
1 Correct answer
Further to what @CarlosCanto said ...
// referencing items on artboard
var list = "";
for (var i = 0; i < activeDocument.artboards.length; i++) {
activeDocument.artboards.setActiveArtboardIndex(i);
activeDocument.selectObjectsOnActiveArtboard();
for (var j = 0; j < selection.length; j++) {
list = list + activeDocument.artboards[i].name + " - " + selection[j].name + "\r";
}
}
alert( list );
Explore related tutorials & articles
Copy link to clipboard
Copied
we can select everything in a given artboard. We have to activate the target artboard first
activeDocument.artboards.setActiveArtboardIndex(1); // activate 2nd artboard
activeDocument.selectObjectsOnActiveArtboard(); // select all in active artboard
Copy link to clipboard
Copied
Further to what @CarlosCanto said ...
// referencing items on artboard
var list = "";
for (var i = 0; i < activeDocument.artboards.length; i++) {
activeDocument.artboards.setActiveArtboardIndex(i);
activeDocument.selectObjectsOnActiveArtboard();
for (var j = 0; j < selection.length; j++) {
list = list + activeDocument.artboards[i].name + " - " + selection[j].name + "\r";
}
}
alert( list );

