Generate GUID

Any slick built-in trick to generate a new GUID value into a variable?  I suppose that I can shell out to uuidgen.exe, but it seems like there ought to be an easier way.

Here's a way that's not bad - define a variable to receive the Guid (e.g. ProductCode), and then use:

ProductCode = ActiveXObject("Scriptlet.TypeLib").guid.substring(1, 37).toLowerCase();

in a BeforeAction script in FB.

BUT...

This doesn't work in FinalBuilder.  It works when the JS is run under cscript/wscript.

Any better solutions?  Like one that works :)

Hi Carl,

There’s a built in script function called “NewGUIDString” that should do what you need :slight_smile:

.t8

Cool - I'll give that a try tomorrow.

Couldn't wait - tried it tonight.  Works great, thanks!