Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

skip command if function is unavailable?

Guest
Aug 30, 2013 Aug 30, 2013

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)

TOPICS
Actions and scripting
801
Translate
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

Deleted User
Aug 30, 2013 Aug 30, 2013

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

Translate
Adobe
Guest
Aug 30, 2013 Aug 30, 2013

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

Translate
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
Community Expert ,
Aug 30, 2013 Aug 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
Translate
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
Guru ,
Aug 30, 2013 Aug 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.

Translate
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
Community Expert ,
Aug 30, 2013 Aug 30, 2013
LATEST

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
Translate
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