$list from file

From UBot Studio
(Difference between revisions)
Jump to: navigation, search
 
(5 intermediate revisions by one user not shown)
Line 1: Line 1:
 
$list from file is a [[Data Functions|Data Function]].
 
$list from file is a [[Data Functions|Data Function]].
  
The function returns a list made up of each item within a file. This function, when combined with the [[Add List to List|add to list to list]] command, pulls information from a file into a list.  Items are separated by a new line in the list.
+
The function returns a list made up of each item within a file. This function, when combined with the [[Add List to List|add list to list]] command, pulls information from a file into a list.  Items are separated by a new line in the list.
  
 
'''File:''' The filepath to the file being used to create a list. The Browse button can be used to select the file from it's folder location.  
 
'''File:''' The filepath to the file being used to create a list. The Browse button can be used to select the file from it's folder location.  
Line 8: Line 8:
  
 
<pre>
 
<pre>
add list to list(%my list, $list from file("C:\\Users\\LillyT\\Desktop\\my file.txt"), "Delete", "Global")
+
add list to list(%my list,$list from file("C:\\Users\\Documents\\my file.txt"),"Delete","Global")
 
type text(<about me textarea>, $random list item(%my list), "Standard")
 
type text(<about me textarea>, $random list item(%my list), "Standard")
 
</pre>
 
</pre>
  
  
[[File:listfromfile.png]]
+
[[File:vrvr.jpg]]
 +
 
  
 
The list is populated with the items from the file. The debugger displays 6 items that have been added from from the file to the list.
 
The list is populated with the items from the file. The debugger displays 6 items that have been added from from the file to the list.
The [[Type text|type text]] command is used along with the [[random list item]] functions to populate a file with a random item from our newly created list.
+
The [[Type text|type text]] command is used along with the [[$random list item]] functions to populate a file with a random item from our newly created list.
 +
 
 +
 
  
 
== Additional Information ==
 
== Additional Information ==
  
 
To run the code for this example with a file on your system, simply change the file path in the list from file functions to the file path to the file on your system. You can also use the browse button on the function to browse for the location of your file.
 
To run the code for this example with a file on your system, simply change the file path in the list from file functions to the file path to the file on your system. You can also use the browse button on the function to browse for the location of your file.

Latest revision as of 22:25, 27 December 2016

$list from file is a Data Function.

The function returns a list made up of each item within a file. This function, when combined with the add list to list command, pulls information from a file into a list. Items are separated by a new line in the list.

File: The filepath to the file being used to create a list. The Browse button can be used to select the file from it's folder location.

[edit] Example

add list to list(%my list,$list from file("C:\\Users\\Documents\\my file.txt"),"Delete","Global")
type text(<about me textarea>, $random list item(%my list), "Standard")


Vrvr.jpg


The list is populated with the items from the file. The debugger displays 6 items that have been added from from the file to the list. The type text command is used along with the $random list item functions to populate a file with a random item from our newly created list.


[edit] Additional Information

To run the code for this example with a file on your system, simply change the file path in the list from file functions to the file path to the file on your system. You can also use the browse button on the function to browse for the location of your file.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox