Serial Ports

Gene Kennedy cyberscope at home.com
Sat Dec 1 19:49:01 EST 2001


It is possible to read/write data from/to serial ports via AppleScript, a KeySpan USB to Serial Adapter and
a shareware Serial Port Scripting Addition (you can download from various sites).  On my iMac, I can access
any of the three serial ports (i.e. the internal modem, KeySpan #1 and KeySpan #2) using the above
combination. The only trick part is using quotes properly in the AppleScript statements.

For example:

-- use a handler to open the desired serial port, write the data to it, then close the port.

On SendIt
    do "Open serial port " & quote & "P#1USA28X012" & quote as AppleScript  -- this uses KeySpan port#1
    put the result into thePort  -- some variable to hold the port reference for the scripting addition
    do "serial port write " & theData & "to " & thePort as AppleScript
    do "Close serial port " & thePort as AppleScript
End SendIt


Although I am just getting started with Revolution myself, this scheme works reliably for me on an iMac and
an iBook using System 8.6.1 and 9.1 respectively.  For what it's worth, I have used the KeySpan adapters in
all of the systems I have delivered over the past four years and never experienced a failure.  I hope I'll
be able to say that about my apps someday.

PS    I have no experience with OS X so I don't know if the above will apply!

Best regards,

Gene Kennedy





More information about the use-livecode mailing list