dipswitch 1 Posted October 16, 2013 Report Share Posted October 16, 2013 Hey everyone, I'm been trying to create this for the past couple of days and didn't get anywhere. I tried TJ's script but couldn't get it working. I'm trying to create a script that cycles through an accounts file and have them run in separate threads. The problem with my current script is that if I run 2 threads, it checks the first account on those two threads instead of checking two separate account on those 2 threads. Could somebody please help me? Here's my code: ui open file("Accounts", #login) clear table(&login) create table from file(#login, &login) set(#account position, 0, "Global") ui drop down("Thread Count", "1,2,3,4,5,6,7,8,9,10", #num threads) set(#num created, 0, "Global") set(#used threads, 0, "Global") loop($table total rows(&login)) { loop while($comparison(#used threads, ">=", #num threads)) { wait(1) } loop process() } define loop process { increment(#used threads) increment(#num created) registration procedure() } define registration procedure { thread { in new browser { registration code here() decrement(#used threads) } } } define registration code here { if($comparison(#num created, "<=", $table total rows(&login))) { then { navigate("http://youtube.com", "Wait") wait(5) click(<login button>, "Left Click", "No") wait(3) type text(<email field>, $table cell(&login, #account position, 0), "Standard") type text(<password field>, $table cell(&login, #account position, 1), "Standard") click(<login button>, "Left Click", "No") wait(5) increment(#account position) } else { } } } Quote Link to post Share on other sites
HelloInsomnia 1103 Posted October 16, 2013 Report Share Posted October 16, 2013 Try this, I think the problem is that you're increment the account position after it logs in so it is taking a lot of time for each thread and so the first thread doesn't finish before the second starts and therefore they both pickup the first account. Now it will grab the number and set it as a local variable (which means its unique to each thread) and then increment account position right away. So now it should work properly, unless the two threads start at the exact same time and even then I think it should still work. ui open file("Accounts", #login) clear table(&login) create table from file(#login, &login) set(#account position, 0, "Global") ui drop down("Thread Count", "1,2,3,4,5,6,7,8,9,10", #num threads) set(#num created, 0, "Global") set(#used threads, 0, "Global") loop($table total rows(&login)) { loop while($comparison(#used threads, ">=", #num threads)) { wait(1) } loop process() } define loop process { increment(#used threads) increment(#num created) registration procedure() } define registration procedure { thread { in new browser { registration code here() decrement(#used threads) } } } define registration code here { if($comparison(#num created, "<=", $table total rows(&login))) { then { set(#cur account position, #account position, "Local") increment(#account position) navigate("http://youtube.com", "Wait") wait(5) click(<login button>, "Left Click", "No") wait(3) type text(<email field>, $table cell(&login, #cur account position, 0), "Standard") type text(<password field>, $table cell(&login, #cur account position, 1), "Standard") click(<login button>, "Left Click", "No") wait(5) } else { } } } Quote Link to post Share on other sites
dipswitch 1 Posted October 16, 2013 Author Report Share Posted October 16, 2013 Thank you so much! It works perfectly. I added a delay before each thread created just to be safe lol 1 Quote Link to post Share on other sites
cmoen11 2 Posted October 17, 2013 Report Share Posted October 17, 2013 Dipswitch If you want it to be more secure you can do a random wait, and you won't make a pattern after a while... Like; wait($rand(4, 6)) Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.