From: Alexander Mueller on
KAKA schrieb:
> How to do Hex transfer to string by vb script ?
> I want to transfer to the 4D006F006E00690074006F0072 to string, and
> ignore the 00 . The string is Monitor
> Thanks.


Actually you seem to try to convert wide char key codes (UTF-16)
of little endian notation into a string.

Try this one, which does not rely on padding '00':


WScript.Echo Hex2String("4D006F006E00690074006F0072")

Function Hex2String(s)
Dim i, c
For i = 1 To Len(s) Step 4
c = c & ChrW(CLng("&H" & Mid(s,i+2,2) & Mid(s,i,2)))
Next
Hex2String = c
End Function


Note that you can rely on a pattern with double-nulls in every 3rd and
4th position as long as the string is fully UTF-8-compatible
(no keycode > 255 / FF00)

Also, as for chars from 128-255, you'd probably need some
remapping from UTF-8 to ASCII.



MfG,
Alex





MfG,
Alex