sunny9495 42 Posted September 20, 2014 Report Share Posted September 20, 2014 Can you guys please help,i have stucked in multi-threading one.it still opening only one 1 threads,but i have set it to 2 threads I have followed the tutorial in this post. http://www.ubotstudio.com/forum/index.php?/topic/10042-new-v4-tutorial-multi-threading-example/ Here is the code set(#threadcount, 0, "Global") set(#numthreads, 0, "Global") set(#loopcnt, 1, "Global") set(#email tab, "xsretsdgsdf@gmail.com", "Global") loop(#loopcnt) { loop while($comparison(#numthreads, ">=", #threads)) { wait(1) } Intiate Threading() } ui drop down("Threads", "2,4,6,8,10", #threads) define Intiate Threading { increment(#threadcount) increment(#numthreads) routine2threads() } define routine2threads { thread { in new browser { Reg() decrement(#numthreads) } } } define Reg { Reddit() Delicious() } define Reddit { set(#username, $account data("Username"), "Global") set(#password, $account data("Password"), "Global") navigate("http://reddit.com", "Wait") wait for element(<innertext="REDDIT and the ALIEN Logo are registered trademarks of reddit inc.">, "", "Appear") click(<login link>, "Left Click", "No") wait for element(<image="___IMAGE___1___IMAGE___">, "", "Appear") type text($element offset(<username field>, 1), #username, "Standard") type text(<email field>, #email tab, "Standard") type text($element offset(<password field>, 0), #password, "Standard") type text($element offset(<password field>, 1), #password, "Standard") type text(<name="captcha">, $solve captcha(<class="capimage">), "Standard") click(<create account button>, "Left Click", "No") } define Delicious { set(#username, $account data("Username"), "Global") set(#password, $account data("Password"), "Global") set(#FullName, "{$account data("First Name")} {$account data("Last Name")}", "Global") navigate("http://delicious.com/", "Wait") wait for element(<innertext="© Delicious Science, LLC">, "", "Appear") click($element offset(<create account link>, 0), "Left Click", "No") wait for element(<innertext="Sign up with your email address Already have a Delicious account? Sign in">, "", "Appear") click($element offset(<create account link>, 2), "Left Click", "No") wait for element(<class="terms">, "", "Appear") type text(<full name field>, #FullName, "Standard") type text(<email field>, #email tab, "Standard") type text(<username field>, #username, "Standard") type text(<password field>, #password, "Standard") wait($rand(2, 5)) click(<create account button>, "Left Click", "No") } can anyone please help Quote Link to post Share on other sites
Bot-Factory 602 Posted September 20, 2014 Report Share Posted September 20, 2014 Couple of things: 1. Use V4. V5 is broken with threading at the moment2. To count threads you should use a plugin. Variables don't work reliable in that case. http://www.ubotstudio.com/forum/index.php?/topic/15441-free-plugin-threads-counter-ubot-v4-threading-fixed/ Highly recommend:http://www.ubotstudio.com/forum/index.php?/topic/16713-sell-smart-thread-plugin-easy-threading/ Dan Quote Link to post Share on other sites
sunny9495 42 Posted September 20, 2014 Author Report Share Posted September 20, 2014 I tried in V4 too.but the threading not worked in it.Couple of things: 1. Use V4. V5 is broken with threading at the moment2. To count threads you should use a plugin. Variables don't work reliable in that case. http://www.ubotstudio.com/forum/index.php?/topic/15441-free-plugin-threads-counter-ubot-v4-threading-fixed/ Highly recommend:http://www.ubotstudio.com/forum/index.php?/topic/16713-sell-smart-thread-plugin-easy-threading/ Dan Quote Link to post Share on other sites
Pete 121 Posted September 20, 2014 Report Share Posted September 20, 2014 Its clear by your script you don't understand how to multithread this is why it's not working, So it's your code which is broken not ubots threading I would suggest you use just a single thread until you learn more about ubot studio and how it worksAs this will be less painful for you Quote Link to post Share on other sites
Bot-Factory 602 Posted September 20, 2014 Report Share Posted September 20, 2014 I tried in V4 too.but the threading not worked in it. Please read the following thread:http://www.ubotstudio.com/forum/index.php?/topic/15441-free-plugin-threads-counter-ubot-v4-threading-fixed/ It also has some examples. Threading is one of the most complex things you can do in ubot. Your code should work perfectly in single thread mode first. Everything in define commands with local variables. As soon as that's done you can look into threading. Dan Quote Link to post Share on other sites
sunny9495 42 Posted September 20, 2014 Author Report Share Posted September 20, 2014 Thanks Dan.Please read the following thread:http://www.ubotstudio.com/forum/index.php?/topic/15441-free-plugin-threads-counter-ubot-v4-threading-fixed/ It also has some examples. Threading is one of the most complex things you can do in ubot. Your code should work perfectly in single thread mode first. Everything in define commands with local variables. As soon as that's done you can look into threading. Dan Quote Link to post Share on other sites
sunny9495 42 Posted September 20, 2014 Author Report Share Posted September 20, 2014 Hi Zap,i just followed the tutorial and something went wrong.If you know where i have done wrong,just guide me about that.Why the HELL you saying that "you dont know anything about threading." This is not fair as being an advanced member of this forum.Its clear by your script you don't understand how to multithread this is why it's not working, So it's your code which is broken not ubots threading I would suggest you use just a single thread until you learn more about ubot studio and how it worksAs this will be less painful for you 1 Quote Link to post Share on other sites
Pete 121 Posted September 20, 2014 Report Share Posted September 20, 2014 I said it because of your post tilte "Can you guys please help," and its true Can I guide you no, and don't raise your voice at me Quote Link to post Share on other sites
sunny9495 42 Posted September 20, 2014 Author Report Share Posted September 20, 2014 Zap,Iam not raising voice on you.iam just saying that its not fair of saying that.everyone here in the forum will help each other.every newbie will post here for help.what if they get this kind of responses from advanced members.I said it because of your post tilte "Can you guys please help," and its true Can I guide you no, and don't raise your voice at me Quote Link to post Share on other sites
Pete 121 Posted September 20, 2014 Report Share Posted September 20, 2014 The responses was useful as you clearly need to learn more about ubot before you can do this so you don’t need guiding as you said but spoon feeding step by stepHere is your script rewritten “but the logic is floored” ui drop down("Max Threads", "2,4,6,8,10", #threadsmax) ui text box("Number of acccounts<br>to create", #accountsnub) set(#threadrunning, 0, "Global") set(#email tab, "xsretsdgsdf@gmail.com", "Global") loop(#accountsnub) { Reddit() Delicious() loop while($comparison(#threadrunning, ">=", #threadsmax)) { wait(1.500) } } define Reddit { increment(#threadrunning) thread { in new browser { set(#username, $account data("Username"), "Local") set(#password, $account data("Password"), "Local") navigate("http://reddit.com", "Wait") pause script wait for element(<innertext="REDDIT and the ALIEN Logo are registered trademarks of reddit inc.">, "", "Appear") click(<login link>, "Left Click", "No") wait(1) wait for browser event("DOM Ready", 15) wait(1) wait for browser event("Page Loaded", 30) type text($element offset(<username field>, 1), #username, "Standard") type text(<email field>, #email tab, "Standard") type text($element offset(<password field>, 0), #password, "Standard") type text($element offset(<password field>, 1), #password, "Standard") type text(<name="captcha">, $solve captcha(<class="capimage">), "Standard") click(<create account button>, "Left Click", "No") } decrement(#threadrunning) } } define Delicious { increment(#threadrunning) thread { in new browser { set(#username, $account data("Username"), "Local") set(#password, $account data("Password"), "Local") set(#FullName, "{$account data("First Name")} {$account data("Last Name")}", "Local") navigate("http://delicious.com/", "Wait") pause script wait for element(<innertext="© Delicious Science, LLC">, "", "Appear") click($element offset(<create account link>, 0), "Left Click", "No") wait for element(<innertext="Sign up with your email address Already have a Delicious account? Sign in">, "", "Appear") click($element offset(<create account link>, 2), "Left Click", "No") wait for element(<class="terms">, "", "Appear") type text(<full name field>, #FullName, "Standard") type text(<email field>, #email tab, "Standard") type text(<username field>, #username, "Standard") type text(<password field>, #password, "Standard") wait($rand(2, 5)) click(<create account button>, "Left Click", "No") } decrement(#threadrunning) } } Quote Link to post Share on other sites
arunner26 51 Posted September 21, 2014 Report Share Posted September 21, 2014 zap,Thanks for providing the modified code.I was watching this thread and wondering what the correct code was.It will be good to compare the original and your code to learn the fix. UPDATE: I put the 2 sets of code into a file compare utility and it was excellent for leaning. Quote Link to post Share on other sites
sunny9495 42 Posted September 21, 2014 Author Report Share Posted September 21, 2014 Thanks ZAP.Thanks Alot.You earned respect & gratitude from me. The responses was useful as you clearly need to learn more about ubot before you can do this so you don’t need guiding as you said but spoon feeding step by stepHere is your script rewritten “but the logic is floored” ui drop down("Max Threads", "2,4,6,8,10", #threadsmax) ui text box("Number of acccounts<br>to create", #accountsnub) set(#threadrunning, 0, "Global") set(#email tab, "xsretsdgsdf@gmail.com", "Global") loop(#accountsnub) { Reddit() Delicious() loop while($comparison(#threadrunning, ">=", #threadsmax)) { wait(1.500) } } define Reddit { increment(#threadrunning) thread { in new browser { set(#username, $account data("Username"), "Local") set(#password, $account data("Password"), "Local") navigate("http://reddit.com", "Wait") pause script wait for element(<innertext="REDDIT and the ALIEN Logo are registered trademarks of reddit inc.">, "", "Appear") click(<login link>, "Left Click", "No") wait(1) wait for browser event("DOM Ready", 15) wait(1) wait for browser event("Page Loaded", 30) type text($element offset(<username field>, 1), #username, "Standard") type text(<email field>, #email tab, "Standard") type text($element offset(<password field>, 0), #password, "Standard") type text($element offset(<password field>, 1), #password, "Standard") type text(<name="captcha">, $solve captcha(<class="capimage">), "Standard") click(<create account button>, "Left Click", "No") } decrement(#threadrunning) } } define Delicious { increment(#threadrunning) thread { in new browser { set(#username, $account data("Username"), "Local") set(#password, $account data("Password"), "Local") set(#FullName, "{$account data("First Name")} {$account data("Last Name")}", "Local") navigate("http://delicious.com/", "Wait") pause script wait for element(<innertext="© Delicious Science, LLC">, "", "Appear") click($element offset(<create account link>, 0), "Left Click", "No") wait for element(<innertext="Sign up with your email address Already have a Delicious account? Sign in">, "", "Appear") click($element offset(<create account link>, 2), "Left Click", "No") wait for element(<class="terms">, "", "Appear") type text(<full name field>, #FullName, "Standard") type text(<email field>, #email tab, "Standard") type text(<username field>, #username, "Standard") type text(<password field>, #password, "Standard") wait($rand(2, 5)) click(<create account button>, "Left Click", "No") } decrement(#threadrunning) } } Quote Link to post Share on other sites
Pete 121 Posted September 21, 2014 Report Share Posted September 21, 2014 Thanks for providing the modified code.I was watching this thread and wondering what the correct code was.As I said in the post the logic in this code is very poor I just cleaned up the existing code a little,But I would not say this is the correct code, Quote Link to post Share on other sites
bigmatt 0 Posted September 25, 2014 Report Share Posted September 25, 2014 Dunno why, but when I was using ubot back in the days, I always had the problem that whenever I used multithreading, my success rate was dropping substantially 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.