Table of contents
You may sometimes find that the bitmap searching or OCR searching function works well on your development environment but it fails when you export the script onto your probes.
Here are some possible causes.
Case 1: Screen color and resolution
The first thing to which you need to pay attention is the screen color and resolution.
In fact, bitmap searching is based on searching zone restrictions (if you defined a restriction zone) and pixel comparsion. If screen scales are different between development machine and probe machine, you may get searching failure.
Here's an example that screen resolution may cause bitmap searching failure :
On a 1024*768 screen, we created our bitmap searching function with Script Wizard to search for "Cancel" button on the Chrome pop-up. We defined a restriction zone on that pop-up (c.f. the following image).
We changed the screen resolution to 1152*864 and re-edit the same function. Here you can see:
The "Cancel" button is now out of the restriction zone.
You may ask: If I don't use restriction on my searching, it would be OK to have different resolutions, no ?
The answer is NO. You will still need to pay attention to screen resolutions.
Here's another example:
If you take a close look at the following two bitmaps (first one is captured on 1920*1080 resolution, second one is captured on a 1152*864 resolution on the same machine), you may find that pixels' colours and even numbers of pixels are different from one and another.
This proves well that screen resolution may have impact on bitmap searching or sometimes OCR searching (if pixels' color are much modified. To reduce the impact, please check the next section : 1.2 Cleartype option and font smoothing) even without restriction zone.
You may use the following code to save bitmap search result in order to compare :
SetArgInt("Bitmap.KeepTempFile", 1)
Note: Screen resolution may change when you use a remote connection tool.
Solution(s)
We suggest you to set the same resolution on all your Newtest machines (NTBR or Robot machines) and use a VNC viewer for remote connection. Normally VNC viewer does not change screen display or resolution during remote connections (some of them may change slightly color display).
Case 2: Cleartype option and font smoothing

Solution(s)
- Disable Cleartype
Uncheck "Turn on Clear type" and click on "Next" directly until "Finish" button apears and finish your modification.
- Disable font smoothing
You may disable font smoothing trough Control Panel -> System and Security -> System -> System protection -> Advanced -> Performance Settgins or you may search directly "performance" in windows menu and click on proposed "Adjust the appearance and performance of Windows".
Uncheck the "Smooth edges of screen fonts" option and click on "OK" button to confirm the change.
Comments