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

Select everything inside current layer

Explorer ,
Jun 12, 2019 Jun 12, 2019

Copy link to clipboard

Copied

Hello.

Quite new to adobe scripting so excuse my ignorance.
I want to select everything inside the current active layer through a jsx script.

From previous threads I've seen that this is one way to do it:

  var items = doc.activeLayer.pageItems;

  doc.selection = null;

  for(var i = 0; i<items.length; i++){

   var currentItem = items[i];

   alert(currentItem);

   currentItem.selected = true;

  }

This works for some of my assets, but not all. On the ones that the script does not work on it only gives the first child of the layer and stop there. The selection is applied to a part of the object but not everything. See attached picture for explanation ->

I am very confused, the items not getting selected are pathItems which should be part of the pageitems(?)
Any help is appriciated!

TOPICS
Scripting

Views

48.1K

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

Valorous Hero , Jun 12, 2019 Jun 12, 2019

Hi, first of all - I like your Candy Panel - curious about what it do and where it came from!

About the actual topic: yes it would be surprising to me too as my expectation of the selection behavior says the contained items should be also selected when you select a top-level group.

But with scripting it's also possible to delete non-deletable swatches and cause a crash, or to create empty groups that have no contents, too. So there's this experimentation that is a layer between how it ought to wo

...

Votes

Translate

Translate
Adobe
Valorous Hero ,
Jun 12, 2019 Jun 12, 2019

Copy link to clipboard

Copied

Hi, first of all - I like your Candy Panel - curious about what it do and where it came from!

About the actual topic: yes it would be surprising to me too as my expectation of the selection behavior says the contained items should be also selected when you select a top-level group.

But with scripting it's also possible to delete non-deletable swatches and cause a crash, or to create empty groups that have no contents, too. So there's this experimentation that is a layer between how it ought to work and the final way we end up going about things.

For your case, you may try to use the scripting 'select all art in the layer' command, and it goes like this:

app.activeDocument.activeLayer.hasSelectedArtwork = true;

This should select all the stuff on the layer, so I hope it works for you.

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
Explorer ,
Jun 12, 2019 Jun 12, 2019

Copy link to clipboard

Copied

Thank you very much, that was the solution! Now it acts just as if i would press the selected art button inside illustrator, it selects everything.

Thank you again!

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
Advocate ,
Jan 17, 2020 Jan 17, 2020

Copy link to clipboard

Copied

LATEST

Why not use the build in function? You can select everything inside a layer by clicking on the open circle on the far right. Therre are quite some functions these layers have which are not well know i guess. But you probably need it for scripting i guess, i wasnt really sure looking at the question.

 

select-all-layers-sublayers.gif

 

 

 

 

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