WAIT check frequency

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
crossedout
Newbie
Posts: 17
Joined: Sun Dec 21, 2008 6:58 am

WAIT check frequency

Post by crossedout » Sat Dec 27, 2008 6:15 am

Hello there. I've been very pleased with the help I've gotten from the forum not only from searching others questions, but also from posting my own questions. Thanks everyone.

My question now is:

I have been using the WaitScreenImage command and like it. It has really helped (I was using the command to wait till the rectangle has changed, but didn't work as well for me). Is there a way to increase the frequency that that image is checked, or to limit the area of the screen that is being checked.

I notice when it is waiting, you can see the mouse flash at a certain interval as if it is looking at that frequency. It would be good for my application to stop waiting as soon as the image pops up.

The number at the end is the adjust the color tolerance, correct?

Thanks again.
Brad


WaitScreenImage>test.BMP,0

gdyvig
Automation Wizard
Posts: 447
Joined: Fri Jun 27, 2008 7:57 pm
Location: Seattle, WA

WaitScreenImage, FindImagePos, and ScreenCapture

Post by gdyvig » Sun Dec 28, 2008 3:24 am

Hi Brad,

If there is a way to increase the frequency WaitScreenImage scans the screen, it is undocumented. Most of the time spend by this function is actually performing the scan. Whether it inserts a small delay between scans, I do not know.

The best way to increase the frequency is to decrease the size of the image file as much as possible while making sure it is still unique on the screen. This will decrease the amount of work it needs to do.

Another way is to build your own version of WaitScreenImage using FindImagePos and ScreenCapture in a loop. Other posts by Marcus say WaitScreenImage is simply these more basic functions in a loop. If you are sure the image you are looking for is in a small portion of the screen you can use ScreenCapture to limit your search to improve performance.

Yes, the second argument of WaitScreenImage is the color tolerance. Changing this will not make it work faster, but will improve reliability when there are variations in the screen display.

crossedout
Newbie
Posts: 17
Joined: Sun Dec 21, 2008 6:58 am

Post by crossedout » Mon Dec 29, 2008 5:44 pm

Thanks for the tip.

After some thinking, that's what I thought too.

I was thinking that making a comparebitmap loop would work for my application.

Basically, I'm trying to see if a "submit" button is ready to be pushed or if it is unavailable (greyed out). So, if it is grey, keep checking and comparing until the results are 100%. if they are 100% continue on with the rest of the script.

Does this sound like a feasible solution?

Thanks
Brad

gdyvig
Automation Wizard
Posts: 447
Joined: Fri Jun 27, 2008 7:57 pm
Location: Seattle, WA

Images to represent state of buttons.

Post by gdyvig » Mon Dec 29, 2008 6:25 pm

Yes, that is feasible and a good idea.

By distinguishing between different states of the button you can achieve better script synchronization. You may also want to add a counter so you can exit if neither state of the button is found.

Gale

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts