;;=====================================================================================----- 
;;FUNCTION     CreateGUID() 
;; 
;;ACTION       Creates a GUID (globally unique identifier) 
;; 
;;AUTHOR       Jens Meyer 
;; 
;;CONTRIBUTORS Mark A. (ScriptLogic BBS) 
;; 
;;VERSION      1.0 - 2003/09/19 
;; 
;;HISTORY      1.0 - 2003/09/19 - Initial Release 
;; 
;;SYNTAX       CREATEGUID([FORMAT]) 
;; 
;;PARAMETERS    FORMAT - Optional - Integer, Denotes the GUID format 
;;                                  0 = no changes (DEFAULT) 
;;                                  1 = remove curly parentheses 
;;                                  2 = remove curly parentheses and dashes 
;; 
;;RETURNS      GUID 
;; 
;;REMARKS      None 
;; 
;;DEPENDENCIES requires IE4.0+ 
;; 
;;EXAMPLES     $guid=createguid() 
;; 
;;KIXTART BBS  http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=12&t=000461 
; 
Function CreateGUID(optional $_Format)
 
  $CreateGUID = CreateObject("Scriptlet.TypeLib").guid
 
  If @ERROR Exit @ERROR EndIf
 
  Select
   Case $_Format = 1
    $CreateGUID = Right(Left($CreateGUID, -1), -1)
   Case $_Format = 2
    $CreateGUID = Join(Split(Right(Left($CreateGUID, -1), -1), '-'), '')
  EndSelect
 
  Exit @ERROR
 
EndFunction