Copy link to clipboard
Copied
Is there a way to select multiple layers in Photoshop through a script without using script listener? I am
looking everywhere in the API but i am not able to find anything. Maybe i am just not looking right, please help!
Selecting multiple layers requires action manager code. the DOM can't do it, and is slower anyway. If using scriptlistener works, that's what you should go with.
Copy link to clipboard
Copied
Do you want to get the selected layers that have all ready been selected, or do you want the script to select multiple layers that you call out in your script? Or do you just want to put various layers into an array one at a time for later use, as in a loop?
Copy link to clipboard
Copied
was wondering if there is a method or property of an artlayer which refers to it being selected Kind of like having them both be active layers. I need the script itself to select 2 layers and then align them on their respective top corners. I know i this can be done via scriptlistener and it has been my solution till now.
Copy link to clipboard
Copied
Selecting multiple layers requires action manager code. the DOM can't do it, and is slower anyway. If using scriptlistener works, that's what you should go with.
Copy link to clipboard
Copied
Oh wow, i'm unsure why, but i was under the impression that that the DOM would run faster. Alright then, Thanks a lot!
Copy link to clipboard
Copied
No, AM code runs faster - odd, as it seems like it would be the other way with more lines of code.
Copy link to clipboard
Copied
it would be the other way with more lines of code.
The main reason the DOM is slower is because you have to use fairly heavy objects like Document and Layer. And their properties are not cached. This means that every time you access a property, it ends up making AM code in C/C++. This can get expensive really quickly.
Also, I have Stdlib.selectLayers(doc, layers, append) in xtools/xlib/stdlib.js. It has the necessary AM code at the bottom.
Copy link to clipboard
Copied
Thanks for the explanation!
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more