Page 1 of 1

Create GUID

PostPosted: Mon Aug 27, 2012 9:40 am
by dpayer
Globally Unique Identifier - GUID
also known as a CLSID
http://en.wikipedia.org/wiki/Guid
A GUID is a unique alphanumeric string used to identify items on a computer or in an application or class within an application. Most often used in the Windows Registry to identify a software class. The total number of unique such GUIDs is 2122 or 5.3×10^36. This number is so large that the probability of the same number being generated randomly twice is negligible. So if you create a GUID, it is amost impossible that a duplicate exists.

As it turns out, there is a simple way to make one using VB script. The NB function below is derived from the example at: http://blogs.technet.com/b/heyscripting ... cript.aspx
Image
Copy the code below and save it as a file in your FUNCTIONS sub-folder in the NB install folder.

This function has one parameter that is requested when you call it: the name of the variable that contains the created GUID.

If you would like a simple GUID creator that copies a new GUID to the clipboard for you to use in another app: Here is a compiled executable you can use.

Code: Select all
{NeoBook Function}
Version=5.70
Language=VBScript
Param=[%1]|Variable|name of variable to contain new GUID
{End}
Set TypeLib = CreateObject("Scriptlet.TypeLib")
newGuid = TypeLib.Guid
publication.nbSetVar "[%1]", newGuid
Set typeLib = Nothing

PostPosted: Mon Aug 27, 2012 3:52 pm
by smokinbanger
Kinda cool! 8)

PostPosted: Tue Aug 28, 2012 1:57 am
by Alex
Thanks DPayer

Ussing JavaScript...

PostPosted: Tue Aug 28, 2012 9:38 am
by virger
May you can use this

function Hexa4()
{return (((1+Math.random())*0x10000)|0).toString(16).substring(1);}

function GUID()
{return ((Hexa4()+Hexa4()+"-"+Hexa4()+"-"+Hexa4()+"-"+Hexa4()+"-"+Hexa4()+Hexa4()+Hexa4()).toUpperCase());}

DESDE COSTA RICA
PURA VIDA