Bitmap Check versus Text Check

To confirm that bitmap check takes twice as long to perform as a text check (not to mention the annoying beeping noises), run the following code.

    public function check_text () {
        auto text;
        start_transaction ("text");
        while ( ( ( obj_get_text ("Edit", text, 55, 16, 87, 33 ) == E_OK ) ?
            ( ( text == "abc"    ) ? E_OK : 1 ) : 1 ) != E_OK )
        {}
        end_transaction ("text");
    }

    public function check_bitmap () {
        start_transaction ("bitmap");
        while (obj_wait_bitmap("Edit", "Img1", 0, 54, 16, 31, 17) != E_OK)
        {}
        end_transaction ("bitmap");
    }

    set_window("Untitled - Notepad");
    check_text ();
    check_bitmap ();

You'll need to use the "Get Text - Area" button on the same floating toolbar to create the obj_get_text () command. Then get the bitmap first using the "Wait Bitmap - Area" button on the floating toolbar. Reduce the timeout value to 0. Wrap the two recorded commands into functions, and you're set.

As shown in the picture below, the bitmap check takes longer than the text check. You may repeat this several times to be sure. I'm running this on a Pentium 200 MMX computer with 96 MB of physical ram, by the way.

This particular run shows that the text method takes only 0.56 seconds, while the bitmap method takes 3.13 seconds. If you want to squeeze some more speed out of the routine, go into the WinRunner option menu, and set the Timeout, Delay, and Redraw values to 0. When you rerun the script again, I'm getting a value of 0.55 for the text method, and 2.45 seconds for the bitmap method.

If you were to save the two functions as a compiled module, and load them as system modules, you might eke out a little more speed out of the functions, but the conclusion is still the same.

Once again, go with text checks if you can.

 

back


Tech Page @ itechnologist.com