Troi Serial Plug-in > Script steps reference > Close Serial Port
|  | Close Serial Port | 
Closes a serial port with the specified name.
Syntax
Close Serial Port [ Select ; Result (error) ; Port name ]
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 | the name of the port to close | 
Returned Result
Data type returned
Error code
Result
The returned result is an error code. Returned error codes can be:
| 0 | no error | the port was closed | 
| $$-4210 | portDoesNotExistErr | port is not available on this computer | 
| $$-4211 | AllPortsNullErr | no serial ports are available on this computer | 
| $$-108 | memFullErr | ran out of memory | 
Other errors may be returned.
Originated in
Troi Serial Plug-in 5.0
Compatibility
FileMaker Pro 18 to FileMaker Pro 2025
Considerations
If the “Port name” option is empty or “” all ports are closed.
Example
This will close the COM3 port:
Close Serial Port [ Select ; $ErrorCode ; "COM3" ]Example 2
This will close all open ports:
Close Serial Port [ Select ; $ErrorCode ; "" ]Used in example file
SimpleSerial-Steps.fmp12
Related script step
| Open Serial Port | 
Related functions
| Serial_Close | 
| Serial_Open | 
Related topics
Troi Serial Plug-in online help (overview)
