In the Layers panel, Photoshop has a dropdown option to ‘Collapse All Groups’. Is there a reverse option to expand one or all groups or a way to do it in Javascript?
In the Layers panel, Photoshop has a dropdown option to ‘Collapse All Groups’. Is there a reverse option to expand one or all groups or a way to do it in Javascript?
3
Answers
Any hoops, to collapse all groups just use Scriptlistner code:
And there doesn’t appear to be a "expandAllGroupsEvent"
However, I eventually found the answer here
Here you go, answer is derived from
https://community.adobe.com/t5/photoshop/expand-collapse-a-group-via-javascript/td-p/7286289/page/2?page=1%3F
this works in UXP JavaScript land in Ps 23.5.0
showing both getting the expanded state and switching/or toggling it; to expand all currently I’d simply walk the layers properties of group layers (layers where
layer.kind === 'group'
) from the desired starting point (orphotoshop.app.activeDocument.layers
) as I don’t know if there are more options applicable to this approach