Engine.DisplayFileDialog
- Updated2024-10-09
- 3 minute(s) read
Engine.DisplayFileDialog
Syntax
Engine.DisplayFileDialog( dlgTitle, okButtonText, initialPath, selectedPaths, absolutePaths, openFileDialogFlags = 0, defaultExtension = "", win32Flags = WinFileDlg_HIDEREADONLY | WinFileDlg_FILEMUSTEXIST, fileFilter = "", [currentFile], [fileFilterIndex], [dirHistoryList])
Return Value
Returns True if you click OK in the dialog box. Returns False if you click Cancel .
Purpose
Launches a dialog box in which the user can select files or directories to open or to save.
Remarks
This method launches the TestStand File dialog box. Depending on the options you pass, TestStand selects a single file, multiple files, a single directory, or multiple directories. Additional options specify whether TestStand returns absolute or relative pathnames for the selected files. TestStand can return a relative pathname only when the file is located under one of the TestStand search directories . If the file is not located under any of the TestStand search directories and the user requests that TestStand return a relative pathname, the dialog box prompts the user to add the name of the directory that contains the file to the list of TestStand search directories. You can pass a SequenceFile object, WorkspaceFile object, or a project file object to include its directory among the list of search directories that are valid for a relative pathname.
Parameters
dlgTitle As String
[In] Specifies the title of the dialog box. Pass an empty string to use the default title for the dialog box.
okButtonText As String
[In] Specifies a string to display on the OK button. Pass an empty string to use the default.
initialPath As String
[In] For a file selection dialog box, specify the path of the file you want the dialog box to display initially. If you specify the path of a directory, the filename control in the dialog box remains empty. For a directory selection dialog box, specify the path of the directory you want the user to browse initially. Pass an empty string to specify the current directory. The path must specify an existing file or directory.
selectedPaths As String Array
[Out] Returns the array of pathnames of the files or directories the user selected. The pathnames can be relative or absolute depending on the dialog box settings.
absolutePaths As String Array
[Out] Returns the array of absolute pathnames of the files or directories the user selected.
openFileDialogFlags As Long
[In] Pass 0 for the default behavior, or pass one or more OpenFileDialogOptions constants. Use the bitwise-OR operator to specify multiple flags.
This parameter has a default value of 0 .
defaultExtension As String
[In] Specifies the extension to append to the pathname if the user specifies no extension. Do not include the period in the extension.
This parameter has a default value of "" .
win32Flags As Long
[In] Specifies the Microsoft Windows file dialog flags .
This parameter has a default value of WinFileDlg_HIDEREADONLY | WinFileDlg_FILEMUSTEXIST .
fileFilter As String
[In] Specifies the extensions files must have to appear in the dialog box. Each filter the string contains has two parts. The first part is a descriptive name for the filter and the second part lists the extensions the file can have. Specify multiple extensions using a semi-colon (;) as a delimiter, and end each section with a vertical bar (|). End the string with a final vertical bar (|). The following example illustrates this format:
"Sequence Files (*.seq)|*.seq|Report Files (*.txt;*.htm;*.html)|*.txt;*.htm;*.html||"
This parameter has a default value of "" .
currentFile As Variant
[In] [ Optional ] Pass a PropertyObjectFile object for a sequence file, workspace file, or project file if you want to include the directory of the file in the list of search directories that are valid for a relative pathname. The search directory "current sequence file" refers to the object passed as this parameter. If you pass a workspace file or project file, TestStand searches the directory of the file before searching the other search directories for the relative pathname.
fileFilterIndex As Variant
[In/Out] [ Optional ] When passed as an input parameter, the parameter specifies the file type to be initially selected in the File Type ring control.
The index corresponding to the selected file type within the list control is returned as an output parameter.
dirHistoryList As Variant
[In/Out] [ Optional ] Pass an array of strings if you want to set the contents of the directory history combo box in the dialog box. If you omit this parameter, TestStand sets the contents of the combo box with a default history list .