Sign in to follow this  
Followers 0
lgodfrey

Using PixelGetColor on dynamic screen problem

3 posts in this topic

I am looking at a column of around 120 pixels to find the color. The colors are either red or green as verified using Window Info

Here is the code:

CODE
Func R1Color()

For $y = 560 To 683 Step 3

$C = PixelGetColor($ColorR1X, $y)

If $C = $Red Or $C = $Green Then

Return $C

EndIf

Next

ToolTip("Can't Find good R1 color")

Return 0

EndFunc ;==>R1Color

If I set the image so the colors do not get updated, I get the correct color returned. I can move the image I am looking at so either red or green color is in the search area. This seems to work.

However, if I allow the image to get updated frequently (ranging from 100 msec to 1.5 sec between updates), it no longer returns the color I see on the screen. It returns 0 or even the wrong color.

Turning off virs scanand firewall doesn't help.

Anyone have any suggetions as to what to look at?


I'm, Lovin' IT, X

Share this post


Link to post
Share on other sites



If so then you need to do this..

Sure about that ?
If 0xFF0000 = 16711680 Then MsgBox(64, "", "Would you look at that !")

Share this post


Link to post
Share on other sites

PixelGetColor returns an integer btw. Are your $Red and $Green variables in hex format? If so then you need to do this..

$C = "0x" & Hex(PixelGetColor($ColorR1X, $y),6)
Red and green are in decimal. I have used debug to console to make sure. My initialization of the red and green values match the returned color value when it does find red or green.

Don't know if this makes any difference, the pixel color is set by other "script" to these pre-determined shades of red and green, so the colors should always be exactly these shades.

Sigh, Next what should I look at?


I'm, Lovin' IT, X

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