Skip to main content
sambroadleaf
Inspiring
April 27, 2020
Answered

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

  • April 27, 2020
  • 4 replies
  • 4010 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);

 

c.pfaffenbichler
Community Expert
Community Expert
April 27, 2020

The Group-opening code works fine for me (on 21.1.2). 

sambroadleaf
Inspiring
April 27, 2020

>however it no longer appears to work?

shouldn't have trusted you!

Works indeed, but slow.

Wondering if there is an event for that.

 

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.