Table of Contents

Using Image of Text as a Lookfor

It is perfectly legitimate to use an image of static text as a lookfor. However your application may require you take some things into consideration.

Changing how text renders

It is possible to change how text displays using c.MachineSettings.DisableClearType. This will make the display ugly so if you care about that, then you can back this setting out by calling c.MachineSettings.EnableClearType.

Note this is dependent on the target application respecting this request. You also must call c.MachineSettings.DisableClearType before you launch the target application. Note that not all applications, especially those using browser technlogy (either browsers themselves or embedded browsers) likely won't change their text rendering.

Text colors change when the screen is resized

In this case the change is not visible to your eye, but zoomed in the colors that make up the text could change based on where its rendering on the screen within the X axis. If you zoom in on text and you see its uses different colors to make up what you thought was black text, there is a greater than zero chance if that text moved left or right, it could change what some of those colors are. For example a blue-ish pixel could become yellowish. In this case the changes are too great to be handled by setting color depth.

What you learned is the size of the window matters.

You will also want to set the size of the window using: ActivatePosition. You can learn this command for the current size of the window by bringing the target application into the foreground and using Ctrl+Alt+W. The command will be in the clipboard.

You can also use any given ContentObject's ActivatePosition method. Note you can set ScreenSizeRectString using the Test Lookfor in ContentObject Editor or the Test Activate like in the ContentObject List Properties tab (click save to set the property).

If content moves however even if the is sized, then Edit LookFor Mask Fringing can help by masking common color fringing but it cannot mask where pixels currently aren't fringed yet.

To handle this by using the Add Difference Map Mask feature in the Compare window. Note that you may need more than one iteration. The process is:

  • Build the ContentObject as normal
  • Make the text move
  • Test the Lookfor - if the test fails - follow the prompts for doing a Compare. Line up Compare Image so that the Difference Map shows as much of the text pixels as possible. Note that increasing the color depth to around 100 is a good idea as well. Once lined up, click Add Difference Map Mask
  • Test the Lookfor again - this time it will work. Then make the text move again - repeat till testing always succeeds
Solid Black text on white background

If the screen has any large areas of black, then solid black text will be found within them. Imagine if you could paste text into that area, you wouldn't see it. In this case you need to add a small amount of the background color to your Lookfor, however this will be automatically masked when you drew the Lookfor.

Use the Draw Remove Mask feature and very carefully draw to remove a few pixels of the mask from the upper left of the Lookfor, then Test. Pay attention to the status bar, there's an indicator of how fast the test proceeded. Your looking for this to be under 400. In general, the more background color included in a Lookfor, the slower it will be.