Jump to content
UBot Underground

wait for thread finish?


Recommended Posts

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?

Link to post
Share on other sites

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.

  • Like 1
Link to post
Share on other sites
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")
Link to post
Share on other sites

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")
  • Like 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...