Sign in to follow this  
Followers 0
t0ddie

read random lines from a txt file?

3 posts in this topic

i havent used autoit for quite awhile, and i used to use it alot

heres what i want to do.

i want to make a list of random names.

the names can be no more than 32 characters long

the name cannot start with numbers

they can not contain capital letters

they can not contain spaces

they can not contain any symbol except for underscore (_)

the underscore symbol cannot be used first, last or twice in a row

im pretty sure i can figure out how to do this, but the thing i am having trouble with, is making a loop, where it randomly reads names off of a .txt file into a variable, then adds other variables to it,like numbers, and other words until it is 32 characters long OR LESS, just meaning.. dont go over 32 characters. i want all different size names. either way, i was thinking i could make a loop

repeat,100

FileReadLine,name,names1.txt,%random%

fileappend,%name%,%A_SCRIPTDIR%\\names2.txt

endrepeat

but i want the variable %random% to change randomly

i also want underscores to be added, and i want all different sized names UP TO 32 characters

for example,

fun948_good_3

rabbit_letter99orbit_5554

beanscorelead22_23

fadsteak_intern

galacticunicorn_55235samuri_jack

then i would use some random loop where it is a 50% chance to add an underscore

to the end of the variable, then randomly find another line, add it to that,

then run through another random loop, where it decided to either continue making the name, or save it to the list.

afterwards, save it like this.

fileappend,%name%,%A_SCRIPTDIR%\\names2.txt

i pretty much just need to know how to make a random number each time for the filereadline command

any help, much appreciated

hopefully i can have this namelist maker ready soon

thanks!


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



I can't remember if AutoIt 2 provides a Random command (but I guess yes :D ). As Autohotkey is backward compatible to AutoIt 2 its command description/syntax should/could fit ...

Random

To create a loop check its syntax: Loop

All AutoHotkey commands

Share this post


Link to post
Share on other sites

if you were liking very much version 2. you will enjoy more the 3 you have a tool converter to convert as much as possible the version 2 scripts.

Good Scripting :D

Share this post


Link to post
Share on other sites
Sign in to follow this  
Followers 0