GetFileList GetFileOpenDlgTitle

GetFileName


The GetFileName function opens the Windows Open dialog to browse for a file name string. If the [Open] button is clicked, the selected file name is returned.

 

Syntax

sName, bOK = GetFileName()

    If [Open] is clicked, the function returns the file name, sName, and bOK=true.

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

    The bOK return value is optional.

Remarks

If the user cancels this dialog, this function returns boolean false as the second argument. You do not have to use the second argument in the script, but it can be tested and a decision made before the script proceeds.

The "Flip FITS Images" flag in the dialog options list controls whether FITS images are flipped with row number increasing downward. This global flag is updated after you click [Open]. It can also be configured before this dialog opens by using the CImageView:SetFlipFITS method.

The dialog title can be changed using SetFileOpenDlgTitle.

Example

The window shown above was created using the following code:

     sName, bOK = GetFileName() ; Assert(bOK)

The Assert function is used after GetFileName to test how the user closed the dialog. If the dialog was closed by clicking [Open], then bOK=true; otherwise, bOK=false.

Related Topics

GetString, SetFlipFITS, GetFolder, SetFileOpenDlgTitle