send ___ to me in ___ sec

David Vaughan drvaughan55 at mac.com
Tue Apr 23 17:52:01 EDT 2002


Doug

Dar has covered much of the issue but there is still one thing that 
puzzles me about your question. It implies that the "currently running 
scripts" are running in an order which is unknown to you, or else you 
would simply call your clean-up routine at the end of your last script. 
I assume the relevant scripts are your calls, not Rev messages. You can 
guarantee this by trapping the last Rev message (e.g. deleteCard) and 
sending from that, or using the preOpenCard message for the next card, 
which occurs after your other card has been deleted.

If you can not guarantee which is your last running script your options 
include:
- sending in a suitably long time.
- as Dar suggests, decide your send time by looking at the currently 
pending message list.
- having the clean-up script itself check the pending message list and, 
if the list is not empty, send itself at another short interval then 
exit.

regards
David

On Wednesday, April 24, 2002, at 07:50 , Dar Scott wrote:

>
> On Tuesday, April 23, 2002, at 02:51 PM, Ivers, Doug E wrote:
>
>> Isn't there a way to "send ___ to me when all currently running 
>> scripts are done"?  Or, "send ___ to me on first idle message"?
>>
>> I want something to happen after all other scripts in the queue have 
>> competed... surely this is a common need.
>
> If what you want is to insert a script right after all those in the 
> send queue, then try this:  Look at pending messages, find the message 
> with the latest time (item 2) and then send right after that one.  If 
> the list is empty send ... in 0.
>
> (However if you have a message in the queue to remind you of something 
> in 5 minutes, do you really want to queue a send behind that?)
>
> However, not all queued messages show up there.  I know mouseUp as 
> generated by a mouse click is not.  It may turn out that all Revolution 
> generated messages are not.  I have gotten the impression that mouseUp 
> and the like are called after ready messages in the send queue (pending 
> messages).  Some Revolution messages are probably called directly from 
> a command and not queued.  I would think deleteCard might be like that.
>
>> For example, I need to do some clean up after a card is deleted.  The 
>> deletedCard message is sent before the delete, so I'm using this:
>>
>>  on deleteCard
>>     send updateList to field "myList" in 0.1 sec
>> end deleteCard
>
> I don't understand why or how this works.  How does the field exist 
> after the card is gone?  Does this go to a field of the same name on 
> the next card?
>
>> This works on my machine, but may not work on all machines in all 
>> situations.  Is there a more elegant way?  How can I put the send 
>> command at the end of the currently runningscripts?
>>
> I'm not sure what you mean by currently running.  I think unless you 
> use wait with messages, only one handler--with handlers called by it 
> (message handlers and functions) forming a "call stack"--is running.  
> Immediate execution is only in the deepest call.  I don't think of 
> queued sends as running.  Or other queued messages.
>
> If all you are doing is deleting the card in a script and want to run a 
> script after all called handlers have finished (returned) and then the 
> top handler (say a mouseUp) has finished, then all you need is send... 
> in 0.
>
> I'm still learning on this, myself.
>
> Dar Scott
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>




More information about the use-livecode mailing list