One way to do it:
-- DISCLAIMER: this code is untested --
global gSerialPortData
on startReadingPort
set the serialControlString to tMyPortSettings
put empty into gSerialPortData
open file "COM2:" for read
send "readSerialPort" to me in 100 milliseconds
end startReadingPort
on readSerialPort
read from file "COM2:" until empty
if it = empty then
close file "COM2:"
send "processSerialData" to me in 100 milliseconds
exit readSerialPort
end if
put it after gSerialPortData
send "readSerialPort" to me in 100 milliseconds
end readSerialPort
on processSerialData
-- do stuff to the data in gSerialPortData
end processSerialData
One nice thing about doing things via the "send" command instead of a loop is
that the interface remains responsive to user input while data is being read
from the port.
Regards,
Phil
[EMAIL PROTECTED] wrote:
>
> I am converting an old SuperCard app that contains an idle loop. According
> to the help files I should use some variation of the "send" command. My
> loop processes data from a serial port as well as from a card and message
> box commands. Is there a particular program structure I should use that
> would give me the equivalent of the idle loop?
>
> Larry Huisingh
>
> Archives: http://www.mail-archive.com/metacard%40lists.best.com/
> Info: http://www.xworlds.com/metacard/mailinglist.htm
> Please send bug reports to <[EMAIL PROTECTED]>, not this list.
--
Phil Davis
------------------
[EMAIL PROTECTED]
Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.