Skip to main content
sambroadleaf
Inspiring
April 27, 2020
Answered

Is there a "collapse all groups (layersets)" shortcut?

  • April 27, 2020
  • 4 replies
  • 4000 views

Or a script if someone has that i can bind to a button.

This topic has been closed for replies.
Correct answer Stephen Marsh
// Collapse all layer groups/sets
app.runMenuItem(stringIDToTypeID('collapseAllGroupsEvent'));

4 replies

Stephen Marsh
Community Expert
Community Expert
August 9, 2022
Stephen Marsh
Community Expert
Community Expert
April 27, 2020

For completeness, I wanted to add the following code, however it no longer appears to work?

 

 

// Expand all layer sets  
// https://forums.adobe.com/message/5764024#5764024  
function openAllLayerSets(parent) {
    for (var setIndex = 0; setIndex < parent.layerSets.length; setIndex++) {
        app.activeDocument.activeLayer = parent.layerSets[setIndex].layers[0];
        openAllLayerSets(parent.layerSets[setIndex]);
    }
}
openAllLayerSets(app.activeDocument);

 

sambroadleaf
Inspiring
April 27, 2020

It's supposed to recursively expand set by setting it as active layer?

I just recently started looking into PS scripting, so i don't know api at all.

 

Stephen Marsh
Community Expert
Stephen MarshCommunity ExpertCorrect answer
Community Expert
April 27, 2020
// Collapse all layer groups/sets
app.runMenuItem(stringIDToTypeID('collapseAllGroupsEvent'));
c.pfaffenbichler
Community Expert
Community Expert
April 27, 2020

Have you tried cmd-clicking the »open triengle«-icon that indicates this? 

sambroadleaf
Inspiring
April 27, 2020

>> shortcut <<

c.pfaffenbichler
Community Expert
Community Expert
April 27, 2020

I apologize, I had read sloppily.