0

I'm developing an extension in Photoshop and I need to close a layers folder (containing a lot of information) to make the layers view cleaner. I haven't found anything in the Photoshop documentation and nothing on the forums.

From :

enter image description here

To :

enter image description here

Thanks in advance for your help !

Fitspade
  • 377
  • 1
  • 11
  • 1
    [google is your friend, the answer is here](https://community.adobe.com/t5/photoshop-ecosystem-discussions/expand-collapse-a-group-via-javascript/td-p/7286289) – Ghoul Fool Jul 06 '22 at 13:34
  • Thank you! I wasn't typing the right terms in the search bar.. – Fitspade Jul 26 '22 at 13:43

2 Answers2

1

this works in Ps 23.5

photoshop.core.executeAsModal(function _executeAsModal(){
        return photoshop.action.batchPlay([{
            _obj: "set",
            _target: [{ _ref: "property", _property: "layerSectionExpanded" }, { _ref: "layer", _id: 1234 }],
            to: true // true to open/expand, false to collapse/close
        }], {}).then(res=>{
            return 'should be expanded now';
        });
    },
    { commandName: 'open/expand group layer' }
).then(console.log).catch(console.error);

related: Is there a way to EXPAND a group in Photoshop? https://gist.github.com/JimaDobes/371fcaf0d8f61fb5d1175d54e85209c7

jimmont
  • 2,304
  • 1
  • 27
  • 29
0

Thank you Ghoul Fool for finding this thread :

https://community.adobe.com/t5/photoshop-ecosystem-discussions/expand-collapse-a-group-via-javascript/td-p/7286289

Fitspade
  • 377
  • 1
  • 11