au3scr Posted February 1, 2008 Share Posted February 1, 2008 how i can calculate colors? I want calculate colors like if input have 255, then it converts it to FF and 00 to 00 and so on So i type red value, blue value and red value ant then it set Label color to chosen color Link to comment Share on other sites More sharing options...
seandisanti Posted February 1, 2008 Share Posted February 1, 2008 how i can calculate colors?I want calculate colorslike if input have 255, then it converts it to FFand 00 to 00and so onSo i type red value, blue value and red value ant then it set Label color to chosen colorCheck out Hex() in helpfile Link to comment Share on other sites More sharing options...
au3scr Posted February 1, 2008 Author Share Posted February 1, 2008 (edited) i just did it #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 365, 52, 193, 115) $Input1 = GUICtrlCreateInput("Input1", 8, 16, 121, 21) $Button1 = GUICtrlCreateButton("Button1", 136, 16, 75, 25, 0) $Input2 = GUICtrlCreateInput("Input2", 216, 16, 121, 21) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $read = GUICtrlRead ($Input1) $hex = StringToBinary($read,3) GUICtrlSetData ($Input2,$hex) EndSwitch WEnd but i i type 255 then i dont see FF in input 2 here is modification #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 365, 52, 193, 115) $Input1 = GUICtrlCreateInput("Input1", 8, 16, 121, 21) $Button1 = GUICtrlCreateButton("Button1", 136, 16, 75, 25, 0) $Input2 = GUICtrlCreateInput("Input2", 216, 16, 121, 21) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $read = GUICtrlRead ($Input1) $hex = Hex($read,4) GUICtrlSetData ($Input2,$hex) EndSwitch WEnd how i can get rid of zero(s) this topic is here done for now Edited February 1, 2008 by au3scr Link to comment Share on other sites More sharing options...
GEOSoft Posted February 1, 2008 Share Posted February 1, 2008 (edited) here is another simple function for you. MsgBox(0, "Test", _ColorGetHexValue(255,140,60)) Func _ColorGetHexValue($R = 255, $G = 255, $B = 255) $cValue = Hex($R, 2) $cValue &= Hex($G, 2) $cValue &= Hex($B, 2) Return "0x" & $cValue EndFunc You could call this with $hex = _ColorGetHexValue($R = 255, $G = 255, $B = 255) Edited February 1, 2008 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now