Tab 1 of the UBot Boot Camp Advanced Threading with The Thread Docta Framework Pro Edition – Main Bot

Thread Docta

Threading Framework

UBot Studio – Pro Edition

Tab 1 – Main Bot


Plead not that the UI is at a state for debugging and some elements should be removed when you develop your own UI.

 

 

The first “if” command checks if 2 conditions are met. First is if the user selected a file with the “open file” UI Button with the variable #UI_OF_file IN path. The use an AND operator for the 2nd condition which is if the user entered something into the “Data in quantity” text box(TB) with the variable #UI_TB_Data in quantity. Both conditions are using the $comparison comparing to $nothing. If bot are true it will fire the “alert” command that will give the pop up “Please choose a file or enter a quantity to download!”. You can use $both to accomplish the same thing and it is easier to edit at a later time.

 

 

I created a custom function “data file IN file path” located under the Functions tab so that you would only need to update in one place rather than many. Currently there are 3 but that can easily change to many if one were to add additional bots.

 

 

 

 

 

Delete Session Data – is a custom command controlled by a UI check box(CB) the default is to delete the last session’s data from a previous run. Checked will not delete the Data folder and all its contents.

 

 

 

 

Stop Watch Reset and Stop Watch Start – are both from the “Diagnostic Plugin” to reset and start the timer you see in the UI which tells you the elapsed time of your bot.

The loop container is to set some named indexes to zero, some are fro the UI.

 

 

The next “if” command is controlled by the “Repeat?”( CB) #UI_CB_repeat if the user wished to repeat the entire cycle in a continuous/infinite loop. Unchecked during a cycle it will stop once the cycle is complete and not immediately. The loop while in the “then” uses the same variable #UI_CB_repeat as it is inside the “if” and contains the custom command Main Bot with an “increment” command to count the cycles. In the “else” is just the Main Bot only to run once. The Main Bot is passing $Data file IN path so the commands inside can use the information. One thing to note is passing a variable or a function can be two different things.

 

Functions are always global and you will never need to worry about local or global scope as you might with a variable. An example is a UI command variable verses a “local” variable inside another Define. The only way to pass a local variable to another define is through a parameter which is discussed later.

 

Then when the bot is complete we come to the “Stop Watch Stop” to stop the timer and an “alert” to notify the user it is “Done!”.

 

Then in the final section divided by the “divider” command we all the all the UI commands at the bottom nicely out of the way.

 

 

 

First of the UI commands we have the “Stat Monitor” instead of using many I combined them into this one just to get an idea of what the bot is doing and to have them in one place while designing a custom designed UI for later.

 

Next we have the “Data in quantity?” text box, it is a generic place holder for bots that require a download sequence that may require you to download a certain quantity such as account data(user name and password etc.). If it is not required then just remove the node.

 

The “How many threads?” UI command – takes the amount of threads to be created at any given cycle. If it is changed the amount wont take effect until the next cycle. Additionally you may want to give your user a suggestion to how many threads to run for your particular software. You may also want to educate them about threading and in the ”Thread Docta” style of threading, less threads is more efficient.

 

Next is another stat monitor to display the elapsed time and the session cycles(repeat index).

 

 

The UI open file button(UI_OF) – this opens a file dialog window and will contain the file path to the chosen file in the global variable #UI_OF_file IN path. It is highly recommended to use these variables even if you don’t use the UI element, Otherwise you may run into some debugging issues somewhere if you decide to change them. It would not be that difficult but it defeats the purpose of having a framework.

 

I put the next “UI button” in because the time wont stop if a crash occurs or you stop a bot manually.

 

The next node is the “UI drop down” (UI_DD)command – a menu used for headless browsing mode with two choices On to not display the browser or the default Off to show the browser(s).

 

Next we have the “UI check box” mentioned earlier to repeat continuously or run once.

 

Also mentioned before the “UI check box” for “Don’t delete session data!”- default set to delete the Data folder that is located in the same place as the .ubot or .exe file of you software.

 

Finally the last node in the first tab we have a debug switch. To stop the bot wherever the custom command “Debug Stop” is used. You can use the same technique for a “wait” or a “pause” for debugging your script.

Save

Save

Posted in Advanced Training.