Jump to content

Notify when any pixel OTHER THAN black is in a screen region.


Recommended Posts

I have a region of the screen that is pure black (0x000000), and I want to know if within that region, anything other than black shows up. I tried this...

PixelSearch(0,0,20,20,0xFFFFFF,254)

...thinking it would look for all the shade variations from pure white EXCEPT 255, which would be black right? But that didn't work...

Any ideas? Thanks in advance!

Link to comment
Share on other sites

If the region is always the same size and colow, it will always have the same checksum from the PixelChecksum() function.

Once you know what that checksum is, you can continually re-poll that region every so often to see if the checksum changed.

Edited by evilertoaster
Link to comment
Share on other sites

If the region is always the same size and colow, it will always have the same checksum from the PixelChecksum() function.

Once you know what that checksum is, you can continually re-poll that region every so often to see if the checksum changed.

The region is the same size, however the position changes throughout the window (the position will ALWAYS be the same distance from the current X,Y position). I tried using a CheckSum but it always gives a different answer (I assumed because the position changed, though the pixels don't).

I'll try CheckSum again, but I keep thinking there must be a way to use sort of an "anti-PixelSearch" that will look for anything EXCEPT a certain color.

Thanks

Edited by quacky
Link to comment
Share on other sites

I stand corrected-

http://www.autoitscript.com/forum/index.php?showtopic=64308

It appears checksums will not match up... (which seems odd...maybe this is addressed by a UDF somewhere)

Also this question was asked before but not anserwed publicly- http://www.autoitscript.com/forum/index.php?showtopic=64453

maybe if you contact cageman he'll tell you how he did it...

edit: in practise, i have no problem getting the checksums to match. The issue appears moreso to be that they don't match on a different computer or graphics card or somthing. Sequential checksums taken seconds after eachother don't seem to change...

Edited by evilertoaster
Link to comment
Share on other sites

I stand corrected-

http://www.autoitscript.com/forum/index.php?showtopic=64308

It appears checksums will not match up... (which seems odd...maybe this is addressed by a UDF somewhere)

Also this question was asked before but not anserwed publicly- http://www.autoitscript.com/forum/index.php?showtopic=64453

maybe if you contact cageman he'll tell you how he did it...

edit: in practise, i have no problem getting the checksums to match. The issue appears moreso to be that they don't match on a different computer or graphics card or somthing. Sequential checksums taken seconds after eachother don't seem to change...

Thanks! I'll follow that lead.

Link to comment
Share on other sites

I stand corrected-

http://www.autoitscript.com/forum/index.php?showtopic=64308

It appears checksums will not match up... (which seems odd...maybe this is addressed by a UDF somewhere)

Also this question was asked before but not anserwed publicly- http://www.autoitscript.com/forum/index.php?showtopic=64453

maybe if you contact cageman he'll tell you how he did it...

edit: in practise, i have no problem getting the checksums to match. The issue appears moreso to be that they don't match on a different computer or graphics card or somthing. Sequential checksums taken seconds after eachother don't seem to change...

I figured it out... my original thought using PixelCheckSum worked... I just rechecked my coordinates, and I was off by 10 pixels. :) Thanks to those of you who offered suggestions!

Link to comment
Share on other sites

Actually your idea using PixelSearch() with a shade variation works, it was just backwards. Here I made a black square in Photoshop, tested, then added one white square in the middle..

First run - No match

Second run - Match

$result = PixelSearch(884,199,1094,408,0xFFFFFF,254)
If NOT @ERROR Then
    ConsoleWrite("MATCH FOUND")
Else
    ConsoleWrite("NO MATCH FOUND")
EndIf
Link to comment
Share on other sites

  • 4 months later...

Actually your idea using PixelSearch() with a shade variation works, it was just backwards. Here I made a black square in Photoshop, tested, then added one white square in the middle..

First run - No match

Second run - Match

$result = PixelSearch(884,199,1094,408,0xFFFFFF,254)
If NOT @ERROR Then
    ConsoleWrite("MATCH FOUND")
Else
    ConsoleWrite("NO MATCH FOUND")
EndIf

hmmm this is not work mate! can u make bedder one i want full script to find black color if find color or not i get error like that i found color or if not found i not found that color.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...