ArmandoXS Posted July 28, 2010 Share Posted July 28, 2010 Hello, I'm Looking for a Hex to RGB Coverter Code Snipet for my AutoIt App,I Tried Looking online and searching the forums but no luck. My Reason behind this is because im having too programs comunnicate to each other by TCP Networking on the same computer. Anyway AutoIt is going to send different Hex values rapidly to another program, thing is that program cannot read Hex for the command im using nor does it has a convertor.. does anyone have a snipet of code that I can use? thanks Link to comment Share on other sites More sharing options...
mdwerne Posted July 28, 2010 Share Posted July 28, 2010 (edited) This may help you get started: http://www.autoitscript.com/forum/index.php?showtopic=70507&st=0&p=516614&hl=_HexToBinaryString&fromsearch=1&#entry516614This may help too...http://gristle.tripod.com/hexconv.html-Mike Edited July 28, 2010 by mdwerne Link to comment Share on other sites More sharing options...
ArmandoXS Posted July 28, 2010 Author Share Posted July 28, 2010 This may help you get started: http://www.autoitscript.com/forum/index.php?showtopic=70507&st=0&p=516614&hl=_HexToBinaryString&fromsearch=1&#entry516614This may help too...http://gristle.tripod.com/hexconv.html-MikeThanks but the other program i am using can only convert decimal to hex and vis virsa, i will hope to use this another time thanks, howerver i did find a chart on the hex values which i might be able to use to create my own program (http://webdesign.about.com/od/colorcharts/l/bl_rgb2hex.htm) Link to comment Share on other sites More sharing options...
mdwerne Posted July 28, 2010 Share Posted July 28, 2010 Thanks but the other program i am using can only convert decimal to hex and vis virsa, i will hope to use this another time thanks, howerver i did find a chart on the hex values which i might be able to use to create my own program (http://webdesign.about.com/od/colorcharts/l/bl_rgb2hex.htm) Humm...unless I'm not getting what your asking for, I was assuming you would use this way cool function from the script I referenced within your own app. ; #FUNCTION# ============================================================== ; Function Name..: _HexToDec ( "expression" ) ; Description ...: Returns decimal expression of a hexadecimal string. ; Parameters ....: expression - String representation of a hexadecimal expression to be converted to decimal. ; Return values .: Success - Returns decimal expression of a hexadecimal string. ; Failure - Returns "" (blank string) and sets @error to 1 if string is not hexadecimal type. ; Author ........: jennico (jennicoattminusonlinedotde) ; Remarks .......: working input format: "FFFF" or "0xFFFF" (string format), do NOT pass 0xFFFF without quotation marks (number format). ; current AutoIt Dec() limitation: 0x7FFFFFFF (2147483647). ; Related .......: Hex(), Dec(), _DecToHex() ; ======================================================================= Func _HexToDecimal($hx_hex) If StringLeft($hx_hex, 2) = "0x" Then $hx_hex = StringMid($hx_hex, 3) If StringIsXDigit($hx_hex) = 0 Then SetError(1) MsgBox(0,"Error","Wrong input, try again ...") Return "" EndIf Local $ret="", $hx_count=0, $hx_array = StringSplit($hx_hex, ""), $Ii, $hx_tmp For $Ii = $hx_array[0] To 1 Step -1 $hx_tmp = StringInStr($HX_REF, $hx_array[$Ii]) - 1 $ret += $hx_tmp * 16 ^ $hx_count $hx_count += 1 Next Return $ret EndFunc ;==>_HexToDec() Please clarify your request if I appear to have rode the short bus today. -Mike Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 28, 2010 Moderators Share Posted July 28, 2010 DarkDragon,Hex to RGB CoverterWhat exactly do you want to convert to what? RGB can be expressed as both a Hex and a Decimal digit - Hex/Dec will do the conversion automatically.If you want the individual RGB elements of colour value, you can use _ColorGetBlue/Green/Red on either format. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
ArmandoXS Posted July 28, 2010 Author Share Posted July 28, 2010 Im Sorry for not being as clear as i can, my second program which is going to recieve the Hex data from autoit cannot read that hex data becuase it is using a command that caan ONLY read argb(alpha,red,green,blue) {how nice of them i know},thats the reason why i need a piece of coded to convert the Hex or decimal values to an rgb value Link to comment Share on other sites More sharing options...
ArmandoXS Posted July 28, 2010 Author Share Posted July 28, 2010 DarkDragon,What exactly do you want to convert to what? RGB can be expressed as both a Hex and a Decimal digit - Hex/Dec will do the conversion automatically.If you want the individual RGB elements of colour value, you can use _ColorGetBlue/Green/Red on either format. M23Thanks you thats all i needed however i didnt know that that command was there , ill be sure to use it 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