TrFile_Control | 
Controls the functions of the plug-in. You can disable and enable the functions of the plug-in. This allows you to create powerful solutions, without the risk of users misusing the functions, causing unwanted or harmful results.
Syntax
TrFile_Control ( switches ; { password } )
Parameters
| switches | these determine how the function works. You can disable or enable all functions | 
| password | the password to be used | 
Switches
switches can be one of the following:
| -DisableAllFunctions | allow the user no access to functions | 
| -EnableAllFunctions | allow the user access to all functions | 
| -CurrentEnabledStatus | get the status, 1 = plug-in is enabled, 0 plug-in is disabled | 
Returned Result
Data type returned
Error code
Result
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:
| 0 | no error | |
| $$-4217 | pwdAlreadySet | password already set (enable first) | 
| $$-4218 | alreadyEnabled | functions are already enabled | 
| $$-4219 | pwdWrong | password was wrong | 
Other errors may be returned.
Originated in
Troi File Plug-in 2.0
Compatibility
FileMaker Pro 18 to FileMaker Pro 22 (2025)
Considerations
When you call a disabled function an error code of $$-4220 is returned.
After restart of FileMaker all the functions of the plug-in are re-enabled.
Example
Set Field [ result ;  TrFile_Control ( "-disableAllFunctions"  ; "secret password" ) ]
This will disable the functions of the plug-in.
Example 2
We assume that in your FileMaker file the following fields are defined:
    gErrorCode		Global, number	
    gPassword		Global, text
gPassword should contain a password, for example “rapunsel”. Add the following to the startup script:
Set Field [ gErrorCode ; TrFile_Control ( "-disableAllFunctions" ; gPassword ) ]
This will disable the plug-in function. When you want to use the plug-in add the following script steps:
Set Field [ gErrorCode ; TrFile_Control ( "-enableAllFunctions" ; gPassword ) ]
# ... add your powerful functions here...
Set Field [ gErrorCode ;  TrFile_Control ( "-disableAllFunctions" ; gPassword ) ]
This will temporarily enable the plug-in functions.
Related script step
| Enable/Disable Troi File Plug-in | 
Related topics
Troi File Plug-in online help (overview)