Jump to content
Sign in to follow this  
JakeLynagh

Random?

Recommended Posts

JakeLynagh

Hi, I have made a code that automatically registers to my website.

I need some help though.

Is there any way that I can make the script Pick a random name from a list and then add 4 random numbers after the name?

I want this to fill the Username field so it will go:

List:

John

Mary

Peter

Lucy

So it will pick:

Username: Mary8372

Next time it will be:

Username: John9473

And:

Username: Lucy5548

Etc.

I have this so far:

$o_IE = _IECreate ()

$site = ("http://www.website.com/Signup.aspx")

_IENavigate ($o_IE, $site)

MouseClick("left", 400, 300 )

send("{tab}{tab}email@email.com{tab}Username{tab}Password{tab}Password")

Thanks for any help at all...

I will have another question once this is worked out...

Thanks!

Share this post


Link to post
Share on other sites
stampy

Actually the function for that is called random(). It randomly picks the numbers. To randomly pick the names just associate the name with a number etc etc.

Share this post


Link to post
Share on other sites
JakeLynagh

Actually the function for that is called random(). It randomly picks the numbers. To randomly pick the names just associate the name with a number etc etc.

Thankyou!

But I am new to Autoit, how do I associate the name with a number?

Also, How do I put random(1000, 9999) in with the Send function?

I want

send("{tab}{tab}email@email.com{tab}RandomName random(1000, 9999){tab}Password{tab}Password")
Edited by JakeLynagh

Share this post


Link to post
Share on other sites
Achilles

You need to create the list, like this:

Dim $list[6] = ["John", "Mary", "Suzy", "Marry Poppins", "Beowulf", "Wolverine"]

Then you would use Random(0, 6, 1)... which would represent the index of the value in the list...

So try this:

Dim $list[6] = ["John", "Mary", "Suzy", "Marry Poppins", "Beowulf", "Wolverine"]
Msgbox(0, 'Test', $list[Random(0, 6, 1)])

Edit: tested it and updated it so that it works... Learning Java is causing me to confuse symbols...

Edited by Piano_Man

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites
JakeLynagh

You need to create the list, like this: (not tested)

$list[6] = {"John", "Mary", "Suzy", "Marry Poppins", "Beowulf", "Wolverine"}

Then you would use Random(0, 6, 1)... which would represent the index of the value in the list...

So try this:

$list[6] = {"John", "Mary", "Suzy", "Marry Poppins", "Beowulf", "Wolverine"}
Msgbox(0, 'Test', $list[Random(0, 6, 1))
Awesome thanks!

But where do I put that in my code?

Share this post


Link to post
Share on other sites
JakeLynagh

I get:

$list[6] = ("John", "Mary", "Suzy", "Peter", "Phill", "Stacy")

$list^ ERROR

Share this post


Link to post
Share on other sites
Achilles

I get:

$list[6] = ("John", "Mary", "Suzy", "Peter", "Phill", "Stacy")

$list^ ERROR

Sorry about that, look at my post and try again... It should be good now...

I forgot the "Dim", which you need before you create an array (the name for the list).. (You can also use "Global" and probably some others...)


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites
JakeLynagh

Sorry about that, look at my post and try again... It should be good now...

I forgot the "Dim", which you need before you create an array (the name for the list).. (You can also use "Global" and probably some others...)

It works now, but that upons up a popup box with a name in it.

I want it to fill it in the Registration form...

Share this post


Link to post
Share on other sites
Achilles

It works now, but that upons up a popup box with a name in it.

I want it to fill it in the Registration form...

So do something like this:

Dim $list[6] = ["John", "Mary", "Suzy", "Marry Poppins", "Beowulf", "Wolverine"]
$user = $list[Random(0, 6, 1)]
Send("{tab}{tab}email@email.com{tab}" & $user & "{tab}Password{tab}Password")
Edited by Piano_Man

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.