$read file
From UBot Studio
(Difference between revisions)
(6 intermediate revisions by one user not shown) | |||
Line 1: | Line 1: | ||
− | $read file is a [[ | + | $read file is a [[Data Functions|Data Function]]. |
The function returns the contents of a file. The read file function can also be used call a file from a URL location by placing the url within the function in place of a file path. | The function returns the contents of a file. The read file function can also be used call a file from a URL location by placing the url within the function in place of a file path. | ||
+ | |||
+ | |||
+ | '''File:''' The filepath to the file being read. (Can be a file path or a url) | ||
== Example == | == Example == | ||
<pre> | <pre> | ||
− | type text(<about me textarea>, $read file("C:\\Users | + | type text(<about me textarea>, $read file("C:\\Users\\Desktop\\my file.txt"), "Standard") |
</pre> | </pre> | ||
− | [[File: | + | [[File:rft2.jpg]] |
+ | |||
Running the script fills the specified script with the contents of the file specified with the read file function. | Running the script fills the specified script with the contents of the file specified with the read file function. | ||
− | |||
− | + | [[File:ytyb1.jpg]] | |
+ | |||
+ | |||
+ | Replace the file path with a url to return the contents of the file. | ||
+ | |||
<pre> | <pre> | ||
Line 20: | Line 27: | ||
</pre> | </pre> | ||
− | [[File: | + | |
+ | [[File:ytyb2.jpg]] | ||
+ | |||
== Additional Information == | == Additional Information == | ||
To run the code for this example with a file on your system, simply change the file path and the url in the read file function. You can also use the browse button on the function to browse for the location of your file when reading content from a file on your system. | To run the code for this example with a file on your system, simply change the file path and the url in the read file function. You can also use the browse button on the function to browse for the location of your file when reading content from a file on your system. |
Latest revision as of 23:40, 27 December 2016
$read file is a Data Function.
The function returns the contents of a file. The read file function can also be used call a file from a URL location by placing the url within the function in place of a file path.
File: The filepath to the file being read. (Can be a file path or a url)
[edit] Example
type text(<about me textarea>, $read file("C:\\Users\\Desktop\\my file.txt"), "Standard")
Running the script fills the specified script with the contents of the file specified with the read file function.
Replace the file path with a url to return the contents of the file.
type text(<about me textarea>, $read file("http://wordpress.org/extend/plugins/about/readme.txt"), "Standard")
[edit] Additional Information
To run the code for this example with a file on your system, simply change the file path and the url in the read file function. You can also use the browse button on the function to browse for the location of your file when reading content from a file on your system.