Insert a random name into a field (using TypeText)

I am testing an application, and i need the system to create mock client records. I would like the system to enter a random name from a list. I have been trying for a day and a half to figure this out, but i am having NO luck.

I have a list of names, all i need is a script that either access the TXT file containing the names pulls one out at random, and enters it into my form, using the TypeText (or some similar) command.

Or I was also thinking it may be possible to create a script that contained a list of names, and have the script somehow pick one of the names at random, and then inserting it into the appropriate field with a TypeText (or similar) command.

I found something that sounded like what i would like to use int he “Useful Sensetalk Functions” thread, but i could not get it to work. (says No handler found for function message 'folder"… plus a couple of other errors.)
http://www.redstonesoftware.com/phpBB2/viewtopic.php?t=567
I have no idea what I am doing wrong.

I tried to modify that script in countless ways, but i just could not figure it out.

SOMEONE PLEASE HELP ME!!!

Thanks in advance!

Here is what you need.

Example names.txt file


Alex
Bob
Lisa
Tom

Example code:


put file "/path/to/names.txt" into names

TypeText any line in names

If you have a text file containing one client name per line, you can select a name at random like this:

put any line of file "/path/to/nameFile.txt" into clientName

Then you can type the name using typeText:

typeText clientName

I hope that helps you get started. There are other ways to do it, too, but the “any” chunk expression is a simple way to select something at random.