Repeated Code Randomly Failing...

Hi All,

Having a bit of a problem with the following code:

waitFor 200,currOS&"/MenuItems/Options_Menu"
click foundimagelocation()
waitFor 200, currOS&"/MenuItems/SubMenus/004DataCheck"
click foundimagelocation()
wait .5
waitFor 200,currOS&"/MenuItems/SubMenus/DataCheck/004FileMaintenance"
click foundImageLocation()
wait.5

If I have my script repeat this code say 500x One of the following things happens:

a)The script fails to find the second image on the first try through
b) The script waits until about iteration 250-350 and fails to find the second image.

I’ve ensured that:
a) All images are set to Text tolerance
b) Typing each command into the ad-hoc command line locates things as necessary
c) As you can see, I switched from searching for the image to waiting for it
d) Increasing the remote work interval

Any hints?

Allen

Allen,

Are you able to see the image in the screen_error.tiff (the full screen shot captured by Eggplant at the time your script failed)? If the image being searched for is visible within this screen shot, the only thing that comes to mind right off the bat is that the image in question is being rendered differently at certain times. If you have access to Photoshop elements or Graphic converter you could perform an image analysis to compare both of these images to find out whether or not they match.

Comparing images using Photoshop Elements:

  1. Open the Screen_Error.tiff file in Photoshop Elements.
  2. Open the image that wasn’t found.
  3. Do a select all and copy on that image.
  4. Paste the search image into a new layer on the Screen_Error image and do a rough alignment of the two.
  5. Using the magnifying glass tool, drag-select the area that you’re interested in to blow it up so that you can see individual pixels (I shoot for 1200%).
  6. Use the Blending Mode popup at the top of the Layers pallette to set the mode of the top layer to “Difference”.
  7. Click the “Move” tool and use the arrow keys to nudge the top layer into alignment with the Screen_Error layer.

At this point, most of the pasted image should appear to be black. Any lighter colored pixels represent pixels that don’t match the underlying pixels. The lighter the pixel, the more different it is. You can move the cursor over the pixels and watch the “info” panel to see how much variance there is. Black ( r:g:b = 0:0:0 ) represents a perfect match; a r:g:b value of 43:65:18 indicates that that pixel differed by 43 shades in the red channel, 65 in the green channel, and 18 in the blue channel. So if you were to increase the matching tolerance to 65 for this image – the greatest difference for that pixel – Eggplant would be able to find it (assuming no pixels were even further from a match).

As I mentioned before, you can also accomplish this within Graphic Converter. However, it’s a bit more cumbersome to align the images since Graphic Converter can only compare (within GC goto Edit:Compare Pictures) pictures of the same size.

If you do not possess any of these applications (i.e. Photoshop Elements or Graphic Converter), you can also send your image and the screen_error.tiff to support@redstonesoftware.com. We can analyze your images for you. Finally, please forward any further concerns in regard to this issue via email.

Thanks Allen!