Hello all
I am trying to write a script that will allow me to create a Password consisting of 2 letters followed by 4 digits where none of the characters are the same as the previous one.
I have succeeded with the script below, however, it is very inflexible as it stands.
I would like to be able to create the first character, store that into an Array, or similar, then create the second, compare that to the previous and so on, however, I do not know how to use Arrays which is a big problem.
Does anybody have a suggestion as to how I can achieve this?
Thanks in advance
Kevin
code:
$Char1 = Character(65,90)
Do
$Char2 = Character(65,90)
Until $Char2 <> $Char1
Do
$Char3 = Character(48,57)
Until $Char3 <> $Char2
Do
$Char4 = Character(48,57)
Until $Char4 <> $Char3
Do
$Char5 = Character(48,57)
Until $Char5 <> $Char4
Do
$Char6 = Character(48,57)
Until $Char6 <> $Char5
$Password = $Char1+$Char2+$Char3+$Char4+$Char5+$Char6
? $Password
Exit
Function Character( $min , $max )
$ = SRnd(@MSECS)
$ = Rnd()
$Char = Rnd($max)+$min
Do
$Char = Rnd($max)+$min
Until $Char =>$min AND $Char =<$max
EndFunction
_________________________
Kevin Cowans
Senior ICT Technician
The Armthorpe School