Save to File

From UBot Studio
(Difference between revisions)
Jump to: navigation, search
(Example)
 
(7 intermediate revisions by one user not shown)
Line 1: Line 1:
This command is a [[File Commands|File Command]]. This command allows you to save text and lists to a file.  You can specify the name and location where you want to save the file.  If you are saving text, it will save it verbatim to the file, and if you are saving a list it will save it to the file one list item per line. You can read these files using the $read file or $list from file functions.
+
This command is a [[File Commands|File Command]]. This command allows you to save text and lists to a file.  You can specify the name and location where you want to save the file.   
 +
 
 +
If you are saving text, it will save it verbatim to the file, and if you are saving a list it will save it to the file one list item per line.
 +
 
 +
You can read these files using the $read file or $list from file functions.
 +
 
 
You can save files with whatever extension you choose  
 
You can save files with whatever extension you choose  
 
(i.e. .txt, .csv, .html, .bat, etc)
 
(i.e. .txt, .csv, .html, .bat, etc)
  
  
The two options that appear in command after dragging in into the scripting area are:
+
'''Save As:''' the file path complete with file name and file extension
  
1. The Save As field:  the location and name of file
+
'''Content to Save field:''' where you would place content of the file
 
+
2. The Content to Save field: where you would place content of the file
+
  
 
== Example ==
 
== Example ==
 
<pre>
 
<pre>
navigate("http://www.ubotstudio.com/resources", "Wait")
+
navigate("http://wiki.ubotstudio.com/wiki/Main_Page", "Wait")
 
wait(5)
 
wait(5)
save to file("C:\\Users\\LillyT\\Desktop\\test.txt", $scrape attribute(<href=w"/files/ScriptReferences/*">, "innertext"))
+
save to file("C:\\Users\\Desktop\\New Text Document.txt", $scrape attribute(<href=w"/wiki/*">, "innertext"))
 +
 
  
 
</pre>
 
</pre>
 +
  
 
Running the script will navigate to the specified website, scrape the specified items, and save the scraped items to the file specified in the save to file command.
 
Running the script will navigate to the specified website, scrape the specified items, and save the scraped items to the file specified in the save to file command.
  
[[File:savetofile.png]]
+
 
 +
[[File:savetofile03.jpg]]

Latest revision as of 17:26, 7 September 2014

This command is a File Command. This command allows you to save text and lists to a file. You can specify the name and location where you want to save the file.

If you are saving text, it will save it verbatim to the file, and if you are saving a list it will save it to the file one list item per line.

You can read these files using the $read file or $list from file functions.

You can save files with whatever extension you choose (i.e. .txt, .csv, .html, .bat, etc)


Save As: the file path complete with file name and file extension

Content to Save field: where you would place content of the file

[edit] Example

navigate("http://wiki.ubotstudio.com/wiki/Main_Page", "Wait")
wait(5)
save to file("C:\\Users\\Desktop\\New Text Document.txt", $scrape attribute(<href=w"/wiki/*">, "innertext"))



Running the script will navigate to the specified website, scrape the specified items, and save the scraped items to the file specified in the save to file command.


Savetofile03.jpg

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox