Get previous and next layer names through script.
Hi everyone,
I am looking for the most efficient way to get both the next and previous layer names in the layer stack. I need it to work a little differently then the usual Photoshop behaviour. Photoshop usually skips invisible layers, and will not get "inside" a folded layerset. I need a function that would get both visible and invisible layers, and would treat all layerset as if it was unfolded.
I did manage to make things work using a recursive function. I basically build myself an array with all the layers, then loop through it until I find the current active layer. I can then use "myArray[i-1]" and "myArray[i+1]" to get what I am looking for. It works, but it's clearly not an efficient way to do it. Gets pretty slow with documents with large number of layers...
I was hoping someone might be able to help me with some action manager magic... 🙂
Basically, all I have is "app.activeDocument.activeLayer", and I want a function (or functions) that would return the name of the layer directly above and directly under it, be it visible or not, be it part of a layerset or not...
Any thoughts ?
Thanks !
J.
