Sign in to follow this  
Followers 0
GacekSSJ4

Improved PixelSearch

1 post in this topic

Hello everyone.

I found about autoit about 2 days ago. And rly like the idea of it. It's really simple to use.

I saw "Advanced Pixel Search Library" and i know its 1000% better than this. but thats not the point - point of this script is ease of use and deployment.

Now, I would like to share with you my first function, which i think, may find useful, or very useful for some.

What is it good for? For searching buttons in some kind of color when there are similiar colors around

Func getHash() ; useful to get hash of pixels surrounding our desired pixel
    Local $x = 37
    Local $y = 223
    $checksum = PixelChecksum($x, $y, $x+3, $y+3)
    MsgBox(1, "hash", $checksum )
EndFunc

$coords = searchPixelWithHash (7, 145, 103, 241, 0xF70000, 1002514199 ) ; example call.
MsgBox(0, "OUR MACH IS: ", $coords[0] & ' - ' & $coords[1])

Func searchPixelWithHash ($left, $top, $right, $bottom, $color, $hash, $shade = 0, $step = 0)
    $checksum = ''
    
    If $left > $right Then
        return False
    EndIf
    
    If $top > $bottom Then
        return False
    EndIf
    
    
    
    
    While $checksum <> $hash
        $coords = PixelSearch( $left, $top, $right, $bottom, $color, $shade, $step )
        MsgBox(0, "Current found pixel coords are", $coords[0] & ' - ' & $coords[1])
        
        $checksum = PixelChecksum($coords[0], $coords[1], $coords[0]+3, $coords[1]+3)
        
        $left = $coords[0] +1
        $top = $coords[1] +1
        
        MsgBox( 0, "Hash", $hash & " - " & $checksum )
    WEnd
    
    return $coords
    
EndFunc

Left MsgBox for testing purpouses if somone would be interested. Better remove it in real script.

There is also a file attached this script was performing tests on. Example call should find coordinates of lowest red pixel.

Any comments appreciated - would like to know if someone finds it cool, usless or just have any thoughts :unsure:

Untitled-1.bmp

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