Number licence xxxx-xxxx-xxxx-xxxx
Number licence xxxx-xxxx-xxxx-xxxx
Have you and Idea or a function to create number licence as Office Microsoft Licence ?
Best Regards, Saludos
Falconi Silvio
Falconi Silvio
-
- Posts: 42
- Joined: Sat Sep 30, 2006 9:43 am
Amiguinho
See this
REGIDA := nSerialHD()
REGIDB := nSerialHD()
REGIDC := ""
REGIDC := REGIDC+SUBS(REGIDA,1,1)+SUBS(REGIDB,8,1)
REGIDC := REGIDC+SUBS(REGIDA,2,1)+SUBS(REGIDB,7,1)
REGIDC := REGIDC+"-"
REGIDC := REGIDC+SUBS(REGIDA,3,1)+SUBS(REGIDB,6,1)
REGIDC := REGIDC+SUBS(REGIDA,4,1)+SUBS(REGIDB,5,1)
REGIDC := REGIDC+"-"
REGIDC := REGIDC+SUBS(REGIDA,5,1)+SUBS(REGIDB,4,1)
REGIDC := REGIDC+SUBS(REGIDA,6,1)+SUBS(REGIDB,3,1)
REGIDC := REGIDC+"-"
REGIDC := REGIDC+SUBS(REGIDA,7,1)+SUBS(REGIDB,2,1)
REGIDC := REGIDC+SUBS(REGIDA,8,1)+SUBS(REGIDB,1,1)
This returns a number with "XXXX-XXXX-XXXX-XXXX" format.
Or use this:
REGIDA := GerarSenha(16,2)
REGIDC := ""
REGIDC := REGIDC+SUBS(REGIDA,1,1)+SUBS(REGIDA,2,1)
REGIDC := REGIDC+SUBS(REGIDA,3,1)+SUBS(REGIDA,4,1)
REGIDC := REGIDC+"-"
REGIDC := REGIDC+SUBS(REGIDA,5,1)+SUBS(REGIDA,6,1)
REGIDC := REGIDC+SUBS(REGIDA,7,1)+SUBS(REGIDA,8,1)
REGIDC := REGIDC+"-"
REGIDC := REGIDC+SUBS(REGIDA,9,1)+SUBS(REGIDA,10,1)
REGIDC := REGIDC+SUBS(REGIDA,11,1)+SUBS(REGIDA,12,1)
REGIDC := REGIDC+"-"
REGIDC := REGIDC+SUBS(REGIDA,13,1)+SUBS(REGIDA,14,1)
REGIDC := REGIDC+SUBS(REGIDA,15,1)+SUBS(REGIDA,16,1)
Function GerarSenha(MaxNum,Tipo)
* 1 = Somente Numeros
* 2 = Numero e Letras
* 3 = Somente Letras
local chave := ""
var_valores := { "0123456789",;
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",;
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" }[Tipo]
for i = 1 to MaxNum
num := random(len(var_valores))
chave := chave + substr(var_valores,num,1)
next
return lTrim(chave)
See this
REGIDA := nSerialHD()
REGIDB := nSerialHD()
REGIDC := ""
REGIDC := REGIDC+SUBS(REGIDA,1,1)+SUBS(REGIDB,8,1)
REGIDC := REGIDC+SUBS(REGIDA,2,1)+SUBS(REGIDB,7,1)
REGIDC := REGIDC+"-"
REGIDC := REGIDC+SUBS(REGIDA,3,1)+SUBS(REGIDB,6,1)
REGIDC := REGIDC+SUBS(REGIDA,4,1)+SUBS(REGIDB,5,1)
REGIDC := REGIDC+"-"
REGIDC := REGIDC+SUBS(REGIDA,5,1)+SUBS(REGIDB,4,1)
REGIDC := REGIDC+SUBS(REGIDA,6,1)+SUBS(REGIDB,3,1)
REGIDC := REGIDC+"-"
REGIDC := REGIDC+SUBS(REGIDA,7,1)+SUBS(REGIDB,2,1)
REGIDC := REGIDC+SUBS(REGIDA,8,1)+SUBS(REGIDB,1,1)
This returns a number with "XXXX-XXXX-XXXX-XXXX" format.
Or use this:
REGIDA := GerarSenha(16,2)
REGIDC := ""
REGIDC := REGIDC+SUBS(REGIDA,1,1)+SUBS(REGIDA,2,1)
REGIDC := REGIDC+SUBS(REGIDA,3,1)+SUBS(REGIDA,4,1)
REGIDC := REGIDC+"-"
REGIDC := REGIDC+SUBS(REGIDA,5,1)+SUBS(REGIDA,6,1)
REGIDC := REGIDC+SUBS(REGIDA,7,1)+SUBS(REGIDA,8,1)
REGIDC := REGIDC+"-"
REGIDC := REGIDC+SUBS(REGIDA,9,1)+SUBS(REGIDA,10,1)
REGIDC := REGIDC+SUBS(REGIDA,11,1)+SUBS(REGIDA,12,1)
REGIDC := REGIDC+"-"
REGIDC := REGIDC+SUBS(REGIDA,13,1)+SUBS(REGIDA,14,1)
REGIDC := REGIDC+SUBS(REGIDA,15,1)+SUBS(REGIDA,16,1)
Function GerarSenha(MaxNum,Tipo)
* 1 = Somente Numeros
* 2 = Numero e Letras
* 3 = Somente Letras
local chave := ""
var_valores := { "0123456789",;
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",;
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" }[Tipo]
for i = 1 to MaxNum
num := random(len(var_valores))
chave := chave + substr(var_valores,num,1)
next
return lTrim(chave)
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Silvio,
Here is a random() function that I found somewhere.
James
/*
Here is a simple but good working random number generator for with a
period of 2^31-2. It generates uniformly distributed numbers in the
range from 0 to 1, limits included.
Clipper code donated to the Public Domain by Phil Barnett November 29, 1996
Random numbers donated to the Universe by God.
*/
static seed := 0
/*
procedure test()
local d := date()
local x
SET DECIMAL TO 16
// call it once with the seed
random( seconds() * day( d ) * month( d ) * year( d ) )
do while !lastkey() == 27
// then, call it with no parameter repeatedly
x := random()
? x
// produces random numbers in the range of 0 - 100 inclusive
?? int( x * ( 100 + 1 ) )
// produces random numbers in the range of 1 - 100 inclusive
?? int( x * 100 ) + 1
// produces random numbers in the range of 0 - 99 inclusive
?? int( x * 100 )
// inkey(.01)
enddo
return
*/
********************************************************************
function random( s )
local a := 16807 // This is just a lucky prime number
// you can hardcode these as constants for better speed
local m := ( 2 ^ 31 ) - 1
local q := int( m / a )
local r := int( m % a )
if valtype( s ) == 'N'
seed := s
endif
seed := a * ( seed % q ) - r * ( seed / q )
IF seed <= 0
seed += m
endif
return ( seed - 1 ) / ( m - 2 )
/*
Other Prime Numbers are:
38833
37171
11903
18233
31337
23339
27481
31063
34543 // an anagram prime!
36299
13691
17659
29411
If you need more, get the SIEVE.ZIP program and modify it.
*/
Here is a random() function that I found somewhere.
James
/*
Here is a simple but good working random number generator for with a
period of 2^31-2. It generates uniformly distributed numbers in the
range from 0 to 1, limits included.
Clipper code donated to the Public Domain by Phil Barnett November 29, 1996
Random numbers donated to the Universe by God.
*/
static seed := 0
/*
procedure test()
local d := date()
local x
SET DECIMAL TO 16
// call it once with the seed
random( seconds() * day( d ) * month( d ) * year( d ) )
do while !lastkey() == 27
// then, call it with no parameter repeatedly
x := random()
? x
// produces random numbers in the range of 0 - 100 inclusive
?? int( x * ( 100 + 1 ) )
// produces random numbers in the range of 1 - 100 inclusive
?? int( x * 100 ) + 1
// produces random numbers in the range of 0 - 99 inclusive
?? int( x * 100 )
// inkey(.01)
enddo
return
*/
********************************************************************
function random( s )
local a := 16807 // This is just a lucky prime number
// you can hardcode these as constants for better speed
local m := ( 2 ^ 31 ) - 1
local q := int( m / a )
local r := int( m % a )
if valtype( s ) == 'N'
seed := s
endif
seed := a * ( seed % q ) - r * ( seed / q )
IF seed <= 0
seed += m
endif
return ( seed - 1 ) / ( m - 2 )
/*
Other Prime Numbers are:
38833
37171
11903
18233
31337
23339
27481
31063
34543 // an anagram prime!
36299
13691
17659
29411
If you need more, get the SIEVE.ZIP program and modify it.
*/
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Jeff Barnes
- Posts: 912
- Joined: Sun Oct 09, 2005 1:05 pm
- Location: Ontario, Canada
- Contact:
Hi Silvio,
I don't know if this will help you but you can look at this post....
http://fivetechsoft.com/forums/viewtop ... ht=#19497
Jeff
I don't know if this will help you but you can look at this post....
http://fivetechsoft.com/forums/viewtop ... ht=#19497
Jeff
- Maurilio Viana
- Posts: 252
- Joined: Tue Oct 25, 2005 2:48 pm
- Location: Garça/Garza/Heron City - Brazil
- Contact:
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Code: Select all
Hb_RandomInt( 111111, 999999 )
- David Williams
- Posts: 82
- Joined: Fri Mar 03, 2006 6:26 pm
- Location: Ireland
KeyGen32
Hi Jeff
Can you supply the download link to KeyGen32 again as it has expired?
Many thanks
David
Can you supply the download link to KeyGen32 again as it has expired?
Many thanks
David