With Troi Serial Plug-in you can receive data sent from an external device with a serial (RS232) interface in FileMaker Pro. You can have the plug-in start a script upon receiving in order to process the received data in your database.
Receiving the data
Assume you have an external serial device connected to a (virtual) serial port on your computer. You can use a serial-USB adapter to connect to a USB port on your computer, which will then act as a virtual serial port.
To receive data from this device, first open the (virtual) serial port on your computer using the Serial_Open function. Add this script step to a ScriptMaker script:
Set Variable[ $ErrorCode; Serial_Open( "-Unused"; "COM1"; ) ]
This will open the COM1 port.
Add this step to the script to start receiving data sent to the COM1 port using the Serial_Receive function:
Set Variable[ $Result, Serial_Receive( "-Unused" ; "COM1") ]
Troi Serial Plug-in buffers the incoming data. With every call to Serial_Receive all data from the buffer is retrieved. This might not be all data coming in. You might need to wait and append new data coming in at a later time.
Trigger a script to process the received data
To process the data and store it in your database, you can also set a script to trigger when data is received. You can do this in one go when opening the port with the Serial_Open function, like this:
Set Variable[$ErrorCode; Serial_Open( "-Unused" ; "COM1"; Get(FileName); "Process Data Received for COM1")]
This will open the COM1 port. When data comes in, the script “Process Data Received for COM1” in the current filename will be triggered. If you open more serial ports you can specify a different script for each port. In the triggered script you can then use the Serial_Receive function to read the data. Of course you can do much more in the script, like for example send reply data back with the Serial_Send function.
Multiple examples included
To get you started there are multiple example files demonstrating the use of Troi Serial Plug-in, like this one below:
Many more functions
This is just one of the functions added by Troi Serial Plug-in. On the Troi Serial Plug-in page you can download a fully functional demo with all the functions explained:
It is a great and easy way to enhance your FileMaker database for you or your customers.