Skip to main content
sambroadleaf
Inspiring
April 27, 2020
Answered

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

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

This topic is closed to new replies. Start a new post to keep the conversation going.
Stephen Marsh
Stephen MarshCorrect answer
Community Expert
April 27, 2020
// Collapse all layer groups/sets
app.runMenuItem(stringIDToTypeID('collapseAllGroupsEvent'));

12 replies

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);

 

Translate
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.

 

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

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

Translate
sambroadleaf
Inspiring
April 27, 2020

>> shortcut <<

Translate
c.pfaffenbichler
Community Expert
Community Expert
April 27, 2020

I apologize, I had read sloppily. 

Translate