Hi,
Assuming that you don't have a security issue with the
FileSystemObject, VBS will generate random
8-alphanumeric-character names for temporary files.
It sounds like this may be sufficient for your purposes.
You can always get multiples and concatenate them to
16-, 24-, 32- character ids. A more random solution
involes the generation of GUIDs. but that's not "simple
VBS."
Set oFileSys= CreateObject("Scripting.FileSystemObject")
sTitleID= oFileSys.GetBaseName(oFileSys.GetTempName)
Joe Earnest
Quote:
> Here is a rather simple problem that I am looking to optimize.
> I need to generate uniqueIDs. The ids must be in the form of 'Title' +
> (optional numeric index)
> So a sequence of titles might go something like this (the user provides
the
> 'Title' - and I have to make it unique against previously issued IDs)
> MyTitle
> SomeOtherTitle
> AnotherTitle
> MyTitle1
> MyTitle2
> AnotherTitle1
> SomeOtherTitle1
> MyTitle3
> SomeOtherTitle2
> and so on. I can have a list of existing ids in pretty much any format.
> Everything I have done so far is cumbersome, mostly because I do not know
> much about VBScript.
> Can anyone think of an optimized way of doing thi, that is also considered
> clean and safe VBScript code?
> thanks,
> BB