wait until

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Nakia
Posts: 425
Joined: Tue Feb 21, 2012 8:57 am

wait until

Post by Nakia » Thu Feb 21, 2013 2:03 am

Hi,

what is the correct Syntax to wait for a handler to finish?

I have a handler (handler 1) that uses FTP to PUT and GET Files..
I also have another handler URL Progress that keeps track of the success of the transaction..

I want to be able to place a wait after any get/put transaction in handler 1 that waits for URL Progress to finish.
( this is to eliminate handler 1 working faster than the URL Progress handler)

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: wait until

Post by Simon » Thu Feb 21, 2013 2:30 am

I'm guessing that handler 1 has a repeat loop that runs through lines in a variable?
If that is so then I'd re-think that scheme and use a "send" instead.
In your progress handler:
if the result = downloaded then
send "handler 1" to this cd

In handler 1 I'd use a local var that you update:
add 1 to tCount
put line tCount of myFTPList into downLoadThis

Much guessing here :D

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Nakia
Posts: 425
Joined: Tue Feb 21, 2012 8:57 am

Re: wait until

Post by Nakia » Thu Feb 21, 2013 2:40 am

Thanks Simon,

I will take a look into my Approach

Nakia
Posts: 425
Joined: Tue Feb 21, 2012 8:57 am

Re: wait until

Post by Nakia » Fri Feb 22, 2013 10:07 am

FYI

Ended up finding wait for messages in the dictionary
which seems to work perfect..

From my observation it seems to halt the handler until the engine
Finishes processing any other handlers that are running at the same time..

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: wait until

Post by Simon » Fri Feb 22, 2013 9:32 pm

Nice, I've never used "wait for messages".
Now I just have to find a reason to use it in one of my projects.

Simon
EDIT:
I re-discovered the dictionary entry that had me worried about your request:
"libURLftpUpload field "Upload Data",myURL
wait until the URLStatus of myURL is "uploaded" -- DON'T DO THIS"
Knew I had seen it before.
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Post Reply