CompareBitmap or WaitRectChanged

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Posts: 1
Joined: Wed Feb 28, 2024 11:58 pm

CompareBitmap or WaitRectChanged

Post by Syteplait » Thu Feb 29, 2024 12:00 am

When I use "CompareBitmap," it returns a result with the pixel difference between 0 and 100. Is it possible to make it determine the specific area of the screen that has changed accurately?

Or, by using WaitRectChange, is there a way to precisely retrieve the area that has changed?

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1348
Joined: Sun Nov 03, 2002 3:19 am

Re: CompareBitmap or WaitRectChanged

Post by Dorian (MJT support) » Wed Mar 06, 2024 8:37 pm

There isn't, specifically with those commands, but you could use a combination of GetRectCheckSum and WaitRectChanged.

My approach would probably be to split the target area into a grid of squares or rectangles, and perform an initial scan with GetRectCheckSum. Then use WaitRectChanged on the target area to detect a change. Then re-scan your grid with GetRectCheckSum and compare the first results with the initial ones to see which area has changed.

If desired you can then capture any changed areas with ScreenCapture.
Yes, we have a Custom Scripting Service. Message me or go here

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