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

Collapse single group of layers

Engaged ,
Aug 09, 2022 Aug 09, 2022

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

TOPICS
Actions and scripting , macOS

Views

1.7K

Translate

Translate

Report

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!

 

Votes

Translate

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

@milevic & @Signfeld 

 

Please try the following script, I have extended it with some of the ideas from this thread. Thank you @Signfeld 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 active group? ...However, I

...

Votes

Translate

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

Votes

Translate

Translate
Adobe
Explorer ,
Mar 10, 2023 Mar 10, 2023

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?

Votes

Translate

Translate

Report

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

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

LATEST

@r-bin – You always impress!

Votes

Translate

Translate

Report

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