Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Convert Hex Ascii
I have muddled around alittle but haven't been able to get anything good working...
It starts off with: input=AskLine("", "Enter Something To Be Converted", "48656c6c6f20576f726c64") length=strlen(input) If length Mod 2 <> 0 Message("", "Invalid Hex Values") Exit EndIf
#DefineFunction udfHexToByte (hexstr) hexstr = StrUpper(StrTrim(hexstr)) n1 = Char2Num(StrSub(hexstr,1,1))-48 n2 = Char2Num(StrSub(hexstr,2,1))-48 Return (((n1-7*(n1>9))<<4)+(n2-7*(n2>9))) ; note: must be StrLen(hexstr)=2 #EndFunction sInput = "48656c6c6f20576f726c64" iLength = StrLen(sInput) If ((iLength mod 2) <> 0) Message("", "Invalid Hex Values") Exit EndIf sAscii = "" For i=1 To iLength By 2 sHex = StrSub(sInput,i,2) iByte = udfHexToByte (sHex) sAscii = StrCat(sAscii,Num2Char(iByte)) Next Message(sInput,sAscii) Exit
Article ID: W15964
File Created: 2004:03:30:15:42:04
Last Updated: 2004:03:30:15:42:04