Sign in to follow this  
Followers 0
jensj

Color Variable... Different Colors..

8 posts in this topic

hi..

i use pixelgetcolor to get the color of one pixel. but that pixel hast not always the one color. there is a little difference.

if pixelgetcolor( 3, 1004 )=( 0x010101 ) then ; H Checken

Sleep(1000)

send("{h}")

Else

sleep(1000)

endif

the color is almost black and highest violett like this 2B1831

how do i get the difference of these colors?

if the color is between black and that violett, my script should send h.

i hope u understood the problem. thx

Share this post


Link to post
Share on other sites



If pixelgetcolor(3, 1004 ) = 0x2B1831 then
Sleep(1000)
send("h")
Else
sleep(1000)
endif

I don't get the problem?


I can do signature me.

Share this post


Link to post
Share on other sites

there should be listet every color from black to violett.

Share this post


Link to post
Share on other sites

Uf. Have no idea.


I can do signature me.

Share this post


Link to post
Share on other sites

Hrm I havent tried it myself, but I suspect somthing like this should work, you will need to find your own color ranges:

if pixelgetcolor( 3, 1004 ) >= dec(000000) and pixelgetcolor( 3, 1004 ) <= dec(??????) then

and replace ?????? with the color code for violet.

Share this post


Link to post
Share on other sites

Actually this would be rather complicated... you want to return true based on if the color is between black and violet (2B1831), correct?

Well, technically 001800 is between black and violet, but it's green. Would you want that to return true?

The simplest way to do it (although not necessarily reliable I think) would be like so:

$iPixelColor = PixelGetColor(3, 1004)
$aPixelSplit = _ColorSplit($iPixelColor)
If $aPixelSplit[0] < 0x2B And $aPixelSplit[1] < 0x18 And $aPixelSplit[2] < 0x31 Then
    Sleep(1000)
    Send("{h}")
Else
    Sleep(1000)
EndIf

Func _ColorSplit($i_Color)
    Local $a_Color[3]
    $a_Color[0] = BitAND(BitShift($i_Color, 16), 0xff)
    $a_Color[1] = BitAND(BitShift($i_Color, 8), 0xff)
    $a_Color[2] = BitAND($i_Color, 0xff)
    Return $a_Color
EndFunc

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