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

Selection objects from the arboard in an illustrator script

Explorer ,
Jan 15, 2021 Jan 15, 2021

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:

Screenshot 2021-01-15 124759.png

 

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

 

Thank you!

TOPICS
Scripting

Views

201

Translate

Translate

Report

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

 

Votes

Translate

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

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

 

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

 

Votes

Translate

Translate

Report

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