Jump to content

PixelGetColor


user3k
 Share

Recommended Posts

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 6 years later...
  • Moderators

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

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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