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