Hopefully "ScriptingTipsAndTricks" helps you with your batch file or vbscript scripting :-)
[Bottom][Contents][Prev]: VBSCRIPT Files[Next]: CreateDirectoryTree() aka CreateFolderTree - Native VBSCRIPT can not do this
\->VBSCRIPT Files->CommaSeperatedHexString() - Dump string as hex values seperated by commas

[anchor]

The Code for: "CommaSeperatedHexString() [Dump string as hex values seperated by commas].vbs"

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


Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.Please email me any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Prev]: VBSCRIPT Files[Next]: CreateDirectoryTree() aka CreateFolderTree - Native VBSCRIPT can not do this


ScriptingTipsAndTricks© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Sunday September 07 2014 at 12:50pm
Visit ScriptingTipsAndTricks's Home Page
Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.