One of the most useful and powerful features in Ubot Studio is that of multi-threading. Take a spin with us as we look at the three different types of threads in Ubot and how you can create some really useful code to make your automation efforts more simplified and running fast.
Multi Threading In Ubot
Lets dive right in this time and take a look at the three types of threads in Ubot along with a cool example to demonstrate the concepts.
You should see in your UI panel, the current running state of the bot, the state of a loop counter, the state of the embedded browser and several start and stop buttons to turn on and off each.
Play with the buttons as well as the main Run and Stop buttons in Ubot.
Main bot thread
The main thread for the bot is executed whenever the user presses the Ubot Run button. It isn't explicitly labeled as a thread statement but it does get executed. This is where you make calls to the high level processing logic of your bot.
UI HTML Thread
Go ahead and turn off the bot by pressing the Stop button. Now, click on the Start Test Variable Spin button. Notice that the test variable state is being updated.
But the bot is off you say.
It is, the main thread of the bot is off, but the UI HTML thread isn't. The UI panel is a component all to itself. It doesn't have to interact with the browser nor be a part of the bot's main thread. This is a perfect place to put code for doing non-related browser processing.
For lack of a better term, I chose event threads.
So you have seen three different areas within Ubot where you can creating threading units. The main thread bot which is implicitly invoked, the UI HTML panel, and in events.