Sign in to follow this  
Followers 0
nAutoIT

Different Colors in PixelGetColor and Au3Info

5 posts in this topic

#1 ·  Posted (edited)

I get wrong Results from "PixelGetColor".

Example (see attached Screenshot):

$chksm = PixelGetColor(780,125)

MsgBox(1,"Checksum",$chksm)

-The Message Box shows 14343130

-Calc says thats DADBDA

-Au3Info says its 0xFFFFFF

I am very unexperienced at scripting, so i´m most likely doing something wrong.

Au3Info is right, the Pixel is bright White.

I am using AutoIT 3.2.10.0 and 2 Monitors. Could that be the Problem?

I also get wrong Results using PixelSearch. There are 2 white(0xFFFFFF) Pixels next to each other and PixelSearch shows me the Coordinates of the right one(Help says "search is performed left-to-right").

Example:

$coord = PixelSearch(650,25,840,650,0xFFFFFF)

MsgBox(1,"x",$coord[0])

MsgBox(1,"y",$coord[1])

post-54495-12594716973151_thumb.jpg

Edited by nAutoIT

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

hi,

maybe you "calculated" it wrong or the windows calculater just cant get it. i guess there are also some autoit functions for converting this kind of values.

about the two pixels. its true pixelsearch just search 1 pixel. maybe you can tell us what are u searching. the problem with white pixels is that they are not coming in a small amount :)

try to find something more individual then 0xFFFFFF.

regards hxhjx

Edited by hxhjx

Share this post


Link to post
Share on other sites

Hi hxhjx and thanks for the answer.

I doubt that calc is that buggy and definitely 14343130 < FFFFFF.

Lets keep it to the PixelSearch Problem. I´m searching the area 650,25,840,650 and there are exactly 17 white Pixels. In my Example the first two of those are at 180,125 and 181,125. The Problem is, that PixelSearch finds 181,125. "$coord[0] -= 1" would be a workaround for this, but i want to understand what i´m doing wrong, because this won´t be the last time i use this command.

Share this post


Link to post
Share on other sites

The most likely cause of your problem, is that you are using different coord modes in AutoitInfo and your script. Which would mean that the coordinates point to different locations on the screen.

In AutoItInfo check Options->Coord Mode

And use Opt("PixelCoordMode", ?) to set your script to use the same reference frame


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

Share this post


Link to post
Share on other sites

Try this?

$chksm = PixelGetColor(780,125)
MsgBox(1,"Checksum", Hex($chksm, 6))

If that works then it would be your math that's off.

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