udfGuidToString
str udfGuidToString (str, int)
Download: "DDGUID.setup.exe" as zip package.
;------------------------------------------------------------------------------------------------------------------------------------------
#DefineFunction udfGuidToString (strFormat, intCount)
strList = ""
objGUID = ObjectCreate ("DDGUID.GuidToString")
For intItem = 1 To intCount
   strList = ItemInsert (objGUID.GuidToString(strFormat), -1, strList, @TAB)
Next
objGUID = 0
Return strList
;..........................................................................................................................................
; This UDF "udfGuidToString" creates a global unique identifier (GUID), or more as given by the parameter intCount.
; The format of the GUID string can be set by the parameter strFormat.
;
; Parameter:
; strFormat = One specifier from the set ("", "D", "N", "B", "P", "X"). The empty string gives the same result as specifier "D".
; intCount  = Number, to create a string list of N-count GUID strings.
;..........................................................................................................................................
;
; Microsoft has defined letters for identifying the format of a GUID string.
;
; Specifier  Format of the input parameter
;
;     N :    00000000000000000000000000000000
;            32 digits.
;
;     D :    00000000-0000-0000-0000-000000000000
;            32 digits separated by hyphens (36 characters).
;
;     B :    {00000000-0000-0000-0000-000000000000}
;            32 digits separated by hyphens, enclosed in curly brackets (38 characters).
;
;     P :    (00000000-0000-0000-0000-000000000000)
;            32 digits separated by hyphens, enclosed in round brackets (38 characters).
;
;     X :    {0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} (68 characters).
;            Four hexadecimal values enclosed in braces, where the fourth value is a
;            subset of eight hexadecimal values that is also enclosed in braces.
;..........................................................................................................................................
;
; This function uses the scripting component "DDGUID.GuidToString".
;
; Use the installer package "DDGUID.setup.exe" for easy set up and register the COM component.
;..........................................................................................................................................
#EndFunction
;------------------------------------------------------------------------------------------------------------------------------------------


; Test.

DirChange (DirScript ())


; Example 1.

objGuid = ObjectCreate ("DDGUID.GuidToString")

strMsgTitle = "DDGUID Info"
strMsgText = ""
strMsgText = strMsgText : @LF : "VersionInfo():" : @LF : objGuid.VersionInfo()
strMsgText = strMsgText : @LF
strMsgText = strMsgText : @LF : "GuidToString:"        : @TAB : objGuid.GuidToString       ; Format "D" is used.
strMsgText = strMsgText : @LF : "GuidToString():"      : @TAB : objGuid.GuidToString()     ; Format "D" is used.
strMsgText = strMsgText : @LF : "GuidToString(""):"    : @TAB : objGuid.GuidToString("")   ; Format "D" is used.
strMsgText = strMsgText : @LF
strMsgText = strMsgText : @LF : "GuidToString(""D""):" : @TAB : objGuid.GuidToString("D")  ; Format "D" is used.
strMsgText = strMsgText : @LF : "GuidToString(""N""):" : @TAB : objGuid.GuidToString("N")  ; Format "N" is used.
strMsgText = strMsgText : @LF : "GuidToString(""B""):" : @TAB : objGuid.GuidToString("B")  ; Format "B" is used.
strMsgText = strMsgText : @LF : "GuidToString(""P""):" : @TAB : objGuid.GuidToString("P")  ; Format "P" is used.
strMsgText = strMsgText : @LF : "GuidToString(""X""):" : @TAB : objGuid.GuidToString("X")  ; Format "X" is used.
Pause (strMsgTitle, strMsgText)

objGuid = 0


; Example 2.

IntControl (28, 1, 0, 0, 0) ; Selects system font used in list boxes.

; Available Formats.

strFormatD = udfGuidToString ("", 1)  ; 32 digits separated by hyphens (36 characters) ("registry format").
strFormatD = udfGuidToString ("D", 1) ; 32 digits separated by hyphens (36 characters) ("registry format").
strFormatN = udfGuidToString ("N", 1) ; 32 digits no delimiters (32 characters).
strFormatB = udfGuidToString ("B", 1) ; 32 digits separated by hyphens, enclosed in curly brackets (braces) (38 characters).
strFormatP = udfGuidToString ("P", 1) ; 32 digits separated by hyphens, enclosed in round brackets (parentheses) (38 characters).
strFormatX = udfGuidToString ("X", 1) ; 32 digits formatted as "0x" hex values and grouped by curly brackets (68 characters).


; Display GUID strings.
strGuidList = strFormatD
strGuidList = strGuidList : @TAB : strFormatN
strGuidList = strGuidList : @TAB : strFormatB
strGuidList = strGuidList : @TAB : strFormatP
strGuidList = strGuidList : @TAB : strFormatX
IntControl (63, 200, 200, 800, 800)  ; Sets the window coordinates for the dialog box.
AskItemlist ('Demo|udfGuidToStr (strFormat, intCount)', strGuidList, @TAB, @UNSORTED, @SINGLE)


; Lists.

intCount = 100

strGuidList = udfGuidToString ("D", intCount)
IntControl (63, 200, 200, 800, 800)  ; Sets the window coordinates for the dialog box.
AskItemlist ('Demo|udfGuidToString ("D", ' : intCount : ')', strGuidList, @TAB, @UNSORTED, @SINGLE)

strGuidList = udfGuidToString ("N", intCount)
IntControl (63, 200, 200, 800, 800)  ; Sets the window coordinates for the dialog box.
AskItemlist ('Demo|udfGuidToString ("N", ' : intCount : ')', strGuidList, @TAB, @UNSORTED, @SINGLE)

strGuidList = udfGuidToString ("B", intCount)
IntControl (63, 200, 200, 800, 800)  ; Sets the window coordinates for the dialog box.
AskItemlist ('Demo|udfGuidToString ("B", ' : intCount : ')', strGuidList, @TAB, @UNSORTED, @SINGLE)

strGuidList = udfGuidToString ("P", intCount)
IntControl (63, 200, 200, 800, 800)  ; Sets the window coordinates for the dialog box.
AskItemlist ('Demo|udfGuidToString ("P", ' : intCount : ')', strGuidList, @TAB, @UNSORTED, @SINGLE)

strGuidList = udfGuidToString ("X", intCount)
IntControl (63, 200, 200, 800, 800)  ; Sets the window coordinates for the dialog box.
AskItemlist ('Demo|udfGuidToString ("X", ' : intCount : ')', strGuidList, @TAB, @UNSORTED, @SINGLE)

:CANCEL
Exit
;------------------------------------------------------------------------------------------------------------------------------------------