Waiting until a URL is cached

Brian Yennie briany at qldlearning.com
Fri Jun 4 12:47:37 EDT 2004


If you want to avoid the looping, I would look into using send:

on mouseUp
    load URL myURL
    send "checkURL myURL" to me in 100 milliseconds
end mouseUp

on checkURL myURL
    if (the URLStatus of myURL is "cached") then
       doSomethingWithTheURL
    else
       send "checkURL myURL" to me in 100 milliseconds
    end if
end checkURL

This will also allow user interaction while the URL is loading, which 
can be both good and bad... =)

> What is the best way to delay an action until a requested URL has been 
> fully downloaded?
>
> I have tried ...
>
> load URL myURL
> repeat until the URLStatus of myURL is "cached"
>   set the cursor to busy
> end repeat
> -- do other stuff
>
>  load URL line lineClicked of the imageFiles of me
>   repeat until myURL is among the lines of the cachedURLs then
>     set the cursor to busy
>   end if
>   -- do other stuff
>
> -- (I even tried this one even though the docs specifically advise 
> against it.*)
> load URL myURL
> wait until the URLStatus of myURL is "cached"
> -- do other stuff
>
> All of these approaches entered an infinite loop or hung stage, which 
> I had to Cmd-. to interrupt. Oddly enough, when I then checked the 
> cachedURLs function, all of the URLs I had loaded in the above 
> examples were there.
>
> Am I just doing this wrong?
>
> Devin Asay
> Humanities Technology and Research Support Center
> Brigham Young University
>
> * P.S. The current (2.2) documentation seems to contain a 
> contradiction: whereas the docs for the load command advise against 
> using the < wait until the URLStatus of myURL is "cached" > approach, 
> the docs for URLStatus function give this as an perfectly good example 
> of its usage. Which is correct?
>
> _______________________________________________
> 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