Re: Serial Port and asynchronous event help need



CKL wrote:
We see that I have to use at minimum 3 vwaits, meaning that I don't
know how to do this with "ONE" as you proposed Dave

I assume you will use the package expect
you write a
proc repeat {delay script} {
if 1 $script
after $delay repeat $delay $script
}

repeat 5000 {dev_trigger ...}

proc dev_trigger ... {
....
incr ::globalstate(typeA,message,cnt)
lappend ::globalstate(eventq) outgoing
after $trigger_timeout lappend ::globalstate(eventq) outgoing_timeout
}
# ok 1 vwait fixed

exp_background \
$typeamessage {
do_typea_Thing
incr ::globalstate(typeA,message,cnt)
lappend ::globalstate(eventq) typeA
} $typebmessage {
do_TypeB_Thing
incr ::globalstate(typeB,message,cnt)
lappend ::globalstate(eventq) typeB
} eof {
puts stderr "aijeehh, you've killed it"
}

any GUI interaction changes something in ::globalstate
# ok 2. vwait fixed

while true {
vwait ::globalstate ;# this is the place were all the background stuff
;# is done as events roll in.

set currq ::globalstate(eventq) ; set ::globalstate(incoming) {}
foreach item $currq {
switch -- $item \
... {
} exit {
# cleanup and leave programm
}
}
}
# ok vwait 3 is actually done

There are certainly other ways to do it
but if you have one single item that is event triggered ( gui here )
the remaining functionality should heed that and work to similar
priciples.


uwe
.



Relevant Pages

  • Re: Cant put tasks into the calender
    ... you can choose to display the Tasks Pane in the Calendar view ... You can use this script by Paul Berkowitz to do that. ... repeat with theTask in my theTasks ...
    (microsoft.public.mac.office.entourage)
  • Re: Pyramidable
    ... Hi Faucounau alias grapheus. ... You repeat this ... >> State of the art is that it's impossible to decipher an unknown script ... >> signs for such a calendar. ...
    (sci.archaeology)
  • Improving a Contact-from-text script
    ... (I'm placing the script below). ... set firstname to words 1 thru -2 of aLine ... repeat with i from 2 to cnt ... set temp to every word of aLine ...
    (microsoft.public.mac.office.entourage)
  • Re: AppleScript Inquiry
    ... This issue is on an Intel-based Mac running v10.5.2 running Entourage ... We were missing the crucial step of re-saving the script as an ... repeat with aFile in theList ... make new attachment at newMessage with properties {file:aFile as alias} ...
    (microsoft.public.mac.office.entourage)
  • Re: kdetv
    ... I tried MythTV once and found it way to complex for what I needed, ... have is when changing channels I get a 5 second delay. ... The script also deletes the file once I close mplayer. ... Ideally I woud just do `mplayer /dev/video0` and be done with it. ...
    (alt.os.linux.suse)