TrFile_Launch (function reference)

By May 1, 2017 May 22nd, 2019 Online Help, Troi File Plug-in
Troi File Plug-in for FileMaker Pro


Opens a file with the application that has registered it. This is the same application that would open it if you would manually double-click it.

SyntaxFunction badge

TrFile_Launch ( switches ; filePath ; { params } )


switchesnot used, reserved for future use. Leave blank or put "-Unused"
filePaththe path to the file to be launched
params(optional) extra parameters to be sent to the launching application (Windows only)

Returned Result

Data type returned

Error code


The returned result is an error code. An error always starts with 2 dollars, followed by the error code. You should always check for errors. Returned error codes can be:

0no errorThe file was opened with its application
$$-35nsVolErrNo such volume (Wrong disk name or not mounted)
$$-43fnfErrFile not found
$$-50paramErrParameter error
$$-1genericErrThe file could not be opened

Other errors may be returned.

Originated in

Troi File Plug-in 1.2


FileMaker Pro 14 to 18


On the Mac the program that opens the file is determined by the FileType of the file.
On Windows this is determined by the 3 letter extension of the file.
So a text file “ReadMe.txt” will usually be opened by SimpleText (Mac) or WordPad (Windows).

On Windows you can add extra parameters to the launch command, which are then sent to the launching application.


Set Field [ result ; TrFile_Launch ( "-Unused" ;  "C:\readme.doc" ) ]

This will open the file in the application Microsoft Word.

Example 2

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

  gErrorCode		Global, number
  gFilePath		Global, text

gFilePath should contain the path to the file, for example “D:\Logs\L01.TXT” (Windows) or “Mac HD:Logs:Log 1” (Mac). In a script add the following script step:

Set Field [ gErrorCode ; TrFile_Launch ( "-Unused" ;  gFilePath ) ]

This will launch the file specified by gFilePath with its application.

Related functionsFunction badge


Related script stepsScript step badge

Launch Application
Launch File

Related topics

Troi File Plug-in online help (overview)

Online Help Page for Troi File Plug-in for 14 to 18 –> TrFile_Launch (filep4252) 2019-0522 17:04:58