Waiting until a URL is cached

Devin Asay devin_asay at byu.edu
Fri Jun 4 12:42:01 EDT 2004


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?



More information about the use-livecode mailing list