Set Serial Trigger Script (script step reference)

Troi Serial Plug-in > Script steps reference > Set Serial Trigger Script
Troi Serial Plug-in for FileMaker Pro

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.

SyntaxScript step badge

Set Serial Trigger Script [ Select ; Result (error) ; Port name ;
File name ; Script name ; Wait string ]

Options

Select entire contentsreplaces the entire contents of a field with the result. If not checked the result is added to 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 namethe name of the file with the Trigger Script
Script namethe name of the script to be triggered
Wait string(optional) wait for a string of characters 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:

0no errorthe Trigger Script was set
$$-50paramErrthere was an error with the parameter

Other errors may be returned.

Originated in

Troi Serial Plug-in 9.0

Compatibility

FileMaker Pro 16

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

Receive Serial Data

Related functionFunction badge

Serial_SetDispatchScript

Online Help Page for Troi Serial Plug-in for 12 to 16 –> Set Serial Trigger Script (serip7810) 2017-0525 11:37:43