Parameters of pending messages
Peter T. Evensen
pevensen at siboneylg.com
Mon Jun 26 21:02:07 EDT 2006
I wound up saving the parameters in an array like you have below, but
based on message name vs ID (I don't queue up more than one of a particular
message).
Rev knows what the parameters are... it seems like there should be a way to
get them.
My suspend and resume are like what you have below. I just forgot about
the parameters and it was causing all sorts of errors because the QA
testers were switching off my stack and back. I wasn't doing that when I
was testing myself, so I didn't see the errors.
Thanks for the suggestions!
At 12:33 PM 6/26/2006, you 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
>
>_______________________________________________
>use-revolution mailing list
>use-revolution at lists.runrev.com
>Please visit this url to subscribe, unsubscribe and manage your
>subscription preferences:
>http://lists.runrev.com/mailman/listinfo/use-revolution
Peter T. Evensen
http://www.PetersRoadToHealth.com
314-629-5248 or 888-682-4588
More information about the use-livecode
mailing list