Sign in to follow this  
Followers 0
Phaser

Getting checksum value from area of window

4 posts in this topic

Hi everyone

I am trying to grab a pixelchecksum value from a specific area of a specific window, I wan tto use the value late for camparing

$output = PixelCheckSum( 726, 51, 782, 62, "Window Title" )
MsgBox(0,"",$output,1)

At the moment the number changes most of the time even if the window content hasn't, to test, I reduced the screen area measurements to look for ONE pixel and the value stayed the same which is perfect but when I set it to the size I want/need it goes mental.

Any idea how I can just get the value to be the same unless the content of the window changes?

Thanks in advance

Share this post


Link to post
Share on other sites



What is the window you are reading from? (Where does the window belong to? Is it DirectX/WPF/Java?)

PixelChecksum works, your capture area is probably changing by small bits (from 0x000000 to 0x000001 color).

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hi Manadar, thanks for the reply, I am trying to create a tool that will try to match a certain area of a document that gets scanned and opened as a .jpg looking in ONE specific area for a certain digit, A1 B1 C1 etc

So I tried saving all possible variations of the result to jpg files, no problem then tried using something I found on this forum

$sample = _ScreenCapture_CaptureWnd(@MyDocumentsDir & "\atest.jpg", $handle, 726, 51, 782, 62, False)
If FileRead($sample) = FileRead(@MyDocumentsDir & "\A1.jpg") Then
MsgBox(0,"The result is", "same", 1)
Else
MsgBox(0,"The result is", "different", 1)
EndIf

The above said it was different when trying to match the sample with the original, it should have said it was the same, so I am now trying pixelchecksum and having problems, I open the images in paint shop pro.

Is there anyway I can convert saved images to a value then check against them

Edited by Phaser

Share this post


Link to post
Share on other sites

You can "convert saved images to value" using file checksums, such as MD5 (Search the forum). Or you can store the pixel checksum (this should work!). It might be easier to write a simple OCR (or write your own pixel compare function with approximate match) if you're not afraid of arrays and math. ( Look in my signature, something about OCR or text reading. )

Are you sure that the images are actually exactly the same?

^ many parenthesis. : )

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0