PDA

View Full Version : Script function that creates a GUID


Zweitze
09-03-2004, 03:23 AM
My build creates Windows Installer (MSI) packages. These packages should upgrade each other, therefore I have to change the PackageCode and ProductCode properties at every build. Both properties are GUIDs. An example script is (InstallShield for Windows Installer 1.52):

Dim Iswi
Set Iswi = CreateObject("ISWiAutomation.ISWiProject")
Iswi.OpenProject "%ISMFILE%"
Iswi.ProductCode = CreateGuid
Iswi.PackageCode = CreateGuid
Iswi.ProductVersion = "%NEWMSIVERSION%"
Iswi.CloseProject

The CreateGuid function should create a new GUID. I got it working in the end, by running UUIDGEN.EXE, but in my opinion this could have much been easier.

kinook
09-03-2004, 05:58 AM
Replace CreateGuid with

CreateObject("Scriptlet.Typelib").Guid

From:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=uqruvl%23cBHA.1936%40tkmsftngp07&rnum=3&prev=/groups%3Fq%3Dvbscript%2520create%2520guid%26hl%3De n%26lr%3D%26ie%3DUTF-8%26sa%3DN%26tab%3Dwg

Found via this search:
http://groups.google.com/groups?q=vbscript%20create%20guid&hl=en&lr=&ie=UTF-8&sa=N&tab=wg

Zweitze
09-06-2004, 04:42 AM
I didn't know that object... Thanks a lot!