PixelChecksum() - Generates checksum for a region of pixels

Post your working scripts, libraries and tools
User avatar
SKAN
Posts: 310
Joined: 29 Sep 2013, 16:58

PixelChecksum() - Generates checksum for a region of pixels

31 Aug 2014, 19:00

Code: [Select all] [Expand] [Download] (PixelChecksum.ahk)GeSHi © Codebox Plus



Test:

Code: [Select all] [Download] (Test_PixelChecksum.ahk)GeSHi © Codebox Plus

; Example - Wait for a Screen Region to change

ChkSum := PixelChecksum( 0,0,32,32 )

While % ( ChkSum = PixelChecksum( 0,0,32,32 ) )
Sleep, 100
MsgBox, Screen Region Change Detected!
User avatar
joedf
Posts: 5931
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada, Quebec
Contact:

Re: PixelChecksum() - Generates checksum for a region of pix

31 Aug 2014, 19:06

Speed tests? :o
User avatar
SKAN
Posts: 310
Joined: 29 Sep 2013, 16:58

Re: PixelChecksum() - Generates checksum for a region of pix

31 Aug 2014, 19:25

joedf wrote:Speed tests? :o


Not yet, only tested for leaks. Got tired of toggling between XP, Win 7, Win 7 x64, Win 8.1, Win 8.1 x64.
It is an old function I wrote ( and forgotten ) and today there was a request for x64 compatibility.

Note: Speed can be improved if CAPTUREBLT is avoided and BPP is set to 16.
User avatar
joedf
Posts: 5931
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada, Quebec
Contact:

Re: PixelChecksum() - Generates checksum for a region of pix

31 Aug 2014, 20:24

Ahh I see... What is CAPTUREBLT, if I may ask? :)
User avatar
SKAN
Posts: 310
Joined: 29 Sep 2013, 16:58

Re: PixelChecksum() - Generates checksum for a region of pix

31 Aug 2014, 20:30

joedf wrote:Ahh I see... What is CAPTUREBLT, if I may ask? :)


I am myself not clear, but I guess with CAPTUREBLT, BitBlt will see a semi transparent layered window covering the target area.
User avatar
joedf
Posts: 5931
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada, Quebec
Contact:

Re: PixelChecksum() - Generates checksum for a region of pix

31 Aug 2014, 20:47

Ah ok, so if I understand correctly, this is only for Aero/transparent-window supported OS?
guest3456
Posts: 2051
Joined: 09 Oct 2013, 10:31

Re: PixelChecksum() - Generates checksum for a region of pix

01 Sep 2014, 02:26

joedf wrote:Ah ok, so if I understand correctly, this is only for Aero/transparent-window supported OS?


no, the bitblt call should work even with the dwm (aero) disabled

User avatar
joedf
Posts: 5931
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada, Quebec
Contact:

Re: PixelChecksum() - Generates checksum for a region of pix

01 Sep 2014, 03:30

Ah ok..
durschtnase
Posts: 3
Joined: 11 Sep 2014, 11:50

Re: PixelChecksum() - Generates checksum for a region of pix

11 Sep 2014, 11:56

first of all.. great script!

but cant get this to work within an #IfWinActive block
the checksum is always different the second time
without such an block its fine

any ideas?
guest3456
Posts: 2051
Joined: 09 Oct 2013, 10:31

Re: PixelChecksum() - Generates checksum for a region of pix

11 Sep 2014, 13:16

guest3456 wrote:
joedf wrote:Ah ok, so if I understand correctly, this is only for Aero/transparent-window supported OS?


no, the bitblt call should work even with the dwm (aero) disabled


actually upon further thought, i'm not completely sure about this, best to test

User avatar
SKAN
Posts: 310
Joined: 29 Sep 2013, 16:58

Re: PixelChecksum() - Generates checksum for a region of pix

11 Sep 2014, 14:27

durschtnase wrote:first of all.. great script!


Thanks. Welcome to the forum. :)

cant get this to work within an #IfWinActive block
the checksum is always different the second time


Can you post a snippet for me to work/test with?
durschtnase
Posts: 3
Joined: 11 Sep 2014, 11:50

Re: PixelChecksum() - Generates checksum for a region of pix

11 Sep 2014, 18:43

of course! here it is:

Code: [Select all] [Expand] [Download] (Script.ahk)GeSHi © Codebox Plus



Win+O to activate the timer
comment out the #IfWinActive at the beginning and at the end and you get different behavior

commented out:
- after pressing Win+O and moving an icon into the topleft corner of the desktop i get the MsgBox

not commented out:
- after opening and activating notepad i press Win+O and get the MsgBox without moving something to the topleft corner

hope you can reproduce this behavior

p.s.: when i specify a window title as 5th parameter to your function this problem does not occur
User avatar
SKAN
Posts: 310
Joined: 29 Sep 2013, 16:58

Re: PixelChecksum() - Generates checksum for a region of pix

11 Sep 2014, 18:56

durschtnase wrote:p.s.: when i specify a window title as 5th parameter to your function this problem does not occur


Problem solved then!. Simply pass ahk_id as the 5th parameter!

:?:

Edit:

Something like this ( untested )

Code: [Select all] [Expand] [Download] (Script.ahk)GeSHi © Codebox Plus

durschtnase
Posts: 3
Joined: 11 Sep 2014, 11:50

Re: PixelChecksum() - Generates checksum for a region of pix

11 Sep 2014, 19:03

yap..
thanks for having me write this snippet.. thats when i tried and found out ;)
though a bit strange behaviour ;)
peter

Re: PixelChecksum() - Generates checksum for a region of pixels

09 Jun 2016, 16:04

Hi,
I am trying the code you have provided and it acts all random. For example, I am monitoring a part of a still screenshot. Each time the check sum turns out to be different yet nothing changes. :?:

Return to “Scripts and Functions”

Who is online

Users browsing this forum: Kellyzkorner_NJ, Randy31416 and 15 guests