Skip to main content

Selecting Files in FileMaker

By April 2, 2015September 26th, 2017FileMaker Plug-ins blog

With Troi File Plug-in you can easily let a user select a file on disk, for example to get the contents into filemaker. With the plug-in you can also move or rename it, to indicate the file has been handled.

Selecting the file

Use the TrFile_SelectFileDialog function to open up a dialog which lets the user select a file. By default all the files can be selected. If you want the user to be able to select only files with a certain extension use the TrFile_SetDefaultType function first.

To let the user select any file add these script steps to a ScriptMaker script:
Set Variable [$DontCare; TrFile_SetDefaultType( "-Unused"; "")]
Set Variable [$FilePath; TrFile_SelectFileDialog( "-Unused"  ; "Please select a file.") ]

This will return the path to the file for example:
MacHD:Users:John:Documents:FinancialReport2014.xlsx

If the user cancels the dialog $$-1 is returned.

Filtering on extension

To let the user select only files with the .txt extension modify these script steps as follows:
Set Variable [$DontCare; TrFile_SetDefaultType( "-Unused"; "Text files (*.txt)¶*.txt"  ")]
Set Variable [$FilePath; TrFile_SelectFileDialog( "-Unused"  ; "Please select a file.") ]

Now the user can only select .txt files.

Many more functions

This is just one of the functions added by the Troi File Plug-in. On the Troi File Plug-in page you can download a fully functional demo with all the functions explained:

www.troi.com/software/fileplugin.html

It is a great and easy way to enhance your database for you or your customers.