Skip to main content
Version: 7.9

system.file.saveFile

This function is used in Python Scripting.

Description​

Prompts the user to save a new file named filename. The optional extension and typeDesc arguments can be added to be used as a type filter. 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.file.saveFile(filename)

Parameters​

TypeParameterDescription
StringfilenameA 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​

Client

Syntax #2​

system.file.saveFile(filename , extension , typeDesc)

Parameters​

TypeParameterDescription
StringfilenameA file name to suggest to the user.
StringextensionThe appropriate file extension, like "jpeg", for the file.
StringtypeDescA description of the extension, like "JPEG Image".

Returns​

String - The path to the file that the user decided to save to, or None if they canceled.

Scope​

Client

Code Examples​

Example #1
# This code would prompt the user to save the text in a text area to a file.

path = system.file.saveFile("myfile.txt")
if path is not None:
system.file.writeFile(path, event.source.parent.getComponent("Text Area").text)