Jump to content

PixelSearch


Arlen
 Share

Recommended Posts

I use PixelSearch a lot since many apps do not have any controls. My questions is, how can I skip the first PixelSearch result, since I know by a fact it's a false positive result. And continue to find the colour until it meets my criteria. I saw the FastFind.au3 post but didn't find it helpful and didn't know how to really use it 

Edited by Arlen
Link to comment
Share on other sites

I've never had good success with pixel search. Have you tried image search? Assuming the pixels don't change on the app it should find what you're looking for the first time. I'll provide a link to a post were I helped another user to get it working. I only use it when there isn't an arcpy function for ArcMap10.6. 

 

 

Link to comment
Share on other sites

When you find that first point, you can logically remove the top left area from your search.   you can then continue to run new searches in the remaining 3 quadrants

 

Edit...I think it goes a row at a time.   I'll need to review the help file.

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

Everyone thanks for the replay,  but I have found a solution for now to minimize false positive results:

$Pixel = PixelSearch(534, 54, 547, 69, 0xFFFFFF, 0, 1, $Handle) ;Check if available
    $Pixel2 = PixelSearch(922, 53, 934, 60, 0xFFFB62, 0, 1, $Handle) ;Double check
    If IsArray($Pixel) And IsArray($Pixel2) Then
        $Switch = 1
        Local $Coords = FileReadToArray(@ScriptDir & "\Coords.txt") ;Get coords list
        Local $Colour = FileReadToArray(@ScriptDir & "\Colour.txt") ;Get colour list
        For $i = 0 To UBound($Coords) - 1 Step 1 ;loop all coords

            For $s = 0 To UBound($Colour) - 1 Step 1 ;loop all colours with the fisrt coord and then do that same with the rest

                If StringLeft($Colour[$s], 1) = 0 And StringInStr($Coords[$i], ",") <> 0 Then ;check if valid coords and colour

                    $Split = StringSplit($Coords[$i], ",")
                    $Pixel = PixelSearch(($Split[1] - 50), ($Split[2] - 50), ($Split[1] + 50), ($Split[2] + 50), $Colour[$s], 0, 0, $Handle) ;Search for objective
                    If IsArray($Pixel) Then
                        MouseClick("", $Pixel[0], $Pixel[1], 1, 0) ;Click objective
                        ;Debugging Start
                        MsgBox(4096, "Debugging", "Color: " & $Colour[$s] & " Coords: " & $Coords[$i]) ;This is for debugging issues
                        ;Debugging End
                        Sleep(500)
                        ExitLoop 2
                    EndIf
                EndIf
            Next
        Next

 

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...