2 Replies Latest reply on Aug 13, 2010 11:16 AM by xbytor2

    Error by user interference

    Ghoulfool Level 1

      Still learning scripting I've noticed that my scripts run fine, but if I accidentally click on another document whilst the script is running then this will throw the script out and it'll pop up an error. What is the best way around this - the obvious thing would be to isolate the script from any user interference but that may have propblems if it when into a loop. Any suggestions?

        • 1. Re: Error by user interference
          Michael L Hale Level 5

          Are you sure that is the cause of your error? You should not be able to interact with the Photoshop GUI( change documents ) when a script is running. At least not a javascript.

          • 2. Re: Error by user interference
            xbytor2 Level 4

            Actually, depending on the version of PS and what platform you're on (and platform specific focus policy) it can be pretty easy to change the 'active' document via the UI inadvertently while a script is running. It has caused me all kinds of grief over the years with scripts like CSX. As a result, I add code to repeatedly make sure that the active document is the one that I expect it to be. And CS5 introduced yet another problem for CSX that took a few days to work around.

             

            The safest thing to do is move the mouse cursor away from PS while your script is processing if you are seeing the active doc change unexpectedly.