2 Replies Latest reply on Aug 17, 2011 4:10 AM by Muppet Mark

    SDK Photoshop CS5 : Get errors and continue task




      I have a script which applies any functions to contratct, expand, and any other ones...

      I have any thousands images to process. Sometines, there are images which can't be processed.

      I want to continue with the next image when there is a problem but to get the error and to know which image has a problem.


      How can I do that?


      Thanks a lot


      PS : sorry for my bad english...

        • 1. Re: SDK Photoshop CS5 : Get errors and continue task
          JJMack Most Valuable Participant

          In your loop that you process the image files make the actual process a function. Try it and catch any unexpected error and ignore it. Maybe something like this might work



          for (var i = 0; i < fileList.length; i++) {

                try { processImage(fileList[i]); } // try to process images files catch and ignore errors

                catch(e) { }



          Just a guess... You could also log errors (e + ': on line ' + e.line + " processing ffile: " + fileList[i] ) in the catch and after the last files is processed if there were errors list all the files that failed with the associated error messages.

          • 2. Re: SDK Photoshop CS5 : Get errors and continue task
            Muppet Mark Level 5

            JJ, this has been a much discussed topic in a couple of forums… At present you can't try/catch file opening errors… Some of the dialogs locks up the app and the only way to dismiss is with a system level script… Tom has said he will look into the way this will be handled in the future. I don't know if current/previous versions will get patched although I would doubt that… At least the Photoshop Scripting Team (or what ever they call themselves) listened and are going to do something about it… More than you get from some of the other app teams…