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:
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!
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
...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.
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!
Copy link to clipboard
Copied
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.