Skip to main content
August 30, 2013
Answered

skip command if function is unavailable?

  • August 30, 2013
  • 3 replies
  • 830 views

Hi,

I was wondering if anyone could help.

I am trying to write a code which uses selections within it the problem is with the "smooth"command. If the image for some reason has a selection that is 100% of the image then the smooth command is unavailable which causes the script to stop working.

Does anyone know of a way to skip something if it is unavailable or any kind of workaround to it?

Kai

(i am using photoshop CC incase that makes a difference)

This topic has been closed for replies.
Correct answer

Anyway i got it just use put the script between try and end try

3 replies

Inspiring
August 30, 2013

There are several selection commands that cause errrors if the entire layer is selected. If you don't want to use a try/catch block you could compare the selection bounds to the document bounds.

JJMack
Community Expert
Community Expert
August 30, 2013

However a selection bounds could be equal to the a document canvas bounds and not be a problem. Bounds are rectangles selection can be any shape.

JJMack
JJMack
Community Expert
Community Expert
August 30, 2013

When you know something may fail because some condition may exist. A way to handle something like that is with a try and catch errors. You can have special code to handle specific errors or ignore them and just continue processing.

JJMack
Correct answer
August 30, 2013

Anyway i got it just use put the script between try and end try