Skip to main content
Inspiring
December 1, 2019
Answered

Stepping backward into a group in a Photoshop action

  • December 1, 2019
  • 2 replies
  • 1016 views

I'm writing a Photoshop action that is supposed to select one of the layers inside a group.  At the point where this happens, the group itself is selected and its contents are collapsed.  Using the shortcut alt-[ ("select backward layer") steps OVER the group so that the layer below the group is now selected.  But I want it to step INTO the group.  Alt-[ steps into the group if the contents are expanded, but I have no way of controlling whether the group is expanded or collapsed.  Clicking on the arrow next to the group to expand is not recorded. Is there a way to do this? 

This topic has been closed for replies.
Correct answer JJMack

Action have a hard time dealing with documents with duplicate Layer names and duplicate layer group manes.  Even if you know the document layers structure it can be difficult selecting  Layer relatively recording shortcuts Alt+,   Alt+. Alt+[ and Alt+]  these shortcuts only select layers that have their visibility on in the layer stack.  Not only does the action require a document with a particular layer stack structure only the visible layers can selected via the shortcuts.  If the document gets alters  they may have layers added, deleted or visibility changes.  The action will likely fail to work correctly. 

 

Actions and Script that process existing files normally depend on document having something the actions or script was created to process.  Actions can not use logic without using some scripting to do a process that requires  the use of Logic.  Like menu File>Automate>Fit Image...  Adobe Plug-in script will record the width and  height number of pixels the image needs to fit within into the Actions step.  When the Action step is played the action player will pass the width and height to the script.  The script will retrieve the Document current width and height then calculate a constrained resize to fit within the width and height pass by the action player.  

 

If you want to be able record action to do some complex processing you need to learn a little scripting.

 

Crafting Actions Package UPDATED Aug 10, 2014 Added Conditional Action steps to Action Palette Tips.
Contains

Example
Download

 

2 replies

Stephen Marsh
Community Expert
Community Expert
December 1, 2019

If you take some time to search the web, this is a common request without an easy to find scripting solution, as there is no basic method or action manager code for this task. I looked through my script repository and this came up (not sure where it originally came from):

 

// Expand all layer sets
function openAllLayerSets( parent ){  
    for(var setIndex=0;setIndex<parent.layerSets.length;setIndex++){  
        app.activeDocument.activeLayer = parent.layerSets[setIndex].layers[0];  
        openAllLayerSets( parent.layerSets[setIndex]);  
    }  
};  
openAllLayerSets( app.activeDocument );

 

It does not appear to work if there are empty sets.

 

As I only hack at JavaScript, I have not worked out how to change the code for only the active set.

Stephen Marsh
Community Expert
Community Expert
December 1, 2019

It is always a good idea to record an explicit unique name in actions. If you have recorded an explicit and unique name, then you can select the layer by name in the action, which will expand the collapsed group and select the layer.

 

Otherwise, you may need to use a helper script.

J IsnerAuthor
Inspiring
December 1, 2019

I just finished converting the action to select layers stepwise for precisely the reason that there are duplicate layer names.  In this particular action, duplication is unavoidable. 

 

If I knew how to write scripts, I wouldan't be writing actions!  I should take some time and learn the scripting language.

Chuck Uebele
Community Expert
Community Expert
December 1, 2019

That's why I learned to write scripts: actions are just too limited.