>Appendix B of the "Using Lingo" manual contains some very good sample >scripts, with glosses, on the SerialPort XObject.John! I hardly would be able to even start with having read this section. And "very good" is not how I would describe it. Most of the samples relate to video deck control, and the one modem script doesn't do much.
OK here goes. This script uses an editable text field for an input window and an 80 char wide scrolling field for a display window. The crash seemed to be caused by the mHShakeChan method. Deleting it fixed it. Imagine my surprise when, not only did it work, the other scripts I'd written to handle interaction worked first time. I was able to logon, send and recieve strings and logoff. The hang up must be automatic because I didn't need the hangup handler. In fact I hit the hangup button and it crashed. Still, it works, even if it needs a few bugs ironed out. <g>
on startMovie
when keyDown then sendInputWin()
initModem()
end
on initModem
global gPort
if objectP(gPort) then gPort(mDispose)
put SerialPort(mNew, 0) into gPort
if not objectP(gPort) then alert "Problems dude!"
gPort(mSetUp, 2400, 10, 0)
gPort(mWriteString, "ATX1E1&C1&D2Q0" &return) --modem init string
end
on dial
global gPort
gPort(mWriteString, "ATDT2571097" &return) --dial number
end
on sendInputWin
global gPort
if the key = return then
dontPassEvent
put the text of cast "InputWin" &return into LoutGoing
gPort(mWriteString, LoutGoing)
put LoutGoing after field "DisplayWin"
put "" into field "InputWin"
end if
end
on onlineLoop
global gPort
if objectP(gPort) then
if gPort(mReadCount) = 0 then --check if there is data in the port buffer.
nothing
else
put gPort(mReadString) into Lincoming
gPort(mReadFlush)
put Lincoming &return after field "DisplayWin"
end if
end if
go to the frame
end
on hangUp
global gPort
gPort(mWriteString, "ATH")
gPort(mDispose)
end
on stopMovie
global gPort
if objectP(gPort) then gPort(mDispose)
ends
-- Dorian telecomus monsterus rex Dowse