TrFile_SelectFileDialog (function reference)

Troi File Plug-in > Functions reference > TrFile_SelectFileDialog
Troi File Plug-in for FileMaker Pro

TrFile_SelectFileDialog

Presents the user with a standard dialog and displays all files in a directory.

SyntaxFunction badge

TrFile_SelectFileDialog ( switches ; prompt ; { initialFolder } )

Parameters

switchesmodifies the behavior of the function
promptthe prompt that will be displayed to tell the user which file to select
initialFolder(optional) the file path to the folder where the dialog initially starts

Switches

Switches can be:

-SelectDefault(Mac OS) select the default location. the initial folder appears as the current selection
-SelectPackages(Mac OS) allow selection of Mac OS packages, like application packages
-OpenPackages(Mac OS) allow Mac OS packages, like application packages, to be opened and navigated
-HideInvisibleshides invisible files in the selection dialog
-AllowMultipleFilesallow the user to select multiple files in the dialog
-DontResolveAliaswhen you select an alias/shortcut the result is the path to the alias itself

The following switch no longer works (on Mac OS):

-ReturnFSSpecdeprecated! the function no longer returns the folder as a FSSpec instead of a full path

Returned Result

Data type returned

Text

Result

The function returns a fullpath for the selected file to be used with one of the file manipulation functions.

If the user cancels an error code of “$$-1” is returned.

Originated in

Troi File Plug-in 1.2

Compatibility

FileMaker Pro 13 to 17

Considerations

Filtering on Mac OS is now the same as on Windows. To change the default filtering see the TrFile_SetDefaultType function, or take a look at “Filtering Files” in the example databases.

NOTE: Mac OS packages, like application packages, are actually folders, so this will return a path to a folder!

When the switch “-AllowMultipleFiles” is added, you can use the Command key on Mac OS or the Control + Alt key on Windows to select or deselect extra items. To select a contiguous group of files at once, click on the first file, then hold Shift and click the last one and all files are selected.
Each selected file is returned on a new line.

Example

On Mac OS:

Set Field [ MyFileName ; TrFile_SelectFileDialog ( "-Unused" ; "Please choose a file to import" ; 
			"Mac HD:Solution Files:Import:" ) ] 

Set Field [ MyFileName ; TrFile_SelectFileDialog ( "-SelectPackages" ; "Please choose a file to import" ; 
			"Mac HD:Solution Files:Import:" ) ]

Or on Windows:

Set Field [ MyFileName ; TrFile_SelectFileDialog ( "-Unused" ;  "Please choose a file to import" ; 
			"C:\Solution Files\Import\" ) ]

This will start the selection at the folder “Import” in the “Solution Files” Folder.

It returns “HD Mac:Text files:My Letter” if the user selects that particular file on Mac OS. On Windows it may return “C:\Text files\My Letter”.

Related functionsFunction badge

TrFile_SaveFileDialog
TrFile_SetDefaultType

Related script stepScript step badge

Show Select File Dialog

Related topics

Troi File Plug-in online help (overview)


Online Help Page for Troi File Plug-in for 13 to 17 –> TrFile_SelectFileDialog (filep4271) 2018-0515 15:52:52