Quantcast
Channel: AutoHotkey Community
Viewing all articles
Browse latest Browse all 579

Ask for Help (v2) • Re: CheckColor / WaitColor - Color names of HEX color

$
0
0
Instead of a bunch of if statements, you can use a Map:

CODE:

Color := 'Red' ; also test with 'WrongColor' or other color names
ColorValues := Map('White', 0xFFFFFF, 'Black', 0x000000, 'Red', 0xFF0000, 'DarkRed', 0x800000)
Try
WaitColor := ColorValues[Color]
Catch {
MsgBox 'The color "' Color '" is not defined'
return
}
MsgBox 'The color in hex format is ' Format('{:#x}', WaitColor)
;PixelGetColor ...

Statistics: Posted by boiler — Today, 14:51



Viewing all articles
Browse latest Browse all 579

Trending Articles