Jump to content

PixelSearch bottom-to-top


Recommended Posts

Hi all!

I've been using PixelSearch to do some suff here... and I realized it searches pixels from the top to the bottom of the screen.

"The search is performed left-to-right, top-to-bottom and the first match is returned." - Help File on PixelSearch

I wonder if there is any way to change it, and start the search from the bottom. I looked for it here in the forums and in the help file, but didn't find anything...

Thanks for the help

Edited by lucasdnd
Link to comment
Share on other sites

I haven't tested this, but would something like this work?

OK, I couldn't help it, I tested it, and made some changes. Seems to work.

$aPix = _PixelSearchRev(0, 0, @DesktopWidth, @DesktopHeight, 0xFFFFFF)
If Not @error Then
    MsgBox(0, "Return", $aPix[0] & ", " & $aPix[1])
EndIf

Func _PixelSearchRev ( $left, $top, $right, $bottom, $color, $shadeVar = 0, $step = 1 )
    Local $i, $j, $aRet
    For $i = $bottom To $top Step -1
        For $j = $right to $left Step -$step
            $aRet = PixelSearch( $j, $i, $j, $i, $color, $shadeVar )
            If Not @error Then
                Return $aRet
            EndIf
        Next
    Next
    SetError(1)
EndFunc
Edited by bluebearr
BlueBearrOddly enough, this is what I do for fun.
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...