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