$list from table

From UBot Studio
(Difference between revisions)
Jump to: navigation, search
(Example 2)
 
(One intermediate revision by one user not shown)
Line 40: Line 40:
  
  
[[File:listfromtable0.jpg]]
+
[[File:lft1.png]]
  
  
Line 61: Line 61:
 
add list to list(%names, $plugin function("TableCommands.dll", "$list from table", &editing, "Column", 0), "Delete", "Global")
 
add list to list(%names, $plugin function("TableCommands.dll", "$list from table", &editing, "Column", 0), "Delete", "Global")
 
</pre>
 
</pre>
 +
 +
 +
[[File:lft2.png]]
  
  

Latest revision as of 21:28, 12 November 2014

$list from table is a Data Function.

This function will return the contents of a specified row or column as list items. The function is used along with the add list to list command to create a list with the contents of a table.

Table: The populated table with the desired items.

Row or Column: Allows the return of the contents of an entire for or an entire column as a list.

Index: The number of the desired column or row within the table. For example "Row 1".

[edit] Example 1


navigate("http://w3schools.com/html/html_colornames.asp", "Wait")
wait(3)
scrape table(<innertext="Color Name">, &MyTable)
add list to list(%my list, $plugin function("TableCommands.dll", "$list from table", &MyTable, "Row", 0), "Delete", "Global")

Running this script will populate the list with the contents in Row 0.


Lft0.png



navigate("http://w3schools.com/html/html_colornames.asp", "Wait")
wait(3)
scrape table(<innertext="Color Name">, &MyTable)
add list to list(%my list, $plugin function("TableCommands.dll", "$list from table", &MyTable, "Column", 0), "Delete", "Global")


Running this script will populate the list with the contents in Column 0.


Lft1.png


[edit] Example 2

Need to insert an item into a specific list position?

You can use the list from table function to do just that.

navigate("http://listofrandomnames.com/index.cfm?generated", "Wait")
wait(6)
click(<type="submit">, "Left Click", "No")
wait(6)
add list to list(%names, $scrape attribute(<innertext=r"^(?<FirstName>\\w+)\\s(?<LastName>\\w+)$">, "innertext"), "Delete", "Global")
add list to table as column(&editing, 0, 0, %names)
plugin command("TableCommands.dll", "insert into table", &editing, "Row", 5)
set table cell(&editing, 5, 0, "Manny Su")
clear list(%names)
add list to list(%names, $plugin function("TableCommands.dll", "$list from table", &editing, "Column", 0), "Delete", "Global")


Lft2.png


The position we want to insert the list item to is list position 5.

We then insert a blank cell, set the table cell value to the new value, which is the name Manny Sue, and then we clear the original list and create a new list from the edited table column

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox