Sign in to follow this  
Followers 0
deathday

Is there a code in autoit which can convert hex to ascii

3 posts in this topic

#1 ·  Posted (edited)

hey every one is there a code in autoit which can convert hex to ascii , like in vb which has a code asciitohex and hextoascii ,If there is tell me please? Edited by deathday

Share this post


Link to post
Share on other sites



hey every one is there a code in autoit which can convert hex to ascii , like in vb which has a code asciitohex and hextoascii ,If there is tell me please?

or, something I found on the forum:

$hex="36 35";hex
$Hex2Ascii = ChrH($hex);Ascii
$Ascii2Hex = AscToHex($Hex2Ascii);Hex
$Char = Chr($Hex2Ascii);char

MsgBox(0,$hex,$Hex2Ascii&@CRLF&$Ascii2Hex&@CRLF&$Char)

Func ChrH($strString)
  ;hex to ascii
    Local $ch=""
    $A1 = StringSplit($strString, " ")
    For $i = 1 To $A1[0]
        $Ch &= Chr(Dec($A1[$i]))
    Next
    Return $Ch
endFunc


Func AscToHex($strString)
  ;ascii to hex
    Local $ah=""
    For $i = 1 To StringLen($strString)
        If StringLen(Hex(Asc(StringMid($strString, $i, 1)),2)) = 1 Then
            $ah &=  "0" & Hex(Asc(StringMid($strString, $i, 1)))
        Else
            $ah &=  Hex(Asc(StringMid($strString, $i, 1)),2)
        EndIf
        If $i <> StringLen($strString) Then $ah &=  " "
    Next
    Return $ah
endFunc

I do not like stupid and idiot people that write idiot things...If you are one, do not write.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0