Sign in to follow this  
Followers 0
t0ddie

quick help with a small script please

4 posts in this topic

what i need to script, is a name generator that makes 32 character names, randomly.

the first half of the name should be any combination of letters between a-z (16 characters)

the second half of the name should be any combination of numbers between 0-9 (16 characters)

so, i would need an input box first, to ask how many names to create

so an example of what i should get if i wanted 3 names, should be something like this...

skwivnfhuryandlr9184058172645832

dhqicnahsgdytegf0198574673645624

ksjvhuryanvhxgzt9582701928746573

it should save the names to a .txt file of course...

i think i want to use an array to do this, but i need a little help...

i am going to make the script slightly more advanced, but i would like a place to start.

any help is appreciated! thanks

-Todd


Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Call RandomName() to generate a name. I use $result to simply combine the names for display with the MsgBox; use @LF to insert line-feeds

$count = InputBox("How Many?", "How many names?")
$result = ""
For $i = 1 to $count
   $result = $result & RandomName() & @LF
Next
MsgBox(4096,"Example", $result)
Exit

Func RandomName()
   Local $i, $name = ""
   For $i = 1 to 8
      $name = $name & Chr(Random(Asc("a"), Asc("z")+1))
   Next
   For $i = 1 to 8
      $name = $name & Chr(Random(Asc("0"), Asc("9")+1))
   Next
   Return $name
EndFunc
Edited by CyberSlug

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

well, heres what i got, but it doesnt make a new line in the .txt document. instead, i get a square between the names where it should have gone to the next line.

$count = InputBox("How Many?", "How many names?")

$result = ""

For $i = 1 to $count

$result = $result & RandomName() & @LF

Next

;MsgBox(4096,"Example", $result)

$file = FileOpen("names.txt", 1)

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

FileWriteLine($file, $result)

FileClose($file)

Exit

Func RandomName()

Local $i, $name = ""

For $i = 1 to 16

$name = $name & Chr(Random(Asc("a"), Asc("z")+1))

Next

For $i = 1 to 16

$name = $name & Chr(Random(Asc("0"), Asc("9")+1))

Next

Return $name

EndFunc

maybe i need to move the @LF command to another part of the script or something, i dont know. thanks for the help so far!

how do i fix this?

works good for the most part

thanks!

~T0ddie


Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites

hell yeah larry

i love you, in a totally heterosexual way

thanks also cyberslug.

~Toddie


Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0