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.
Syntax
Set Serial Trigger Script [ Select ; Result (error) ; Port name ;
File name ; Script name ; Match string ]
Options
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 |
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 | the Trigger Script was set |
$$-50 | paramErr | there was an error with the parameter |
Other errors may be returned.
Originated in
Troi Serial Plug-in 5.0
Compatibility
FileMaker Pro 16 to FileMaker Pro 2023
Considerations
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.
Example
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.
Example 2
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 |
Related function
Serial_SetDispatchScript |
Related topics
Troi Serial Plug-in online help (overview)