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

ai script – select all objects on an Artboard but just from one Layer?

Community Expert ,
Feb 13, 2023 Feb 13, 2023

Copy link to clipboard

Copied

might be an easy one but I'm stuck here:

I want to select all Objects on one Artboard but only those from one exact Layer.

 

Details:

Using JavaScript I'm able to select all Objects on a specific Artboard.

Now is it possible to select everything from that Artboard being on specific Layer?

This might be one of many Layers.

Each Layer might contain Objects to be spread all over other Artboards...

 

Setting:

Multiple Artboards

Multiple Layers

Multiple Objects randomly on Layers/Artboards

 

Basic Script:

    for(var a=0; a<artboardRef.length; a++){
        docRef.artboards.setActiveArtboardIndex(a);
        docRef.selectObjectsOnActiveArtboard();
    }

 

Thanks

Nils

TOPICS
Scripting

Views

629

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
Adobe
Community Expert ,
Feb 13, 2023 Feb 13, 2023

Copy link to clipboard

Copied

Just setting the desired layer to Isolation mode, then selecting all on active artboard (see Select menu) should work.

 

Isn't that an option?

 

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
Community Expert ,
Feb 13, 2023 Feb 13, 2023

Copy link to clipboard

Copied

you could lock or hide all layers (except the one you're interested in selecting) before Selecting all objects on artboard.

 

or you could select all objects like your current script, then loop through all selected objects, query what layer they belong to and deselect if they're not in the target layer

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 ,
Feb 13, 2023 Feb 13, 2023

Copy link to clipboard

Copied

LATEST

In addition to the two ways @CarlosCanto mentioned, you could select the items on the target layer, then deselect the items not on the target artboard, by comparing the bounds of each selected item with the bounds of the target 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