CFileDlg:Save


The Save method opens the Windows Save dialog to browse for a file name to use in saving a file. You can choose a file name from the folder or specify a new file name. After clicking[Save], the specified file name is returned. Since this dialog does not actually save the file, its main use is to either allow an existing file name to be selected or a file name to be entered that does not overwrite a file name that already exists in a target folder.

This method returns two values: the file name and the status value. You do not have to catch and use the status value, but it it useful for determining whether the user canceled the Save dialog.

Syntax

sName, bOK = CFileDlg:Save( sDefaultFileName )

sName, bOK = CFileDlg:Save()

bullet.gif    sDefaultFileName is an optional file name to be used when the dialog opens.

bullet.gif    If[Save] is clicked, this method returns the file name in sName, and sets bOK=true.

bullet.gif    If the dialog is canceled, "",false is returned.

bullet.gif    ThebOK return value is optional.

 

Remarks

Note the difference between the arguments passed to this method and the Open method:

bullet.gif    The Open method passes the default dialog title.

bullet.gif    The Save method passes a default file name.

Examples

The dialog shown above was created using the following script:

F = new_filedlg()

-- create a CFileDlg object, F

sName, bOK = F:Save("Centroid Data")

-- Specify a default file name "Centroid Data"

Assert(bOK)

-- exit the script if the dialog was canceled

Related Topics

CFileDlg class

Open

GetFileName

 


Mira Pro x64 Script User's Guide, v.8.77 Copyright Ⓒ 2024 Mirametrics, Inc. All Rights Reserved.