I’m not sure you can expand a group programmatically.
One approach / workaround could be to create a group at the very first step of your recorded action. Before adding layers that you want to have inside that group. Make sure to select that new group, and then add adjustments layers to it. The group should remain open at all times.
Further, collapsing a group with batchPlay can be done using:
await batchPlay(
[
// collapse current selected group
{
"_obj": "collapseAllGroupsEvent",
"_isCommand": true,
"_options": {
"dialogOptions": "dontDisplay"
}
}
],{});
I have built a function with which you can open and close a group. With the option “recursive” you can say if all subfolders should also be closed or opened.