Get Column From List UBot Studio Function/Method

Get Column From List

download define tutorial, ubot studio stealth, ubot studio

Download This Tutorial

Hey UBotters!

First off, just to be clear, this is not the entire column!! Just the cell if you will.

I am not a fan of tables in UBot Studio. I rarely use them and discourage them when ever possible. They are not thread safe which makes your bot unable to scale well and are cumbersome to work with. I prefer lists they are much more flexible you can do more with them and are thread safe. Below I wrote a UBot function to help us get the column from a list with the default delimiter as a coma(,) as it is the most common delimiter. I also show how to nest the function to get list items inside a list!!

Do you see two lists in the example below?

username,password,proxy:port

One list is delimited by (,) and the other (:)! I am about to show you how to access the list items without a UBot %table.

UBot Define custom function

Parameters

The #DATA variable is the incoming list or delimited string. The default delimiter is a coma(,).

The #COLUMN variable is the position in the list starting at zero(0) or zero based.

The #DELIMITER is the separator that divides the list in to items. ie $new line, coma, colon, semi colon

Inside the “if” command inside the condition field there is a $comparison that checks if the #DELIMITER variable is empty/blank. If you are subscribed you can just use $is blank.

is empty, comparison

$comparison function

 

If the check returns “true” THEN

using a default delimiterSo, here we have a $list from text function inside a $list item function. The $list from text will be called first and will separate the string from the #DATA at every coma, which in this example is $next list item passed through the DATA field in the custom function “Get column from list”.  The name of the function probably makes  more sense now.

 

if the check returns “false” – else command

This time instead of the coma we use the #DELIMITER define variable/parameter to pass in any delimiter you or your user wants to use.

— see example below #column three proxy/port

The #data NLI(next list item) variable is coming from the set command at the top of the loop that holds the $next list item function which is using the %data list.

 

 

 

 

#column one variable –  is next up, this is where we see the function called/used. You will also notice I am using zero because this is how programs work as they are zero based and typically list/tables start at zero. You could change the function a bit and have it automatically subtract 1 from the input however, if you are going to get serious about programming just wrap your head around it sooner than later.

 

 

 

 

 

 

 

Above the loop we have an “add list to list” command and inside it there is a $list from text function that can easily be an $list from file function to take in a csv file. In the second tab of the UBot file I have an example of loading a .csv file. I know it sounds simple to most but sometimes when you are new it is easy to not think about such a thing with all the new information one is learning. Notice in the “text” field there is two lines, you can accomplish this with using shift + enter keys. It is useful in many text fields all over the place, even outside of UBot.

Okay, back inside the loop the #column two variable is the same as #column one with the exception of the column number(1).

 

 

 

 

#column three proxy- is using the custom function nested to get a list inside of a list delimited by acolon.

The nested function is getting the proxy and port from the last position in the list(proxy:port) first then the outer custom function is splitting the proxy from the proxy:port list with column zero with a delimiter as the colon(:). Look in the debugger(ctrl + D), you should see proxy in the #column three proxy variable

 

 

 

 

 

 

#column three port – This variable gets the port in the same way as the proxy except for the column number in the outer custom function. Looking in the debugger reveals the word “port” in this variable.

 

 

 

The debugger is telling us everything is correct!!!

Posted in Advanced Training.