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()

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

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

bullet.gif    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, bSuccess = GetFileName() ; Assert(bSuccess)

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

Directory Functions, GetString, SetFlipFITS, GetFolder, SetFileOpenDlgTitle


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