Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 7.3   7.4   7.5   8.0   8.1   8.2   8.3   8.4   8.5   9.0    Statistic  


Queries number of bytes available in buffer.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
SerialPort 4.4 Yes Yes Yes No No
MBS( "SerialPort.AvailableBytes"; PortReference )   More


Parameter Description Example value
PortReference The reference number of the port. You get this number from SerialPort.Open when you open the port. $port


Returns number or error.


Queries number of bytes available in buffer.


Queries bytes and reads them:

$count = MBS( "SerialPort.AvailableBytes"; $PortReference )
$text = MBS( "SerialPort.Read"; $PortReference; $count; "windows" )

Read in loop as long as data comes in:

# read data until end
Set Variable [$data; Value:""]
    Pause/Resume Script [Duration (seconds): ,1]
    #exit when no more data
    Exit Loop If [not (MBS( "SerialPort.AvailableBytes"; $port ) > 0)]
    #read some data
    Set Variable [$newdata; Value:MBS( "SerialPort.Read"; $port; 10000; "windows" )]
    Set Variable [$data; Value:$data & $newdata]
    Pause/Resume Script [Duration (seconds): ,1]
End Loop

See also

Blog Entries

Created 21st October 2014, last changed 30th November 2016

SendMail.SetSubject   -   SerialPort.Clear

Feedback: Report problem or ask question.

MBS FileMaker Plugins