system.vision.saveFile
This function replaces system.file.saveFile. Any scripts containing Vision Client scoped functions that were replaced with system.vision syntax will still work to maintain backwards compatibility.
This function is used in Python Scripting.
Descriptionβ
Prompts the user to save a new file named filename. The optional extension and typeDesc arguments will be used for a file type filter, if any. If the user accepts the save, the path to that file will be returned. If the user cancels the save, None will be returned.
Client Permission Restrictionsβ
This scripting function has no Client Permission restrictions.
Syntax #1β
system.vision.saveFile(filename)
Parametersβ
| Type | Parameter | Description |
|---|---|---|
| String | filename | A file name to suggest to the user. |
Returnsβ
String - The path to the file that the user decided to save to, or None if they canceled.
Scopeβ
Vision Client
Syntax #2β
system.vision.saveFile(filename, [extension], [typeDesc])
Parametersβ
| Type | Parameter | Description |
|---|---|---|
| String | filename | A file name to suggest to the user. |
| String | extension | The appropriate file extension, like "jpeg", for the file. [optional] |
| String | typeDesc | A description of the extension, like "JPEG Image". [optional] |
Returnsβ
String - The path to the file that the user decided to save to, or None if they canceled.
Scopeβ
Vision Client
Code Examplesβ
# This code would prompt the user to save the text in a text area to a file.
path = system.vision.saveFile("myfile.txt")
if path is not None:
system.file.writeFile(path, event.source.parent.getComponent("Text Area").text)
# This code prompts the user to save direct text in the system.file.writeFile()'s data parameter to a file.
path = system.vision.saveFile("myfile.txt")
if path is not None:
system.file.writeFile(path, "Hello World")