Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Collapse single group of layers

Engaged ,
Aug 09, 2022 Aug 09, 2022

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

TOPICS
Actions and scripting , macOS
4.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 3 Correct answers

Community Expert , Aug 09, 2022 Aug 09, 2022

You can try the script that I created here:

 

https://community.adobe.com/t5/photoshop-ecosystem-discussions/action-or-script-to-expand-unfold-layer-groups/m-p/13077014#U13088415

 

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!

 

Translate
Community Expert , Aug 10, 2022 Aug 10, 2022

@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

...
Translate
People's Champ , Mar 10, 2023 Mar 10, 2023
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");
Translate
Adobe
Explorer ,
Mar 10, 2023 Mar 10, 2023

Is there a way not to change the group to open or close state, but to know is the group is open or closed?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Mar 10, 2023 Mar 10, 2023
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");
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 10, 2023 Mar 10, 2023
LATEST

@r-bin â€“ You always impress!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines