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

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

Community Expert ,
Feb 13, 2023 Feb 13, 2023

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
1.1K
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 2 Correct answers

Community Expert , Feb 13, 2023 Feb 13, 2023

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

Translate
Guide , Feb 13, 2023 Feb 13, 2023

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.

Translate
Adobe
Community Expert ,
Feb 13, 2023 Feb 13, 2023

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

 

Isn't that an option?

 

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

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

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

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