On Aug 3, 2006, at 4:55 AM, Dave Cragg wrote:


On 3 Aug 2006, at 08:51, Devin Asay wrote:

Has anyone used libURLSetStatusCallback successfully to monitor the progress of downloads from a remote server? I am using it in conjunction with libURLDownloadToFile and it seems to PARTLY work. I use it to update a progress bar, and that is working okay. At the same time I echo the status to a text field, but that part seems to work once and then never change (it reports "requested" then never changes, for example).

This seems odd. Presumably the updating of the progress bar uses the same text you want to display in the text field. Can you show us the script you are using?

OK, the download works, and the download progress is updated correctly in the progress bar and the text field, but now when the download finishes, the URLstatus seems to be "stuck" on the last reported "loading" message. If I check the urlStatus for the just- concluded download, I get:

   loading,180902350,180902350

This effectively blocks all subsequent downloads. If I start another the urlStatus reports "queued" for that download.

If I check the pendingMessages I get:

45839,1154622702.764941,ulTickleMe,button id 1037 of group id 1016 of card id 1002 of stack "/Applications/Revolution/Revolution Enterprise/2.7.2-gm-1/Toolset/revlibrary.rev"

The only way to clear all of this is to quit Rev and relaunch.

Here is the scripting I am using to initiate the download (from an FTP server):

libURLDownloadToFile tDLURL, (the DLfolder of this cd & "/" & the titleToDL of me), "downloadComplete"
    libURLSetStatusCallback DLprogress,the long id of me

That calls this handler:

on DLprogress pDLurl,pStatus
  if pStatus contains "loading" then
    put item -1 of pStatus into tBytestotal
    put item 2 of pStatus into tBytesReceived
    set the endvalue of scrollbar "dlProgress" to tBytestotal
    set the thumbpos of scrollbar "dlProgress" to item 2 of pStatus
    set the numberformat to "0.##"
put (tBytesReceived / 1000000) & " MB of " & (tBytestotal / 1000000) & " MB" into fld "dlMsg"
    if tBytesReceived >= tBytestotal then
put "(DONE) " before line (the hilitedLine of fld "orderlist") of fld "orderlist"
      answer information "Download complete."
      dowloadComplete
    end if
  else if pStatus is "contacted" then
    put "Server contacted." into fld "dlMsg"
  else if pStatus is "requested" then
    put "Requesting file." into fld "dlMsg"
  else if pStatus is "queued" then
    put "Waiting for previous download to finish." into fld "dlMsg"
  else if pStatus is "downloaded" then
    put "Download complete." into fld "dlMsg"
downloadComplete #### I'm calling this to try to ensure it gets called!
  else if pStatus is "eror" then
    put "Error during download." into fld "dlMsg"
answer error "The download encountered an error and could not continue. Aborted."
    downloadComplete
  else if pStatus is "timeout" then
    put "Server timed out." into fld "dlMsg"
    answer error "The download server timed out. Download aborted."
    downloadComplete
  end if
end DLprogress

The downloadComplete handler is simple:

on downloadComplete
answer information "The file " & the titleToDL of btn "download" & " has downloaded successfully."
  hide group "dlStatusGrp"
end downloadComplete

Oddly enough, the first statement gets executed, but not the second. I'm stumped. Am I just doing something wrong?

Any ideas?

Regards,
Devin

Devin Asay
Humanities Technology and Research Support Center
Brigham Young University

_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to