GUID generator method for UE scripts

Help with writing and running scripts

GUID generator method for UE scripts

Postby ckelly » Wed Mar 09, 2011 12:39 am

I very much need to call the GUID generator within a script, but could not find a method listed in the help for scripts, nor here in the forums.

I did see a reference to a function "com_create_guid", but this doesn't seem to be a javascript method in the UltraEdit class.

Any suggestions are welcome.
User avatar
ckelly
Newbie
 
Posts: 4
Joined: Wed Apr 18, 2007 11:00 pm
Location: Virginia

Re: GUID generator method for UE scripts

Postby Mofi » Wed Mar 09, 2011 1:28 am

In Save all new, unnamed files with automatically generated file names there is a script posted by a user who used a GUID generating function to build unique file names, see the 2 functions S4() and guid().
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4054
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: GUID generator method for UE scripts

Postby ckelly » Wed Mar 09, 2011 9:18 pm

Thanks, Mofi! Since the forum searches don't seem to look within code snippets, I'll repost them here, just
so anyone can find them a little easier. They are:

function S4() {
return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
}
function guid() {
return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());
}


Originally posted here: http://www.ultraedit.com/forums/viewtopic.php?f=52&t=10176#p36183
Kudos to "fredtheman".
User avatar
ckelly
Newbie
 
Posts: 4
Joined: Wed Apr 18, 2007 11:00 pm
Location: Virginia


Return to Scripts

cron