Jump to content
• Sign Up

# Color Variable... Different Colors..

## Recommended Posts

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

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

##### Share on other sites

there should be listet every color from black to violett.

up

#### Share this post

##### Share on other sites

Uf. Have no idea.

I can do signature me.

#### Share this post

##### Share on other sites

You could code a simple color display of your own, or use a UDF like kjactive's ColorPicker.

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

#### Share this 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

##### 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```

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

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...