Diaa Posted August 1, 2012 Share Posted August 1, 2012 HelloI need help to convert Hex data to int32 in autoitfor example I have this data in HexBA D0 01 00and I want to convert it to int32 which will be118970thank you Link to comment Share on other sites More sharing options...
Spiff59 Posted August 1, 2012 Share Posted August 1, 2012 (edited) You have me confused, hexadecimal is a base 16 number system, and Int32 is a format for storing a numeric variable in memory. I can't think of any sort of conversion that turns BAD00100 (or 0100BADO) into 118970. Edited August 1, 2012 by Spiff59 Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted August 1, 2012 Moderators Share Posted August 1, 2012 (edited) Right, wouldn't 118970 be 0001D0BA? Edit: It's okay, I'm dyslexic too Edited August 1, 2012 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Spiff59 Posted August 1, 2012 Share Posted August 1, 2012 Right, wouldn't 118970 be 0001D0BA? Edit: It's okay, I'm dyslexic too You're right! I didn't get "endian" enough with it. Flopped words, but not bytes, then words. To the OP: There are a bunch of base conversion routines around easily found by doing a forum search. Here's one: $result = _BaseConvert("1D0BA", 16, 10) MsgBox(0,"",$result) ;=================================================================================================================================== Func _BaseConvert($sIn, $iBaseIn, $iBaseOut) Local $sOut = 0 If $iBaseIn <> 10 Then ; iBaseIn to decimal $aIn = StringSplit($sIn, "") For $x = 1 to $aIn[0] $asc = Asc($aIn[$x]) $iDec = $asc - (48 + ($asc > 57) * 7) ; [0-9][A-Z] $sOut += $iDec * ($iBaseIn ^ ($aIn[0] - $x)) Next $sIn = $sOut EndIf If $iBaseOut <> 10 Then ; decimal to iBaseOut $sOut = "" While $sIn >= 1 $x = Mod($sIn, $iBaseOut) $sOut = Chr($x + 48 + ($x > 9) * 7) & $sOut ; [0-9][A-Z] $sIn = ($sIn - $x) / $iBaseOut WEnd EndIf Return $sOut EndFunc 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