FileNameParams Table


The FileNameParams table contains properties used by the GetFileOpen and GetFileSave functions. The table values are used by these dialogs. You can override the properties of these two dialogs by creating a table and setting the value names and values.

Primary Parameters

These properties are used to soverride the default properties of the GetFileOpen and GetFileSave dialogs. The dialogs also return a new FileNameParams table containing updated property values.

Table Property

Default Value

Description

bOpenFile

false

Set true to get an Open dialog.

sOpenTitle

"Open"

Sets the title used for the Open dialog. The default title is "Open".

bSaveFile

false

Set true to get a Save As dialog.

sSaveTitle

"Save As"

The title used for the Save As dialog. The default title is "Save As".

Additional Parameters

These parameters are used to override the default properties of the GetFileOpen and GetFileSave dialogs. The dialogs also return a new FileNameParams table containing updated property values.

 

 

 

Table Property

Default Value

Description

bUseImageSet

false

Sets theUse Image Set flag on the file dialog.

bFlipFitsFiles

false

Sets theFlip Fits Images flag on the file dialog.

nMaxFiles

100

Sets the maximum number of files that can be selected.

nFilterIndex

1

Sets the index of the default file extension (filter) when the sFilterList property contains more than one extension. This is an advanced property.

sFilterList

""

Specifies the optional file extension filter list. This is an advanced property.

sStartDir

""

Specifies the starting directory.

sFileName

""

Specifies the default file name.

sFileExt

""

Specifies the default file extension.

Using File Extension Filters

In Windows, the GetFileOpen and GetFileSave dialogs use a list of file type filters that follows a very specific format. The filter list is a single character string broken into parts by | characters, with two parts making a single file filter. Thus, if there were 3 filters specified in the string, there would be 6 parts. For each filter, the first part gives a filter description and the second part specifies the file filter that appears in theFile Name: box of the dialog. For example, Text files (*.txt) would be a description for text files and *.txt would be the actual file filter used to select files in the GetFileOpen and GetFileSave dialogs.

This example sets up the GetFileOpen dialog to select a text file with more than one filter.

F.bSetFilterList = true

-- enable using a custom list of file types

 

F.sFilterList = "All files (*.*) |*.*|" ..

-- the custom list of file types

 

      "Text Files (*.txt)|*.txt|" .. "0"

-- notice using the concatenation operator

 

F.bSetFilterIndex = true

-- enable choosing the filter index

 

F.nFilterIndex = 2

-- index 2 chooses text files (*.txt)

 

F:Open( "Select a Text File" )

-- open the Open dialog with a title

 

 

Examples

The following scripts show several ways to override the default properties of the GetFileOpen function using a FileNameParams table :

Params =

-- setup a FileNameParams table

{

-- (use a comma after each value)

  sOpenTitle = "Open the Source File",

-- the new title for the Open dialog

}

 

str = GetFileOpen(Params)

-- set the new properties

 

 

Params =

-- setup a FileNameParams table

{

-- (use a comma after each value)

  sOpenTitle = "Open the Source File",

-- the new title for the Open dialog

}

 

str, NewParams = GetFileOpen(Params)

-- Return the file name and changed params

Printf("Ext=%s\n", NewParams.sFileExt)

-- list the new file extension

 

 

Params =

-- setup a FileNameParams table

{

-- (use a comma after each value)

  sOpenTitle = "Open the Source File",

-- the new title for the Open dialog

}

 

str = GetFileOpen(Params)

-- Return the file name and changed params

 

 

Related Topics

GetFileOpen

GetFileSave

 


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