#3977 closed Bug (No Bug)
Return problem by PixelSearch/PixelGetColor
Reported by: | anonymous | Owned by: | |
---|---|---|---|
Milestone: | Component: | AutoIt | |
Version: | 3.3.16.1 | Severity: | None |
Keywords: | Cc: |
Description
I've found a problem where I don't think the wrong coordinates are coming from the pixel color functions.
I look for a red pixel on the screen and then move the mouse there. Then I make a tooltip with the coordinates and the color code. There is a difference between the two values! That's why I opened the AutoIt Windows information window. The pixels specified in the tooltip match, but the color codes do not. The red pixel you are looking for is not under the mouse cursor. Therefore there seems to be an error when returning the PixelSearch/PixelGetColor object.
#include <MsgBoxConstants.au3> AutoItSetOption ( "PixelCoordMode" ,1) AutoItSetOption ( "MouseCoordMode" ,1) ; Find a pure red pixel in the range 0,0, 1450,770 Local $aCoord = PixelSearch(0, 0, 1450, 770, 0xFF0000) If Not @error Then MouseMove($aCoord[0],$aCoord[1]) ToolTip("X and Y are: " & $aCoord[0] & "," & $aCoord[1], 0, 0) EndIf Sleep(1000) ;Check result again Local $aCoord = MouseGetPos() $color = PixelGetColor($aCoord[0],$aCoord[1],1) $sString = Hex($color,6) ; Convert the hex string back to the original string. ToolTip("X and Y are: " & $aCoord[0] & "," & $aCoord[1] & " with color: #" & $sString, $aCoord[0]+10,$aCoord[1]+10) Sleep(500)
Attachments (1)
Change History (2)
Changed 13 months ago by anonymous
comment:1 Changed 13 months ago by Jos
- Resolution set to No Bug
- Status changed from new to closed
Please post this in the forum so we can have a discussion on it first as there are some things to discuss.
Closed for now until we have figured out what is happening.
This script helps you to debug, where you will see that the mouse pos is 1 pixel next to the found pixel
#include <MsgBoxConstants.au3> AutoItSetOption("PixelCoordMode", 1) AutoItSetOption("MouseCoordMode", 1) ; Find a pure red pixel in the range 0,0, 1450,770 Local $aCoord = PixelSearch(0, 0, 1450, 770, 0xFF0000) If Not @error Then Local $color = PixelGetColor($aCoord[0], $aCoord[1], 1) ConsoleWrite("> X and Y are: " & $aCoord[0] & "," & $aCoord[1] & " color:" & Hex($color, 6) & @CRLF) MouseMove($aCoord[0], $aCoord[1]) EndIf Sleep(1000) ;Check result with mouse pos Local $aCoordm = MouseGetPos() Local $colorm = PixelGetColor($aCoordm[0], $aCoordm[1]) ConsoleWrite(">Mouse X and Y are: " & $aCoordm[0] & "," & $aCoordm[1] & " color:" & Hex($colorm, 6) & @CRLF) Opt("PixelCoordMode", 0) $colorm = PixelGetColor($aCoordm[0] - 1, $aCoordm[1] - 1) ConsoleWrite(">Mouse correction X and Y are: " & $aCoordm[0] - 1 & "," & $aCoordm[1] - 1 & " color:" & Hex($colorm, 6) & @CRLF)
Guidelines for posting comments:
- You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
- In-depth discussions should take place on the forum.
For more information see the full version of the ticket guidelines here.
Tooltip and infoscreen