Waiting for download to complete

Peter Bogdanoff bogdanoff at me.com
Mon Nov 14 20:41:38 EST 2011


HI,

I'm using the following script to download a file. After the download I move on to other things, How do I force LiveCode to wait until the download is completed before doing anything else besides updating a progress bar?

Currently the program moves on to other handlers that are contingent on the download being finished, which it isn't.

Thanks!

Peter


on downloadFile
   open stack "MITA_Updater"
   
   repeat until the lockscreen is "false"
      unlock screen
   end repeat
   
   updateStatus "Downloading the update..."
   
   load URL "http://artsinteractive.org/updates/MITA-1NEW.livecode" with message "downloadDone"
   
   libURLSetStatusCallback "myProgress",the long ID of scrollbar "Progress"
end downloadFile

on myProgress theObject,theStatus
   put theStatus into theObject
end myProgress

on downloadDone pUrl, pStatus
   put theURL & "MITA-1NEW.livecode" into thisURL
   
    if pStatus = "cached" then
          put url pUrl into url ("binfile:" & thisURL)
     end if
     unload url pUrl
end downloadDone


More information about the use-livecode mailing list