Arlen Posted September 19, 2018 Share Posted September 19, 2018 (edited) 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 September 19, 2018 by Arlen Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted September 19, 2018 Share Posted September 19, 2018 @Arlen Without seeing you code, it's not too easy to guess Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
aa2zz6 Posted September 19, 2018 Share Posted September 19, 2018 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. Arlen 1 Link to comment Share on other sites More sharing options...
jdelaney Posted September 19, 2018 Share Posted September 19, 2018 (edited) 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 September 19, 2018 by jdelaney Arlen 1 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 More sharing options...
Arlen Posted September 19, 2018 Author Share Posted September 19, 2018 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now