Thread
This command is a Flow Command. This command runs the contained commands in a separate thread from the main script allowing multiple commands to run at the same time. (Professional and Developer Editions Only)
Example 1
thread {
in new browser {
navigate("http://www.google.com", "Wait")
wait(3)
}
}
navigate("http://www.bing.com", "Wait")
Running the script will open a new browser window and navigate to google, while simultaneously navigating to bing in the main browser.
The thread command makes the simultaneous running of each command possible.
Example 2
This example demonstrates how multiple tasks can be run in different windows within UBot Studio.
Place this define command in a separate tab. The define simply clears the lists within it whenever its command is run.
define clear lists {
clear list(%ha)
clear list(%ho)
clear list(%hee)
clear list(%har)
}
In a separate tab, the loop commands for each list being displayed in the browser is placed within a thread command.
clear lists()
thread {
loop(5) {
add item to list(%ha, "ha", "Don\'t Delete", "Global")
load html($text from list(%ha, "<br />"))
wait($rand(1, 3))
}
}
thread {
in new browser {
loop(5) {
add item to list(%ho, "ho", "Don\'t Delete", "Global")
load html($text from list(%ho, "<br />"))
wait($rand(1, 3))
}
}
}
thread {
in new browser {
loop(5) {
add item to list(%hee, "hee", "Don\'t Delete", "Global")
load html($text from list(%hee, "<br />"))
wait($rand(1, 3))
}
}
}
thread {
in new browser {
loop(5) {
add item to list(%har, "har", "Don\'t Delete", "Global")
load html($text from list(%har, "<br />"))
wait($rand(1, 3))
}
}
}
When the script is run, notice that multiple windows open, and each list displays its items simultaneously and individually within each window.

