Copy link to clipboard
Copied
Is it possible to collapse only currently selected group of layers in PS using javascript?
I have the problem that after completing my script, selected group stay expanded, even it is collapsed when i run script.
I found some solutions where all groups are collapsed, but is possible to do it for a single group?
Thanks in advance
You can try the script that I created here:
I just updated it, it has not had exhaustive testing so it may or may not work as intended with your unique layer structure.
Feedback (good or bad) would be appreciated!
@milevic & @Zesty_wanderlust15A7
Please try the following script, I have extended it with some of the ideas from this thread. Thank you @Zesty_wanderlust15A7 for the discussion and bouncing ideas back and forth!
I believe that it is a better option than my script linked in the other topic.
This is still a hack to overcome missing features of Photoshop, which only allows one to:
Collapse All Groups...
But why not collapse the active group? Why not expand all groups? Why not expand the act
...var id = activeDocument.activeLayer.id;
var r = new ActionReference();
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("layerSectionExpanded"));
r.putIdentifier(stringIDToTypeID("layer"), id);
var rez = executeActionGet(r).getBoolean(stringIDToTypeID("layerSectionExpanded"));
alert(rez?"Expanded":"Collapsed");
Copy link to clipboard
Copied
Is there a way not to change the group to open or close state, but to know is the group is open or closed?
Copy link to clipboard
Copied
var id = activeDocument.activeLayer.id;
var r = new ActionReference();
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("layerSectionExpanded"));
r.putIdentifier(stringIDToTypeID("layer"), id);
var rez = executeActionGet(r).getBoolean(stringIDToTypeID("layerSectionExpanded"));
alert(rez?"Expanded":"Collapsed");
Copy link to clipboard
Copied
@r-bin – You always impress!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now