Check out our new course Ubot Studio: Mastering The Fundamentals
In this video I want to talk about 3 useful functions in Ubot Studio that you may not know about and cover some examples of how and when to use them. This video is going to be a bit different than normal so be sure to leave a comment if you like the format or even if you don’t like it. Your feedback is always welcome and it helps me craft better videos for you.
So let’s get to it and dive right in with #3
The third useful function is called pad text, this can be found under the text functions section. Pad text will return your original text padded with a character. This means you can add a character to the start or end of your original text. You can also ensure that the text is a certain length.
This may sound pretty useless and I think it’s often overlooked but it does have some special use cases and I want to go over one that comes up from time to time.
Let’s say that you needed to have a series of numbers 1 to 100 in our case and they always need to be 3 digits. So the first number is 001 and the next is 002 and so on.
This is when pad text is going to be useful. You can pad the numbers with a 0 character and set the desired length to be 3. Pad text does all the heavy lifting and will ensure that if the digits are less than 3 a 0 will be added to the side you specify.
While pad text may not be something you use in every bot, the next function I want to talk about is something you are going to want to use all the time.
The second useful function is actually two functions. But they are so similar that I want to talk about both of them together.
I am talking about the is blank and is number functions, both of which can be found in the bot bank under the advanced text section.
Now don’t worry if you don’t have access to the bot bank because I will show you a workaround for these. But if you do have access to the bot bank then these functions are quick and easy to use and will speed up your coding.
Is blank simply looks to see if the text to check is either blank or white space, if it is then it will return true. This is a great way to validate user input. You can ensure that your user entered something for the field you want to check.
You can also use it for other purposes such as seeing if the text you scraped is blank.
Is number will check to see if the text to check only contains numbers. This is another great function to use for input validation. If you expect your user to enter a number into a field you can use this function to ensure they entered a number and not something else.
Another use is to ensure what you are scraping is a number. If you expect a number and get something else that may be a sign that something has gone wrong and your bot can self correct itself or maybe send you an email saying something isn’t quite right.
Now I’ll show you some work around.
For is blank you can simply use a comparison function and check to see if the first value equals nothing. This is pretty quick and easy so if you don’t have access to the bot bank it’s just a little bit of extra work to do this.
However, if you want to check for a number it’s going to be a bit more involved.
What you can do is use a comparison function again, but this time in the first value you will need to use a regular expression. You can use a backslash, then the letter d for digit and then a plus sign. This will look to see if there is one or more numbers.
Then use the equals sign as the condition and for the second value put the text you want to check in there as well.
This will check to see if there is one or more numbers and if so will return them to the first value. Then if the first value equals the second we know that the text only contains numbers. If the text contains anything else then the first value will be shorter than the second.
And now I want to talk about the number one useful function you may not know about. That is subtract lists which is located under the data functions section.
Subtract lists will allow you to remove items from one list based on another. It does this by returning the unique items from the first list, so that you can add those to another list.
It’s probably easier to just show you how this works rather than trying to draw out an explanation.
So these are a few functions you may not have known about before. This video was a bit different so If you liked this format be sure to leave me a comment and let me know. Also, be sure to subscribe to this Youtube channel so you can get updates and check out Elite Botters dot com as well.
Thanks for watching and I’ll see you in the next one!
In this video I want to cover the latest update for version 5.9.55. There were a couple of small fixes as well as a bunch of new commands and functions added.
So let’s dive right in.
The first issue was regarding drag and drop not working properly in the last version. This was referring to dragging elements from the browser into the scripting area.
In the past I’ve been able to crash the browser by using this feature on certain web sites. I have checked in this version and replicating that does not crash the browser any more. Also, the responsiveness feels good when using this feature now.
That being said I’ve only used it a little bit and so it’s’ hard to say how well it really works just yet.
In fact I suggest not using this feature if you can help it because of the problems it’s had in the past. Instead, you can drag out the command you want first and then use the element selector.
But if dragging from the browser into the scripting area is more comfortable for you then hopefully this update solves the issues it’s been having.
The next update addresses the issue of playing videos on Facebook and Vimeo. One of the examples is: https://vimeo.com/227890020
And it looks like it plays just fine.
Finally, the bot bank had duplicate items showing, and this has now been fixed as well.
That wraps it up for the bug fixes, all around pretty minor but at least it’s a step in the right direction.
There are a bunch of new commands and functions in this update for audio as well as images. These are a nice addition since we already have a bunch of video commands – although people have had issues with those video commands.
Now all of these are in the bot bank and so you will only be able to access them if you are subscribed to updates.
However, that being said these commands along with the video commands are all using libraries which support command line operations. So that means you can basically do all of these commands on your own by using the shell command.
I can’t get into that in this video but what I will say is this.
The video commands use FFmpeg. And you can use the shell command to call the ffmpeg.exe along with some command line arguments, these arguments can be looked up online.
The image libraries are ImageMagick.
And the audio is using Lame and SoX, and that is spelled S – O – X
Again you will need to look those up but generally they just involve using the shell command and some arguments.
So the first thing you need to do when working with these commands is to ensure that you have the libraries, and you can use the verify audio, image and video library commands to do that.
Now there is a lot to cover in regards to the new image and audio commands, and I haven’t had enough time to dive deep and test them out. But I can at least show you most of them and hopefully you can see what’s possible and get some ideas from it.
I showed most of the commands and functions in this video but I encourage you to explore these features further. There’s quite a lot here so hopefully you find it useful.
That’s going to do it for this video, I’ll see you in the next one.
In this video I am going to show you the exact process I take to do multithreading in Ubot Studio.
I have used this technique in hundreds of bots, including the account creator we are going to make today.
I see people asking on Ubot forums all the time about multi threading and using Thread Spawn, and so I wanted to make a video showing you the right way to do multi threading in Ubot Studio.
The truth is that you don’t need thread spawn in order to do multithreading and doing it the right way gives you more control over the process. More control is better because it can lead to less errors and headaches later on. I know multithreading can be scary to some but I will break it down and show you that it’s pretty straight-forward and easy to do.
So let’s jump right in and learn the exact process I use.
Today we will be making an account creator for a form on the Ubot Playground.
First of all I am going to get rid of all this code so that we can make this together step-by-step.
Before we begin we need to list our requirements for this project:
- We need to make an account creator for the simple form on Ubot playground.
- This account creator should be able to be ran multi-threaded
- We should be able to control the thread count, it should not be fixed
- Accept a number of accounts to create
- Use random account information for the username and password fields
- First name, last name, and about me fields are spun text
- Save the username and password to a list
As you can see we have a number of specific requirements that should be met for this project.
So let’s get started.
The first thing I always want to do when creating a multi-threaded program is to make the core part of the program, and test that to ensure that it works before adding any multi-threaded logic.
Once the program is multithreaded you don’t want to do any major debugging. In fact the only debugging you should be doing at that point should be related to the multithreading logic itself, and not the core of your program. If you find any problems with the core of your script then copy it out from the multi-threaded environment so that you can properly debug it.
With that in mind let’s make the core part of the program, and in this case it’s pretty simple, we need to go to a webpage and fill in a form.
Recall that requirements 5 and 6 have to do with the information to be filled in. Requirement 5 states that we should “Use random account information for the username and password fields” and 6 says “First name, last name, and about me fields are spun text.” We can take care of that part now, and then later modify it for multi-threading.
Our last requirement says that we need to save the username and password combination to a list, we can also do that now.
Now we have the core of the application, the part that is doing the actual work. So now we should run this a couple of times to be sure we get the expected results.
In the real world your application would be much more complex than this. You would want to have built in logic to solve problems such as:
- Info already taken such as username, or email
- Invalid passwords
- Failed captchas
- And more
For now we want to keep it as simple as possible just to demonstrate how multi-threading works, so with that in mind we won’t be doing any more than this.
So let’s run it a couple of times and make sure it does everything we expect.
Now we can fulfill requirement number 4 which was to accept the number of accounts to create. This is simply just going to be the number of times we loop.
Because I know that we are going to multi-thread this I am going to save some time and put the main process in it’s own custom command. For more complex programs you may already have done this, and you should be doing this if you are not yet.
Now I can just drop the custom command into a loop and add the user input.
We can give this another test to ensure we still don’t have any problems.
Now that we have the core of our program we can now work on the multithreading part. Multithreading scares a lot of people because they think that it’s complicated. But I don’t want you to think about it that way. Remember that at this point we have already made the core of the program and we know that it works. Now all that is left is creating a little bit of code to manage how many threads can run at once.
To accomplish this we only need a few simple things:
- We need to know how many threads can run at once
- We need to limit the application so that it does not exceed that number
- And finally, we need to know when a thread starts and ends
And that is really all there is to it. When you break down multithreading it’s not really all that complicated. Our job is to make sure that no more than a certain number of threads are running at the same time. And to do that we only need to use a little bit of code.
Now the first thing we need to do is make sure that we know how many threads the user wants and to accomplish this task we can use a dropdown. We use a drop down here because that way we can control the input. Not only are we limiting the input only to numbers but we can also specify a minimum and maximum thread count.
Now that we know the thread count our job is to simply ensure that the number of open threads does not exceed that number.
So let’s first ensure that the part we want to be multithreaded – is in a thread.
We need to keep track of the open threads so that we don’t exceed the max thread count. To do this we can simply use a variable.
So far we already know how many threads to run and we already know when a thread begins and ends. Believe it or not were already almost done, now all we really need to do is limit how many threads are open at once and we can do that using a loop while.
So you are going to want to put this above the increment.
This loop while is the heart of the multithreaded code, it controls how many threads are open at one time.
Now that is basically it, however, there is a few extra bits we need to add to really make this work well in all situations.
The first is really important, we need to put a small wait after we create a new thread. This is going to make sure everything runs smoothly and will essentially eliminate any errors that you would normally see while multithreading.
And finally, once our main loop is finished we will likely still have open threads. So typically you want to wait until all threads are finished before letting your program continue.
To do this we simply put a loop while after the loop which contains your multithreaded logic.
And that’s all there is to it. Now our application will allow the user to specify the number of threads and the program will not exceed that number. When the main loop is finished the program will wait for all threads to finish as well before continuing.
And now that our program is multithreaded we can give it a shot.
At this point we have fulfilled our 7 requirements. We have made an account creator and then multi-threaded it. The program accepts a number of accounts to create as well as the thread count. We are using random account information and save off the username and password to a list.
The multithreading part was achieved simply by accepting a maximum thread count and then managing it with a loop while. We kept track of when threads open and close simply by incrementing and decrementing a variable. And when our main loop was finished we waited for all threads to finish before allowing our script to continue.
I hope you can see that multithreading is fairly straight forward and easy to implement. If you liked this video please feel free to like and subscribe and don’t forget to check out Elite Botters.com as well.
That’s going to do it for me for this one. If you have any questions leave them in the comments section below and I’ll see you in the next video.
In this video I am going to show you how to get all images in a folder, or really any file type that you need. It can be PDFs, CSVs, TXTs and so on. Basically any extension that you want to target you can get this way. Most people are looking for images but you can use it with anything.
The first thing you need to do is get all of the files in your target folder into a list.
From here there is a number of things you can do, first I’ll show you how to target one extension, then multiple and then another way as well.
To get one extension you can use the ends with function. This does require you to be subscribed to Ubot updates but don’t worry because I’ll show you another way in a minute.
The next way is to use a regular expression and this can target one or more extensions. You also do not have to be subscribed to Ubot updates for this one which is nice.
Finally, the last way is to use the File Management plugin and then to use the get extension function, from here you can check the extension using comparison or check it against an entire list of extensions if you want.
So that’s how you can get all of the files you want out of a folder and into a list. I hope you enjoyed the video, feel free to subscribe and I’ll see you in the next one.