Jump to content

Recommended Posts

Correct me if i'm wrong.

If the cursor is over the pixel that is being pinged for PixelGetColor() it will get the color of the pixel UNDER the cursor.

Is there any way that i can get the color of the pixel, even if the cursor is in the way? In other words, if the cursor is in the way, and i PixelGetColor on top of it, it will return the color of the pixel of the cursor?

Link to post
Share on other sites
  • Moderators

Not if your using Opt("PixelCoordMode", 0) for active window then your PixelGetColor(x, y) coords.

So example:

Opt("PixelCoordMode", 0)
WinActivate("Window your trying to get color")
$PixelColor = PixelGetColor("x", "y"); don't use "" marks w/ coords
MsgBox(0, "Your Pixel Color Is", $PixelColor)

Hope this helps.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to post
Share on other sites
  • Moderators

PixelGetColor gets the color of a pixel within a DC (device context?). The mouse pointer is not part of any device context... I believe, so it is ignored.

Lar.

<{POST_SNAPBACK}>

Or to get really technical -- What Lar said!! :)

Hey Larry

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to post
Share on other sites
  • Moderators

This should work:

$coord = MouseGetPos()
$pixel = PixelGetColor($coord[0], $coord[1])
MsgBox(0, "Mouse Pixel Color is:  ", $pixel)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to post
Share on other sites

This should work:

$coord = MouseGetPos()
$pixel = PixelGetColor($coord[0], $coord[1])
MsgBox(0, "Mouse Pixel Color is:  ", $pixel)

<{POST_SNAPBACK}>

As Larry said that will only get the color of the pixel under the mouse. Not of the mouse itself.

I am not sure if there is a way to get the color of the mouse at all. You could always check to see what cursor is being used atm with GUI functions.

Maybe if you could tell us why you need this we could come up with another solution for you.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to post
Share on other sites

I dont know that there is another way around this to detect some other process other than the changing of the cursor, because I do not believe this is possible at all.

Thanks,

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...