Skip to main content

Serial_Open (function reference)

By August 1, 2025August 5th, 2025Online Help, Troi Serial Plug-in
Troi Serial Plug-in for FileMaker Pro

Serial_Open

Opens a serial port with this name and the specified parameters.

SyntaxFunction badge

Serial_Open( switches ; portname ; settings ; filename ; scriptname ;
             matchstring )

Parameters

switches (optional) specifies how this function receives the data
portname the name of the port to open
settings (optional) specifies the setting of the port like the speed of the port, parity, etc.
filename (optional) the name of the file which contains the script to trigger when data comes in
scriptname (optional) specifies the name of the script to trigger when data comes in
matchstring (optional) a string that must be matched before the script is triggered

Switches

switches can be one of this:

-ResumeWhenScriptPaused when the trigger script needs to run, and an other script is already paused, the paused script will resume after the triggerscript is finished.
-NoIdleWaitTime don’t add idle wait times, the triggering will be faster, but the plug-in will need more computer time

You can also add:

-DontShowExtendedPrivilegeWarning show no alert if script triggering fails

Returned Result

Data type returned

Error code

Result

Returned result is an error code. Returned error codes can be:

0 no error the port was opened
$$-50 paramErr there was an error with the parameter
$$-108 memFullErr ran out of memory
$$-97 portInUse could not open port, the port is in use
$$-4210 portDoesnotExistErr port with this name is not available on this computer
$$-4211 allPortsNullErr no serial ports are available on this computer

Other errors may be returned.

Originated in

Troi Serial Plug-in 3.0

Compatibility

FileMaker Pro 18 to FileMaker Pro 2025

Considerations

If you specify a filename and scriptname any scripts specified with the function “Serial_SetDispatchScript” will be ignored for this port.

If you specify a filename you must also provide a scriptname.

Version 6.0 added the (optional) matchstring parameter, you can now specify directly when opening a port the string for which the plug-ins waits before triggering a script.

NOTE You might need to enable “Validate cross-file plug-in access” extended privilege (fmplugin extended privilege) in newly created fmp12 files, for script triggering to work.
See our web page for more info on how to do this here.

New in v9.0: the plug-in now shows an alert dialog when script triggering fails because of insufficient privilege for triggering scripts.
You can add the switch “-DontShowExtendedPrivilegeWarning”. When you add this switch no alert is shown if script triggering fails.

Example

Set Field [ gErrorCode ; Serial_Open ( "-Unused" ; "COM2" ; "baud=19200 parity=none      
               data=8 stop=10 flowControl=DTRDSR  flowControl=RTSCTS" ) ]

will open the COM2 port with a speed of 19200 baud and the specified options.

Example 2

Set Field [ gErrorCode ;
	Serial_Open ( "-Unused" ; gPortName1 ; 
		gSpeed & " " & gStopBits & " " & gDataBits & " " & gParity &  " "& gFlowControl ;
		Get ( FileName ) ;
		"Process Data Received for 1st Port"
		) 
            ]

This will open the port in field gPortName1 with the specified speed and other options. When data comes in the script “Process Data Received for 1st Port” in the current filename will be triggered.

Used in example files

SimpleSerial.fmp12
Terminal.fmp12

Related functionsFunction badge

Serial_Close
Serial_Receive
Serial_Reinitialize

Related script stepsScript step badge

Open Serial Port
Set Serial Direct Insert

Related topics

Troi Serial Plug-in online help (overview)


Online Help Page for Troi Serial Plug-in for 18 to 2025 –> Serial_Open (serip4805) 2025-0805 18:40:03

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.