Pendingmessages

Ken Ray kray at sonsothunder.com
Fri Mar 2 23:03:02 EST 2007


On Fri, 2 Mar 2007 18:22:18 -0600, Chipp Walters wrote:

> Another nugget from Ken Ray's war chest involves canceling a pending
> message. I find this helpful as a first statement after receiving and
> starting to executecthe message. IOW, make sure and kill all pending
> same messages so there's no 'backlog' which can create quite a
> confusion when debugging!
> 
> Thanks Ken.
> 
> on CancelPending pWhat
>  if pWhat = "" then put "all" into pWhat
>  switch pWhat
>  case "all"
>    repeat with x = (the number of lines of the pendingmessages) down to 1
>      cancel (item 1 of line x of the pendingMessages)
>    end repeat
>    break
>  default
>    repeat with x = (the number of lines of the pendingmessages) down to 1
>      if line x of the pendingMessages contains ("," & pWhat & ",") then
>        cancel (item 1 of line x of the pendingMessages)
>      end if
>    end repeat
>    break
>  end switch
> end CancelPending

Thanks, Chipp, but my warchest has a more compact, but just as 
efficient version of CancelPending:

on CancelPending pMsg
  put the pendingMessages into tPending
  if (pMsg <> "") and (pMsg <> "all") then filter tPending with "*," & 
pMsg & ",*"
  repeat for each line tMsg in tPending
    cancel item 1 of tMsg
  end repeat
end CancelPending

Ain't Rev great?  :-)

Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/



More information about the use-livecode mailing list