Modify

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#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)

screenchot_2.png (171.7 KB ) - added by anonymous 2 years ago.
Tooltip and infoscreen

Download all attachments as: .zip

Change History (2)

by anonymous, 2 years ago

Attachment: screenchot_2.png added

Tooltip and infoscreen

comment:1 by Jos, 2 years ago

Resolution: No Bug
Status: newclosed

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
	$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()
$colorm = PixelGetColor($aCoordm[0],$aCoordm[1])
ConsoleWrite("> X and Y are: " & $aCoordm[0] & "," & $aCoordm[1] & "  color:" & Hex($colorm,6) & @CRLF)

$colorm = PixelGetColor($aCoordm[0]-1,$aCoordm[1]-1,1)
ConsoleWrite("> X and Y are: " & $aCoordm[0]-1 & "," & $aCoordm[1]-1 & "  color:" & Hex($colorm,6) & @CRLF)

Version 3, edited 2 years ago by Jos (previous) (next) (diff)

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.