Fri, 28 Apr 2006

Redraw delay in Photoshop script.

— SjG @ 11:11 am

I’ve been working on a script to do a bunch of crazy manipulation of images in Photoshop. Basically, it sequentially opens all the image files in a directory, and displays a dialog box requiring user interaction to determine what to do with the image.

I was having the problem that the dialog box would come up before the image could redraw (in the case of large images), so the user would be asked what to do, but would be unable to see the image in question. This, of course, doesn’t work.

I tried writing delay code, to no avail. I had a very hard time finding help, because I didn’t know what search terms to use. None of “delay,” “repaint,” “refresh,” “sleep,” and “wait” yielded anything useful when combined with”Photoshop” and “Javascript.”

Finally I found this posting by Tom Hart in the Adobe forums, where he provides a function called WaitForRedraw which solves the exact problem!

Here’s a link to Tom’s Posting.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.