Skip to main content

TrFile_Control (function reference)

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

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.

SyntaxFunction badge

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 17 to FileMaker Pro 21 (2024)

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 stepScript step badge

Enable/Disable Troi File Plug-in

Related topics

Troi File Plug-in online help (overview)


Online Help Page for Troi File Plug-in for 17 to 2024 –> TrFile_Control (filep4203) 2024-0604 19:21:56

troi.com
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognizing you when you return to our website and helping us to understand which sections of the website you find most interesting and useful.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.