MultiFileShell & Multiple_File_Select

Synopsis

MultiFileShell is a user macro that allows the user to search for and select files in a separate window. Multiple_File_Select allows the user to select a range of files in a MultiFileShell window and select one of those in a standard Module UI.

Parameters

Name Type Description UI Control

directory string Directory to search for files. Text Box
extension string File extension to search for. Text Box

Output Ports

Name Type Description

filenames string[] Files found with specified extension.
filenames_with_dir string[] Full path of filenames.
selected_filename string Currently selected filename.

Description

The user macros in the GetFiles project provide UI components that allow the user to search for files and select one or more of them. The selected filenames are output and could then be used to specify which data file or files should be read. Two user macros are provided, MultiFileShell and Multiple_File_Select. The MultiFileShell macro provides a separate window that operates much like a standard File Dialog box. The user can specify a directory and a file extension to search for and the results of the search will be displayed in a list box. The user can then select one or more files and either confirm or cancel their decision.

The Multiple_File_Select macro provides a standard Module UI panel. Within this panel are a list box and a Select button. Pressing the Select button launches a MultiFileShell window and allows the user to select a number of files. These selected files are then displayed in the Multiple_File_Select list box. The user can then choose one file from this secondary list. An array of filenames and the finally selected filename are both output. The Multiple_File_Select macro can be of particular use when the user wishes to regularly swap between certain data sets.

It should be noted that these macros are not intended as replacements for the standard File Dialog component. In normal situations the standard File Dialog will provide the the easiest and most convenient solution. However the File Dialog component does not allow multiple files to be selected and it cannot be modified. In this situation the GetFiles macros can be of use. It should also be noted that the two user macros provided with this project are not intended to be the final, definitive way to use the GetFilesCore module. They were designed to solve one set of problems. It should be possible to modify these macros to solve other problems.

Parameters

directory

String parameter that specifies which directory should be searched for files. AVS/Express environment variables(e.g. $XP_PATH<1>) can be used in this directory string.

extension

String parameter that specifies which file extension should be searched for. This string should not contain a preceding '.' character. The file extension can contain a search specification. Therefore if the file extension is set to 'h*' all files that have extensions that begin with 'h' are listed.

Outputs

filenames[]

Array of strings that contains the names of all the files that match the specified criteria and have been selected by the user. This array is only output by the MultiFileShell macro.

filenames_with_dir[]

Array of strings that contains the full specified filename of all the files that match the specified criteria and have been selected by the user. This array is output by both the Multiple_File_Select and MultiFileShell macros.

selected_filenames

String output that contains the fully specified filename of the selected file in the Multiple_File_Select Module Panel. This array is only output by the Multiple_File_Select macro.

Utility Macros

The MultiFileShell user macro uses the low-level GetFilesCore module. This user macro is used by the Multiple_File_Select user macro.

Example

Two example applications are provided. The GetFilesEg1 application gets all the files in the current project directory and allows the user to select one or more of these files. This application could be used as the basis for a full file access application. The GetFilesEg2 application gets a list of all the geometry files in the express/data/geom directory and allows the user to select one of these files. This geometry file is then read and displayed.

Files

iac_proj/getfiles/getfmods.v contains the V definitions of the GetFilesCore module.

iac_proj/getfiles/getfmacs.v contains the V definitions of the MultiFileShell and Multiple_File_Select user macros.

iac_proj/getfiles/getfapps.v contains the V definitions of the GetFilesEg1 and GetFilesEg2 example applications.

Other Notes

The low-level GetFilesMods library containing the low-level GetFilesCore module does not specify a process. By default the express process will be used.

Authors

Jeremy Maccelari,
Visual Numerics

Andrew Dodd,
International AVS Centre

Contact

International AVS Centre
Manchester Visualization Centre
Manchester Computing
University of Manchester
Oxford Road
Manchester
United Kingdom
M13 9PL

See Also