Skip to main content

TrFile_SelectFolderDialog (function reference)

By June 1, 2024June 4th, 2024Online Help, Troi File Plug-in
Troi File Plug-in > Functions reference > TrFile_SelectFolderDialog
Troi File Plug-in for FileMaker Pro

TrFile_SelectFolderDialog

With this function the user can select a folder on disk. The function will show the user a standard dialog with the hierarchy of folders on the computer.

SyntaxFunction badge

TrFile_SelectFolderDialog ( switches ; prompt ; { initialFolder } )

Parameters

switches reserved for future use, leave empty or set to "-Unused"
prompt the prompt that will be displayed to tell the user which folder to select
initialFolder (optional) the path to a folder on disk that will be used as the starting point for the selection dialog

Returned Result

Data type returned

Text

Result

The function returns a FileSpec for the selected folder. This folder can be used with other functions of the plug-in.

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

Originated in

Troi File Plug-in 3.0

Compatibility

FileMaker Pro 17 to FileMaker Pro 21 (2024)

Example

Set Field [ result ; TrFile_SelectFolderDialog ( "-Unused " ; 
			"Please choose a folder where you want to put the files." ; " C:\Data\" ) ]

This will present a folder selection dialog. The dialog initially shows the folder: “C:\Data\”. The user can then select a folder and click on OK. The function returns with the path to the folder, for example: “D:\MyFiles\Databases\”.

Example 2

We assume that in your FileMaker file the following fields are defined:

  gFolderPath		Global, text
  gInitialFolder	Global, text

gInitialFolder should contain the path to a folder, for example “D:\Logs\Data\” (Windows) or “Mac HD:Logs:Data:” (Mac OS). In a script add the following script step:

Set Field [ gFolderPath ; TrFile_SelectFolderDialog ( 
                "-Unused" ; "Please choose a folder where you want to put the files." ; gInitialFolder ) ]

After the dialog gFolderPath will contain the path to the selected folder.

Used in example file

SelectFolder.fmp12

Related functionsFunction badge

TrFile_ListFolder
TrFile_SelectFileDialog

Related topics

Troi File Plug-in online help (overview)


Online Help Page for Troi File Plug-in for 17 to 2024 –> TrFile_SelectFolderDialog (filep4272) 2024-0604 19:31:36