Ubot Studio is a powerful web automation software which allows you to quickly and easily build scripts and bots. These bots can be compiled and run as a standalone application.
Ubot features a visual scripting system which allows you to drag out nodes and fill in their parameters rather than writing code. These nodes are translated into uScript which you can also directly write while in code view.
Ubot uses a procedural programming paradigm. So there are no classes or objects. While programming in Ubot you will be creating custom commands and functions which can be accessed by any part of the program.
There are a few different versions of Ubot Studio. This is the developer edition which is the most featured. If you have another edition yours may look slightly different but don’t worry because most of the stuff we talk about in this video will work fine for any edition.
This is the scripting area.
The scripting area is where you can drag commands in order to create a script. You can find commands by looking under the commands section of the toolbox.
Let’s create a simple hello world script:
We can run a script by pressing the Run button. Scripts are ran top to bottom and each command is called one after the other. The run button will run the script in the current tab. To add another script we can press the add new script button.
Let’s name this script “Hello Ubot”
And now I’m going to use another alert command. But this time instead of looking through the toolbox trying to find the command I am going to search the toolbox by pressing Ctrl + E
Now that I’ve created a new script let’s run it.
Let’s create one more script and name it “Time.” I want to use a function called $date, this can be found with all of the other functions under the Parameters section. The sub section is called Time Functions.
Notice that when I drag this function into the scripting area we see a cancel sign and we are not allowed to drop this node into the scripting area. That is because the scripting area only allows commands to be used – that is why it says “Drag Commands Here.”
So how can we use this function?
First, we need to use a command directly in the scripting area. Let’s use the alert command again. Now in this alert command we have a parameter named “Message.” In this parameter field we can type normal text, or we can use functions here. Which means that I can drag the $date function into the message parameter of the alert command.
And we can now run this.
So the difference between commands and functions is that commands perform an action and functions return data. Our alert command is performing the action of displaying a message to the user. And our message just so happens to be a function. That function is returning the data to the message parameter. In this case the date.
I know this might be a bit confusing for some so I am going to say this one more time but in reverse order.
$date is a function and functions return data. Our date function simply returns the date. So that means anywhere you put this function it will essentially replace this function with the date.
Our alert command has a parameter which is called Message. And anything we put in the message parameter will be displayed to the user. Because we put the date function in the message parameter we will see the date when we run the script.
Now some functions have parameters of their own. Let’s look at the $trim function. This function has a parameter named “Text” and when we put a bunch of spaces before our text the trim function will remove any leading or trailing whitespace.
But the main reason I wanted to show you this function is to point out that functions can contain parameters as well. And something you should know about parameters is that they can only contain plain text, functions, selector code, and data types which we will get to soon.
So that means that I cannot put a command inside of a parameter.
I can put a function in here though, which means that I can nest several functions inside each other if I wanted.
Sometimes parameters want a specific thing such as a data type or selector code. In these cases the parameter will have a different color.
Let’s take a look at the increment command. This has a parameter for a variable. We can tell because it says Variable and it has a purple background. If we look at the bottom of the parameters section we can see Variables, Lists and Tables and if we expand each we will see they all have a unique color. These are the data types in Ubot Studio.
A variable is the simplest data type. It allows you to store a string inside of it which can be called later. To create a variable we can use the set command.
Anywhere we use the variable it will essentially be replaced with whatever data is inside of it. Let’s first alert the variable and then increment it.
Increment has this variable parameter, so we can use our #num variable in this field.
The other data types in Ubot are lists and tables.
Lists store a collection of strings. We can setup a basic list by using the add list to list command.
Our starting list is the name we want to give our list. The list to add is the collection we want to add to the list.
In this case the parameter is asking for a list and so that means that we can’t put a variable here. We also can’t put something like the $date function we saw earlier. However, we can put a function named “list from text” because this is going to return a collection to our list.
This is a common way to create a list, another function that will work here is named “list from file.”
Let’s create a basic list 1,2,3,4,5 and press run.
Now we have a list called numbers with 5 items on it. But we didn’t really get any feedback from Ubot. Nothing popped up and told us good job you now have a list! So how can we see the data in this list?
This is where the debugger comes into play. We can view the debugger by going to View -> Debugger – or by using the shortcut Ctrl + d
The debugger will show you all the variables lists and tables in your entire project. And it will show you the values of all global data types. Because everything is set to global by default we can see our list and our variable values.
Now let’s start using this list with some of the most common list commands and functions.
Usually it’s a good idea to clear lists before using them. And the reason for this is because data persists in Ubot until it is either cleared or you create a new project in Ubot or close Ubot.
So that means that even before I set the data in this list again I can use it because we have already set the data from the last time we pressed run. Let’s go ahead and see that in action:
So we ran the script and the first thing that happened was we displayed an alert to the user which showed how many items were on the list. And because we had already set some list data from the previous run we saw there were already five items on the list. After that we added 5 items to the list, so how many items are now in this list?
Let’s look at the debugger. There are still five items! But wait how does that make any sense? Well the reason for this is because when we went to add the second set of items, Ubot found that they were all duplicate items and so it removed them from the list after adding them. We can change that option under the advanced section and see what happens now.
As you can see now each time we run this script we add another five items to the list.
Going back to what I was saying earlier, usually we want to clear a list before using it, so let’s do that now.
One of the most common ways to use lists is to iterate over the collection using each of the items. And in order to do that we are going to need a loop.
In this case we want to loop for the amount of items in a list and so we can use a function called list total to return the number of items in the list.
We can use a function called next list item to help us easily iterate over the list. Next list item will call the current list position and then increment it by one.
In Ubot, lists and tables start their positions at zero. So the first list item is at position zero and the second is at position one. If we open the debugger we can see each list items position which is bolded.
Now our script is going to iterate over the list and use each item.
The final data type in Ubot is a table. A table has rows and columns and you can think of it like a spreadsheet. Behind the scenes a table is literally a 2D string array.
Much like a list, it’s usually a good idea to clear your tables before using them. Again, don’t forget that data will persist in a bot between runs.
Now let’s add a person to our people table. There are a few ways we can add data to a table, we can use create table from file, or create table from text. There are even other commands that help us create tables. Most of these are going to expect a CSV or comma separated value format. So if you have a CSV file you could use the create table from file command to easily import your table.
But in this case we are going to keep it simple and use the set table cell command. Let’s make our first row the title of each column and name our columns first name, last name and age.
We can run this and look in the debugger to see the value of our table.
Finally, we can add a person to our table.
We can retrieve specific info about this person by using the $table cell function, this will return the data of that specific table cell.
And we could iterate over the table using the function table total rows to get the row count. In this case I am just going to alert it.
Now let’s talk about the if command.
The if command is used for making decisions in your program. It takes one parameter which expects a true or false statement. At the most basic you can literally write true or false to see how the if command works:
The If command is generally used with the qualifier functions. And some of the common qualifier functions are $contains, $exists and $comparison.
Let’s cover some of the ui commands so that you can accept input from the user.
ui text box allows you to accept a string from the user. That string is then stored in a variable that you can call. In this example we will ask the user for their name and then display it to them via an alert.
ui password is the same thing but masks the characters.
Block text allows for multiline input.
Checkbox allows you to have a boolean value which is either true or false.
Drop down is a great one to use when have a list of values you want the user to choose from. Alternatively you can use list box.
Button allows you to run commands when the button is clicked.
Ui open file and save file allow the user to choose a file on the computer, the path to the file will be stored in the variable.
And once you have a file path you can do several things with that file. If you look under the file commands you can see that you can save to a file, rename a file, move, append to, delete or copy files. And most of the same operations can be done on folders as well.
Most of these are simple commands which only need a file path and sometimes one other parameter.
You can create your own commands and functions using the define command. Once you create a command or function it will show up in the toolbox and be searchable as well.
You can also add parameters to your command or function.
Now I want to cover a few more things about the general Ubot interface.
To compile a bot you can click on File -> Compile then choose an output file and press Compile. If you have the developer edition you will have another tab named “Developer Options” which gives you more control on the look of the compiled program.
If you want to use Git then you can save your project as a project folder. To do this choose File -> Save as project folder and this will save each script individually. This is different than the normal behavior which would store all the scripts together in a single archive.
In the Edit menu you can quickly collapse or expand nodes. This is handy when you have a lot of custom commands in one tab.
The view menu option has several little editors you can play with. I won’t be covering these in this video and you don’t need to know them in order to use Ubot effectively.
Under the tools menu item you can add captcha accounts.. This is also where you will find the plugins menu. You can add, remove or activate plugins in this menu. Under the options menu item you have various options including the option to change the internal browser. This option requires you to restart Ubot in order for it to load the other browser.
The green icon with the globe on it is the bot bank. These are extra commands which are available to you if you are subscribed to updates. To get back to the toolbox click on the blue icon with the wrench on it.
Some editions have code view. This isn’t necessary to have in order to make bots but it will make your life easier in some situations.
The step button will allow you to step through your code. This is useful for debugging when you want to pause after each command.
Let’s go to the simple form on the Ubot playground so we can start to talk about the web browser.
We can drag out a navigate command and Ubot will prepopulate the URL parameter. When we press run you will see that the internal web browser now navigates to the URL.
There are a couple of ways we can interact with the web browser. We can click on the “Start Recording” to record actions taken in the web browser.
When you’re done recording be sure to hit Stop Recording.
Another thing you can do is right click on a field you want to interact with and then Ubot will suggest a command to use.
You can also simply drag an element into the scripting area and Ubot will change that into the command that it thinks is most appropriate.
Finally, you can choose your command first and then use the element selector to choose an element.
Once you have a command that is chosen you need to fill in the element selector parameter. Using some of these methods an element will already be filled in and in some cases you won’t have to modify this.
However, sometimes you will need to make changes. And to do this you need to use the Advanced Element Editor. To get to that window simply click on the blue gear icon.
In the advanced element editor you can choose an HTML element on the left and have it’s outerhtml shown on the right. Once the element is chosen you can select attributes to target for this element. You can choose to add more than one attribute to help narrow down the exact element you need.
Another thing you can do here is use a wildcard or a regular expression to help you target the value of your attribute. This can be useful when you know that a part of your attribute may change.
Now let’s show an example of using scrape attribute. Let’s try to get all of the h3 tags on the page.
That’s works but it would probably be better to put this one into a list.
Now let’s say that I only wanted the first header, we can use a function called element offset to do this and remember that positions start at zero.
We can now control Firefox and Chrome in Ubot Studio X using a new command called in external browser.
You can just use the normal browser to build the commands and then put them in the in external browser command and run your script in Chrome or Firefox.