How to toggle visibility of groups when reorganising layers

Adobe Community Professional ,
May 10, 2021 May 10, 2021

Copy link to clipboard

Copied

An action that organises layers in groups has very different behaviour if a group is toggled open or closed. If a group above a layer is closed moving a layer upp will skip the group, but if the group is toggled open then the layer will be moved to the bottom of that stack. I am not finding a command that will reliably open or close a group so that the action can be guaranteed to give consisten result. How do others ensure that a layer is placed in above or below a specific layer. Changing layer order gives sets the layer to a layer number, I want it to be above or below a specific layer in a group. Please advise.

TOPICS
Actions and scripting

Views

2.0K

Likes

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 1 Correct Answer

Adobe Community Professional , May 11, 2021 May 11, 2021
for(i = 0; i < (lrs = (aL = (aD = activeDocument).activeLayer).parent.layers).length; i++) { if (lrs[i] == aL) {i && aL.move(lrs[i - 1], ElementPlacement.PLACEBEFORE); break} }

Likes

Translate

Translate
Adobe Community Professional ,
May 10, 2021 May 10, 2021

Copy link to clipboard

Copied

Did find a workaround, in how I crated the script. There is an option to "Collapse all groups" option in from the layers panel which means there is an absolute state to return to. Also if you select a named layer inside a group the group will expand.

 

My problem when recordin the script is that I was initially creating the "layer structure" by creating empty groups and then trying to fill them. Switching the workflow to first create the named layers and then group them got around the limitation of "expanding" empty groups so that layers can be placed inside these groups.

What is possible in a manual workflow isn't allways recordable.

(Did notice another "bug" and that is that the black and white filter was not always recording all values. I had to repeatedly record the adjustment and double check that all values actually stuck… but I guess that needs another thread)

Likes

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
Adobe Community Professional ,
May 11, 2021 May 11, 2021

Copy link to clipboard

Copied

Lukas, did you log both bugs on  the https://feedback.photoshop.com ?

Likes

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
Adobe Community Professional ,
May 15, 2021 May 15, 2021

Copy link to clipboard

Copied

Likes

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
Adobe Community Professional ,
May 11, 2021 May 11, 2021

Copy link to clipboard

Copied

 

for(i = 0; i < (lrs = (aL = (aD = activeDocument).activeLayer).parent.layers).length; i++) {
	if (lrs[i] == aL) {i && aL.move(lrs[i - 1], ElementPlacement.PLACEBEFORE); break}
}

 

Likes

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
Adobe Community Professional ,
May 15, 2021 May 15, 2021

Copy link to clipboard

Copied

@Kukurykus Not sure how to use the code… I guess it is JavaScript? Are groups treated differently there? I don't know how this could help in recording actions.

Likes

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
Adobe Community Professional ,
May 15, 2021 May 15, 2021

Copy link to clipboard

Copied

Save my code to MoveOverGroup.jsx in Presets / Scripts of your Ps folder and (re)launch Ps.

Add a shortcut to MoveOverGroup item from File / Scripts menu by Edit / Keyboards menu.

(Or better create an Action and Insert Menu Item to it from File / Scripts named like the file)

To use it first select a layer that's under (un)open group. It's going to be moved over layerSet.

Likes

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
Adobe Community Professional ,
May 15, 2021 May 15, 2021

Copy link to clipboard

Copied

Ok. So using Javascript as part of an action could work, except it makes it more complex to share the and explain how to use the script as it becomes dependent on the jsx.

 

Thank you for the information, did not realisera that jsx files could be used this way. I ended up creating and naming layers before grouping, and in that way work around the problem.  

Likes

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
Adobe Community Professional ,
May 15, 2021 May 15, 2021

Copy link to clipboard

Copied

LATEST

It may be complex for the 1st time seeing it but that solves your problem, doesn't it? If actions could do everything you want then scripts were not needed, but as long as actions are simple version for scripts you must use workarounds, otherwise each next time you'll have to name sets by hand before playing actions. Would you keep doing it rather than using this script?

Likes

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