Sign in to follow this  
Followers 0
user3k

PixelGetColor

5 posts in this topic

#1 ·  Posted (edited)

First yes, i'm a newbie.

I'm using the folowing script to get coordinates:

AutoItSetOption("MouseCoordMode", 2)
AutoItSetOption("PixelCoordMode", 2)
AutoItSetOption("SendKeyDelay", 250)
Sleep (5000)
$pos = MouseGetPos()
MsgBox(0, "Mouse x,y:", $pos[0] & "," & $pos[1])
$var = PixelGetColor( $pos[0] , $pos[1] )
MsgBox(0,"The decmial color is", $var)
MsgBox(0,"The hex color is", Hex($var, 6))

Let's say i get mouse coordinates 234, 278 and hex color FFFFFF

Then I test using the following loop:

AutoItSetOption("MouseCoordMode", 2)
AutoItSetOption("PixelCoordMode", 2)
AutoItSetOption("SendKeyDelay", 250
While True
        $PixelGetColor = Hex(PixelGetColor(234, 278), 6)

        If $PixelGetColor == "FFFFFF" Then ExitLoop
WEnd

But is not working. The color that i get appear to be correct. I think the mouse coordinate is not correlate with the coordinate needed for the PixelGetColor. How i get/calculate the right coordinate?

Edited by user3k

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Didn't saw your edit. :x

Have a look onto the PixelCoordMode

Sets the way coords are used in the pixel functions, either absolute coords or coords relative to the window defined by hwnd (default active window):

0 = relative coords to the defined window

1 = absolute screen coordinates (default)

2 = relative coords to the client area of the defined window

Opt("PixelCoordMode", ?)
Edited by funkey

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I know this post is old but if your still wondering and for others who are still looking for the solution check out my post.

 

 

Edited by Nitrolord

Share this post


Link to post
Share on other sites

#5 ·  Posted

@Nitrolord please don't resurrect old threads. Especially when the OP hasn't even been on the forum in 6 years.

 


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
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
Sign in to follow this  
Followers 0