Bug unable to find image

When I run a particular script which launches Illustrator and then applies various effects to an object, the script always fails to find the images of the effect. However, if I close the document in Illustrator, select the main part of the script and click ‘Run Selection’, it always finds the images.

I added a few lines to the script to open a new doc, close it, then open a new doc again. Then the script runs just fine. It’s definitely something weird w/ Eggplant.

This sort of error is almost always due to a timing problem. In particular, the fact that you can run a selection which finds the image correctly immediately after the error, tells us that the image does match. So the problem is simply that Eggplant is looking for the image before the software-under-test (Illustrator, in your case) has finished doing the processing that will result in that image being visible on the screen.

Opening and closing a document, in your case, must affect the timing in some way such that the image appears on screen before Eggplant gives up on looking for it.

There are a number of ways to deal with timing issues (see the article “Failure to Find an Image that is On the Screen” in the Using Eggplant manual), but the most common is to use either the WaitFor command or the ImageFound() function, both of which allow you to specify how long Eggplant should keep looking for an image before announcing that it was unable to find the image.

I don’t think it’s a timing issue. I give it 20 seconds to find the image and I’ve upped that to 1 minute and it always failed.

Occasionally, the issue is more subtle – why don’t you send an email to support with the relevant portion of your script, along with the image that’s not matching and the Screen_Error.tiff file that’s generated when it fails, so we can help you figure this one out.