Parameters of pending messages -- is 'it' volatile?

Erik Hansen erikhans08 at yahoo.com
Mon Jun 26 18:16:29 EDT 2006


this is a keeper.  
one question, is 'it' volatile?

> get the result -- should be the message id
> put tMessage into gaMessageID2message[it]

or:
put the result into esto
put tMessage into gaMessageID2message[esto]

'it' is more concise, is it really as safe?

thanks for the applicable cognition.

Erik Hansen

--- Ben Rubinstein <benr_mc at cogapp.com> wrote:

> On 25/6/06 19:42, Peter T Evensen wrote:
> > Is there any way to get the parameters that
> were passed to pending
> > messages?
> >
> > What I want to do is suspend pending messages
> when a stack is suspended
> > and then reinstate them when the stack is
> resumed.  I just realized
> > pendingMessages() only gives the message
> name, not any of the parameters.
> >
> > Any help would be appreciated!
> 
> I think the best you can do is store the
> parameters (or whatever useful info
> you need to key on) in a global or script-local
> array, keyed on the message ID.
> 
> If you're doing this a lot, you might want to
> buffer it by using your own
> handler wrapped round the "send" command, eg
> 
> on mySend tMessage, tDestination, tWhen
>    global gaMessageID2message
>    do "send tMessage to" && tDestination &&
> "in" && tWhen
>    get the result -- should be the message id
>    put tMessage into gaMessageID2message[it]
> end mySend
> 
> Your normal use could be something like:
> 
> 	mySend "foo bar", "me", "3 seconds"
> 
> then when you're suspended, something like this
> 	put the pendingMessages into
> gSuspendedMessages
>          repeat for each line tRec in
> gSuspendedMessages
> 	  cancel message id (item 1 of tRec)
> 	end repeat
> 
> 
> and when you're resumed:
> 	repeat for each line tRec in
> gSuspendedMessages
> 	  put item 1 of tRec into iOldMessageID
> 	  put (some calculation based on item 2 of
> tRec) into tWhen
> 	  mySend gaMessageID2message[iOldMessageID],
> (item, 4 of tRec), tWhen
>          end repeat
> 
> NB all the above typed into email, not Rev, and
> some of it pseudo-code...
> 
> Obviously, depending on your actual situation
> you may be able to do something
> more elegant, eg if this only applies for
> something with a long and ugly
> destination expression, it might be easier not
> to have to make that into a
> properly quoted up string.
> 
> HTH,
> 
>    Ben Rubinstein               |  Email:
> benr_mc at cogapp.com
>    Cognitive Applications Ltd   |  Phone: +44
> (0)1273-821600
>    http://www.cogapp.com        |  Fax  : +44
> (0)1273-728866

erik at erikhansen.org    http://www.erikhansen.org

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the use-livecode mailing list