Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Selection objects from the arboard in an illustrator script

Explorer ,
Jan 15, 2021 Jan 15, 2021

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:

Screenshot 2021-01-15 124759.pngexpand image

 

Any ideas how I can go about selecting these three designs and applying effects to them individually?

 

Thank you!

TOPICS
Scripting
267
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guide , Jan 15, 2021 Jan 15, 2021

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 );

 

Translate
Adobe
Community Expert ,
Jan 15, 2021 Jan 15, 2021

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

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jan 15, 2021 Jan 15, 2021
LATEST

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 );

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines