3 Replies Latest reply on Jan 29, 2017 3:15 AM by Chuck Uebele

    how to check and bypass an error in scripts....

    spaciousmind Level 1

      Hey guys, I've decided to go back and clean up some of the scripts that I use on a regular basis to make them more useful.
      I'm sure this is a simple thing but I just don't know how to do it.

      So I have a script to save out an image in various sizes/formats/whatever

      Theres a specific error I encountered today in the following line of code:

      activeDocument.trim(TrimType.TRANSPARENT,true,true,true,true);

       

      After looking into it I found that if there aren't any transparent parts in my image then it stops right there and won't execute the rest of my script.
      if I delete that line out it executes just fine.

       

      I want to keep that line in my script for the instances when there are transparent pixels.
      How would I go about checking to see if that line of code applies, and if it doesn't, then to simply skip over it and process the rest of the script without it?