JakeLynagh Posted January 23, 2008 Share Posted January 23, 2008 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! Link to comment Share on other sites More sharing options...
stampy Posted January 23, 2008 Share Posted January 23, 2008 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. Link to comment Share on other sites More sharing options...
JakeLynagh Posted January 23, 2008 Author Share Posted January 23, 2008 (edited) 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 January 23, 2008 by JakeLynagh Link to comment Share on other sites More sharing options...
Achilles Posted January 23, 2008 Share Posted January 23, 2008 (edited) 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 January 23, 2008 by Piano_Man My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
JakeLynagh Posted January 23, 2008 Author Share Posted January 23, 2008 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? Link to comment Share on other sites More sharing options...
JakeLynagh Posted January 23, 2008 Author Share Posted January 23, 2008 I get: $list[6] = ("John", "Mary", "Suzy", "Peter", "Phill", "Stacy") $list^ ERROR Link to comment Share on other sites More sharing options...
Achilles Posted January 23, 2008 Share Posted January 23, 2008 I get: $list[6] = ("John", "Mary", "Suzy", "Peter", "Phill", "Stacy") $list^ ERRORSorry 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] Link to comment Share on other sites More sharing options...
JakeLynagh Posted January 23, 2008 Author Share Posted January 23, 2008 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... Link to comment Share on other sites More sharing options...
Achilles Posted January 23, 2008 Share Posted January 23, 2008 (edited) 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 January 23, 2008 by Piano_Man My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now