At 12:28 15/12/2004 -0500, Rick Harrison wrote:

Hi there,

I'm getting some Revolution weirdness when trying to download
files from the internet.

I don't think there's a real problem there, but I'm not sure, because it's hard to follow the description / script to be sure I'm correctly interpreting what you want.


The basic issue is that the "load" command is non-blocking. So when you do the first "load URL" it does not (and should not) wait. It will accept any number of load commands, and queues them up (it probably fetches multiple of them in parallel, with some limit on how many it has under way at a time).

I'm using:

put "" into field "CachedURLSListField1" of card 1
put "" into field "ClearedCacheList1" of card 1

put 1 into N2
repeat while N2 < 4
load URL field "JPEGURL" of card 1 with message "downloadComplete"
--(Which sends this message to the stack which I handle by updating a field with "Status - Download completed")


export image "JpegImage" of card 2 to file field "ImageFileName1" of card 1 as JPEG -- Gets entire image
put field "CachedURLSListField1" of card 1 & the cachedURLs into field "CachedURLSListField1" of card 1


--to list what files are in my cache
--then I supposedly delete the cache with

  unload URL field "JPEGURL" of card 1

--and to check if the file was deleted out of the cache

put field "ClearedCacheList1" of card 1 & the cachedURLs into field "ClearedCacheList1" of card 1
add 1 to N2
end repeat


The problems I'm running into are the following:

1. The program doesn't wait until the first download is complete before moving on to the second download.

That's good :-)

2. The cache isn't getting cleared

Perhaps because you're clearing it (with unload) before that URL has finished being loaded; perhaps because there are multiple in-progress fetches, and you can never clear one without the next one appearing.


3. It's like Revolution is executing just too fast.

The purpose of the load command is to act fast, and to allow your stack to continue with other work while the URLs are being pre-fetched. If you go ahead and use the URL before it has completely loaded, you'll still get the benefit.


If I simply put

answer "N2 = " & N2

-- before the end repeat everything downloads - but unfortunately, -- I have to be around to press the stupid button everytime to -- let the program move on, and I don't want to have to do that.

Any ideas as to what is going on, and as to what I need to do to fix things?

It's not clear just what you want to do, overall. It looks to me as though the loop is loading the same URL each time round - or am I missing something ?


You might want to do something like

local lNumberDone

on gettheURLs
  put 0 into lNumberDone
  repeat while N2 < 4
     load ......
  end repeat
  send checkifdone in 50 millisecs
end gettheURLS

on checkIfDone
  if lNumberDone = 4 then
     ....finished ...
  else
     send checkIfDone in 50 millisecs
  end if
end checkIfDone

on downloadComplete pURL, pURLStatus
if pURLStatus = "Download Complete" then
put URL pURL into (wherever you want it)
else
put "problem with " && pURL && ":" && pURLStatus & CR after field "myStatusfield"
end if
add 1 to lNumberDone
end downloadComplete


In summary - load is non-blocking.
If this hasn't helped - send more of the script, or a fuller description of what you want.


-- Alex.
_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to