Set Serial Trigger Script
Sets the script to trigger when data is received. If you give an empty filename parameter “”, the trigger script is removed.
Set Serial Trigger Script [ Select ; Result (error) ; Port name ; File name ; Script name ; Match string ]
|Select entire contents||replaces the entire contents of a field with the result. If not checked the result replaces the currently selected portion of the field|
|Result (error)||an error code|
|Port name||(optional) the name of the serial port to be coupled to this trigger script. If you leave this empty the trigger script applies to all ports|
|File name||the name of the file with the Trigger Script|
|Script name||the name of the script to be triggered|
|Match string||(optional) wait for a match string before triggering a script|
Data type returned
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||the Trigger Script was set|
|$$-50||paramErr||there was an error with the parameter|
Other errors may be returned.
Troi Serial Plug-in 5.0
FileMaker Pro 16 to 18
See also the User Manual under Dispatch Scripting for more details.
If the filename parameter is empty, the trigger script is removed and the plug-in will no longer trigger. Note that this will only remove the general port trigger.
Set Serial Trigger Script [ Select ; $ErrorCode ; "" ; Get ( FileName ) ; "Read Script" ; "OK" ]
This will set the Trigger Script for all ports to the script “Read Script” of the current file. The script will not be triggered before the string “OK” is found.
Set Serial Trigger Script [ Select ; $ErrorCode ; "COM2" ; Get ( FileName ) ; "TriggerScriptCOM2" ]
This will set the Trigger Script for the COM2 port to the script “TriggerScriptCOM2” of the current file.
Set Serial Trigger Script [ Select ; $ErrorCode ; "" ; "" ]
This will reset all the trigger scripts. Although the incoming data is buffered, no action is taken when data is received. You can still get the data out with the “Receive Serial Data” script step.
Related script steps
|Receive Serial Data|
|Set Serial Direct Insert|