This is the example, a shortcut was installed to this code
:
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
' $Header: C:/DBAREIS/Projects.PVCS/Win32/ScriptingTipsAndTricks/EXAMPLE[vbs].CommaSeperatedHexString() [Dump string as hex values seperated by commas].vbs.pvcs 1.0 29 Jun 2014 12:51:22 USER "Dennis" $
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
'--- Test String ------------------------------------------------------------
dim vbLFx2 : vbLFx2 = vbLF & vbLF
dim Str : Str = "AAAAA" & vbLFx2 & "BBBBB"
'--- Dump as plain string ---------------------------------------------------
wscript.echo "AS STRING"
wscript.echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
wscript.echo "AAAAA" & vbLFx2 & "BBBBB" & vbCRLF & vbCRLF
'--- Dump As Hex string like "41,41,41,41,41,0A,0A,42,42,42,42,42" ----------
wscript.echo "AS HEX"
wscript.echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
say CommaSeperatedHexString(Str)
'============================================================================
function CommaSeperatedHexString(RawString)
' EXAMPLE OUTPUT: 41,41,41,41,41,0A,0A,42,42,42,42,42
'============================================================================
dim i
dim TmpHex : TmpHex = ""
for i = 1 to len(RawString)
TmpHex = TmpHex & right( "0" & hex(asc(mid(RawString,i,1))),2) & ","
next
CommaSeperatedHexString=left(TmpHex,len(TmpHex)-1) 'Remove the last comma
end function