Here's a rather strange looking solution, but it works. It takes
advantage of the fact an instance of a Windows Script Component that does
_not_ have an id attribute on it's <component> element can be queried with
VBScript's TypeName function. This will return the formatted IID
of that instance of the component (which is dynamically generated by scrobj.dll
for every new instance of a WSC component). If it had an id attribute then
that's what TypeName would return for every instance.
For example, create and register the following...
==== uuid.wsc ====
<?xml
version="1.0"?>
<component>
<registration
description="UUID"
progid="UUID.WSC"
version="1.00"
>
</registration>
</component>
Now create and run the following test script. Note that a reference
to the instance of uuid.wsc created is never kept - you have to create a new
instance for each GUID you want.
==== uuid.vbs ====
guid = typename(createobject("uuid.wsc"))
guid = guid & vbcrlf &
typename(createobject("uuid.wsc"))
guid = guid & vbcrlf &
typename(createobject("uuid.wsc"))
guid = guid & vbcrlf &
typename(createobject("uuid.wsc"))
guid = guid & vbcrlf &
typename(createobject("uuid.wsc"))
guid = guid & vbcrlf &
typename(createobject("uuid.wsc"))
guid = guid & vbcrlf &
typename(createobject("uuid.wsc"))
guid = guid & vbcrlf &
typename(createobject("uuid.wsc"))
guid = guid & vbcrlf &
typename(createobject("uuid.wsc"))
guid = guid & vbcrlf &
typename(createobject("uuid.wsc"))
msgbox guid
--
Michael Harris