SaHiN 14 Posted January 14, 2013 Report Share Posted January 14, 2013 hi, thread { in new browser { navigate("bing.com", "Wait") wait(30) } } thread { in new browser { navigate("google.com", "Wait") wait(30) } } alert("---Finish---") how to make wait for thread finish later alert message? Quote Link to post Share on other sites
VentureOnline 49 Posted January 14, 2013 Report Share Posted January 14, 2013 Have a variable that gets incremented when a thread opens and decremented when a thread closes. Then have a loop while command after all the threads that loops when the variable is greater than 0. Have the loop while command wait 1 second before loops. So when it sees the variable is 0 it stops looping and then the alert goes off. 1 Quote Link to post Share on other sites
SaHiN 14 Posted January 14, 2013 Author Report Share Posted January 14, 2013 Have a variable that gets incremented when a thread opens and decremented when a thread closes. Then have a loop while command after all the threads that loops when the variable is greater than 0. Have the loop while command wait 1 second before loops. So when it sees the variable is 0 it stops looping and then the alert goes off. help me? set(#say, 0, "Global") loop while($comparison(#say, "<", 1)) { loop(1) { thread { increment(#say) in new browser { navigate("http://www.yahoo.com/", "Wait") wait(5) close page } decrement(#say) } thread { increment(#say) in new browser { navigate("http://www.yandex.com/", "Wait") wait(5) close page } decrement(#say) } thread { increment(#say) in new browser { navigate("http://www.bing.com/", "Wait") wait(5) close page } decrement(#say) } thread { increment(#say) in new browser { navigate("http://www.google.com/", "Wait") wait(5) close page } decrement(#say) } } } alert("alarm") Quote Link to post Share on other sites
VentureOnline 49 Posted January 14, 2013 Report Share Posted January 14, 2013 Here ya go. Not really the best way to do this but should give you the basic idea going forward. set(#say, 0, "Global") loop(1) { thread { in new browser { increment(#say) navigate("http://www.yahoo.com/", "Wait") wait(5) close page decrement(#say) } } thread { in new browser { increment(#say) navigate("http://www.yandex.com/", "Wait") wait(5) close page decrement(#say) } } thread { in new browser { increment(#say) navigate("http://www.bing.com/", "Wait") wait(5) close page decrement(#say) } } thread { in new browser { increment(#say) navigate("http://www.google.com/", "Wait") wait(5) close page decrement(#say) } } } wait(1) loop while($comparison(#say, ">=", 1)) { wait(1) } alert("alarm") 1 Quote Link to post Share on other sites
SaHiN 14 Posted January 14, 2013 Author Report Share Posted January 14, 2013 Here ya go. Not really the best way to do this but should give you the basic idea going forward. best helper thank you. and Add maximum thread? Quote Link to post Share on other sites
VentureOnline 49 Posted January 15, 2013 Report Share Posted January 15, 2013 You should check out this tutorial. It explains pretty much all you need to know about multi-threading. http://www.ubotstudio.com/forum/index.php?/topic/10042-new-v4-tutorial-multi-threading-example/ 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.