Skip to main content

Serial_Send (function reference)

By July 1, 2023July 17th, 2023Online Help, Troi Serial Plug-in
Troi Serial Plug-in for FileMaker Pro


Sends data to the serial port with the specified name. The port needs to be opened first (see also Serial_Open).

SyntaxFunction badge

Serial_Send ( switches ; portname ; data )


switches not used, reserved for future use. Leave blank or put "-Unused"
portname the name of the port to send data to
data the text data that is to be sent to the serial port

Returned Result

Data type returned

Error code


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 when sending, by testing if the first two characters are dollars.

Returned error codes can be:

0 no error the data was sent
$$-28 notOpenErr the port is not open
$$-108 memFullErr ran out of memory
$$-50 paramErr there was an error with the parameter
$$-4210 portDoesnotExistErr a port with this name is not available on this computer
$$-4211 allPortsNullErr no serial ports are available on this computer
$$-207 notEnoughSpace the output buffer is full

Other errors may be returned.

Originated in

Troi Serial Plug-in 3.0


FileMaker Pro 16 to FileMaker Pro 2023


Make sure you use a text field for the data. Other field types, like containers are currently not supported.

Please be aware that only the ASCII characters 0…255 will be transmitted, as a serial port wants 8 bit characters.


Serial_Send ( "-Unused" ; "Modem port" ;  "So long" ) ]

This will send the string ” So long” to the Modem port.

Set Field [ gResult ; Serial_Send ( "-Unused" ;  gPortName ; textToSend ) ]

This will send the text in the field textToSend to the port in the field gPortName.

Example 2

Below you find a “Send Data” script for sending data from a global text field gTextToSend. The script tests for errors.

We assume that in your FileMaker file the following fields are defined:

gPortName	Global, text, contains the name of the previously opened port 
gTextToSend	Global, text, can also be a normal text field
gErrorCode	Global, text

Add the following script steps:

Set Field [ gErrorCode ; Serial_Send ( "-Unused" ; gPortName ; gTextToSend ) ]
If [ Left ( gErrorCode , 2 ) = "$$" ]
	If [ gErrorCode = "$$-28" ]
		Show Message [ Open the port first ]
		If [ gErrorCode = "$$-207" ]
			Show Message [ Buffer overflow error ]
			Show Message [ An error occurred while sending! ]
		End If
	End If
	Halt Script
End If

Used in example file


Related functionsFunction badge


Related script stepScript step badge

Send Serial Data

Related topics

Troi Serial Plug-in online help (overview)

Online Help Page for Troi Serial Plug-in for 16 to 2023 –> Serial_Send (serip4809) 2023-0717 12:55:04