PLEASE SEE POST – http://blog.joeware.net/2008/05/03/1230/
Just a quick one here.
I did a search trying to find a ready built GUID to string GUID routine and didn’t find anything I liked so I wrote up a function to do it. Specifically I needed to convert schemaIDGUID attributes to the string GUID format in vbscript. I had something to do it in perl, but I needed a vbscript answer this time unfortunately…
Here is the result…
'**************************************************************************** 'Convert a binary GUID to a string GUID ' Convert GUID octet string to Hex characters then arrange in proper order ' and add brackets {} '**************************************************************************** Function GuidToStr(Guid) Dim i, str str = "" For i = 1 To Lenb(Guid) str = str & Right("0" & Hex(Ascb(Midb(Guid, i, 1))), 2) Next GuidToStr = "{" For i = 1 to 4 GuidToStr = GuidToStr & Mid(str,10-(i*2),2) Next GuidToStr = GuidToStr & "-" For i = 1 to 2 GuidToStr = GuidToStr & Mid(str,14-(i*2),2) Next GuidToStr = GuidToStr & "-" For i = 1 to 2 GuidToStr = GuidToStr & Mid(str,18-(i*2),2) Next GuidToStr = GuidToStr & "-" For i = 1 to 2 GuidToStr = GuidToStr & Mid(str,16+(i*2),2) Next GuidToStr = GuidToStr & "-" For i = 1 to 6 GuidToStr = GuidToStr & Mid(str,20+(i*2),2) Next GuidToStr = GuidToStr & "}" End Function