Skip to main content
Inspiring
May 23, 2013
Answered

Detect or Suppress Action errors during script automation

  • May 23, 2013
  • 1 reply
  • 4149 views

I've run into an issue with the automation of one of my Photoshop scripts where it can be completely halted by an error in a supporting action set.  The script does about 99% of the work, but the remaining 1% has to be done in an action due to the work being done (the work is NOT scriptable, or at least not efficient in the least to put to script).  The problem I'm running into is that, if there is an error in the layer name in the action, Photoshop pops up an alert about the issue, halting the whole process until I click the "Ok" button on said alert.

Is there any way to catch these errors (a simple try/catch on the action activation code doesn't work), or at least suppress the errors so they don't halt the entire process?  Catching the error so it can be reported via my current reporting method would be ideal, if possible.  Thanks in advance for any help!

Edit: Correction on the error type; it's not an "Ok" alert, it's a "Continue/Stop" alert.  The message accompanying it is "The object "layer "layerName"" is not currently available".  This happens if the person creating the action failed to rename the layer correctly before performing their work on it in the recorded action, and halts the entire automation process until I click continue or stop.

This topic has been closed for replies.
Correct answer xbytor2

I thinks its about 99% doable with action manager…

Actions are  (almost) 100% translatable to JavaScript with http://ps-scripts.cvs.sourceforge.net/viewvc/ps-scripts/xtools/xapps/ActionToJavascript.jsx.

The interface is real simple and it generates a .jsx file with a function for the action that you select. It's a direct translation to Action Manager-style code. You can insert a try/catch block in there as needed.

There are a couple of borderline cases that the script can't handle because the ActionDescriptor class (which the script uses) doesn't encode them.

1 reply

Inspiring
May 24, 2013

Have you script test the condition before calling the action…? 1% needs to be done by action explain why…?

If you are using the the standard DOM and you script is tooooo slooow (lots of layers) look to use action manager syntax instead…

If its recordable with PS action then… I thinks its about 99% doable with action manager… Dump your external resource…

xbytor2Correct answer
Inspiring
May 24, 2013

I thinks its about 99% doable with action manager…

Actions are  (almost) 100% translatable to JavaScript with http://ps-scripts.cvs.sourceforge.net/viewvc/ps-scripts/xtools/xapps/ActionToJavascript.jsx.

The interface is real simple and it generates a .jsx file with a function for the action that you select. It's a direct translation to Action Manager-style code. You can insert a try/catch block in there as needed.

There are a couple of borderline cases that the script can't handle because the ActionDescriptor class (which the script uses) doesn't encode them.

dgolbergAuthor
Inspiring
May 30, 2013

Interesting, never saw that before.  I'll try it out and see how I can work it into the workflow.


Sorry, been extremely busy with a sudden high-priority project, so I haven't had a chance to try this out yet.  I'll be sure to post my findings once I do though.  Just didn't want you guys to think I'd forgotten about this thread.