Knowledgebase: UBot 4
UBot Studio 4.0: Inserting Items from a Table into a field
Posted by Miriam M-B on 24 November 2011 12:18 PM

Do you want to use a file on your computer to .csv create a table in UBot Studio? Are you using a table already populated and saved onto your desktop? 

To use a file from your computer to create a table, you will use the Create Table from File command under Data commands.

Drag the Create Table from File command into your scripting window. Click the browse button within the command and browse for the csv or .txt file that contains your table. After finding and choosing the file, name your table, and click ok. You table has now been created.

 

 

If your delimiter in the file with the table (the symbol or digit that separate table items from each other) is a comma, then you are ready to go. If your table delimiter is a semi colon, colon, or any other symbol, you will need to specify that to UBot Studio. The way to do that is by clicking on “Bot” in UBot Studio, next to the Tools Menu, and clicking on Untitled Bot Properties.

You can change the delimiter from a comma to a semi colon or anything else you need to specify it as.

 



  The Table commands are found under the data commands. 



To use a table already set up in UBot, just follow the following instructions. To insert an item from a table into a field, simply drag the field into the script. 

The $Variable functions under the parameters tab in the tools window contains the table functions you will be working with. The $table cell function will allow you to pull an item from a specific cell within a table. 

Under the parameters tab in the tools window, go to the $Variable functions and choose the $table cell function, dragging it into the scripting window.




Type in the name of the table you want to work with under field titled “Table”. You will type in which column you want and which row you want. After you click ok and run the script, the list item from the specific row and column will fill your field of choice. 

IF you are trying to fill a field with each item in the table, one after the other, you will start out with a loop command. But not before going to the Data commands and selecting the Set command. 

Create and name your variable. You are going to give your variable the value of 0.



Drag the loop command into the scripting window. Go to the $variable functions and select the $table total rows function. 

You can select the $table total columns depending on how you have the information arranged in the table. By placing $total table rows or $total table columns in the loop command, you are directing the script to loop as many times as there are rows or columns. 

The loop will stop when the number of columns with information in it runs out inside your table. For this example, we will choose the $total table rows function. 

loop

After choosing, click ok to finish editing all commands and functions. Go to the filed you would like to fill and drag that field into the script. In the type text command that appears after dragging the field into the scripting window, go to the $Variable Functions and choose the $table cell function. Drag the function into the type text command in the area labeled “Text to Type”. You will be asked in the $table cell function to type in a specific row and a specific column.

Since we are trying to increment the rows of the table, instead of typing the number in the field under “row”, you will insert the variable created at the beginning of the script in the field. 

Type zero under the field for “column” 

Click ok on all functions and commands to finish editing.

set type text



Now go to the Data commands and find the Inc command. You will be incrementing the variable you created at the beginning of the script. And of course, feel free to add a wait command to allow the script to slow down as it fills the field with each item.


When you run the script, the field will be filled with each item from the table according to how many filled columns or rows you set the loop to.

looping script

There are many ways to work with information in UBot Studio, and this is one of the many ways to do so. 


Remember, do not be afraid to explore the commands, play with different combinations, until you find the combination that works exactly the way you want it to. 

The possibilities are endless with UBot Studio.


Comments (0)
Help Desk Software by Kayako Resolve
ERROR: Domain does not match license key file domain (oldsupport.ubotstudio.com), allowed domains: support.ubotstudio.com, please change the product path to match the domain under Admin CP > Settings > General Settings
This Product will not work properly unless untill that value is changed.

For more information please contact the kayako support at https://my.kayako.com