a blocking download

Josh Mellicker josh at dvcreators.net
Tue Jun 15 13:14:40 EDT 2010


Hi Andrew,

What you need to do, if I understand correctly, instead of a repeat loop, is start one file downloading with a message sent once the file is complete, then the program stops execution.

Once the file is downloaded, the message is sent, triggering the handler that finds the next file to be downloaded, and so on.

For example, from your code, call "getNextFileDownloading" to get the first file downloading, then:

on getNextFileDownloading
  # get next remote and local paths and files to download
  downloadNextFile pRemotefile, pLocalFile
end getNextFileDownloading

on downloadNextFile pRemotefile, pLocalFile
  libURLDownloadToFile pRemotefile, pLocalFile, "getNextFileDownloading"
end downloadNextFile



On Jun 14, 2010, at 12:47 PM, Andrew Kluthe wrote:

> 
> I made myself an update stack that checks a local text file with version
> information for my program components and compares it to the text file
> pulled from my update server. The entries that don't match get downloaded
> with libURLDownloadToFile. 
> 
> I have am trying to have it go through one at a time and report on the
> download status of each compnent with  one progress bar and a long window.
> 
> The problem I have is that when it loops through the list of files to
> download, it triggers all the download handlers at once. So even if it
> doesn't download all the files in sequence, the log reports that all the
> downloads start before the first one finishes.
> 
> Is there a way to make my loop wait till the current component download
> handler is totally done? Is this where  I need to use a "blocking" version
> of a download file? Below is a mix of revlike psuedocode for clarity's sake.
> 
> on goList
> get localList
> get webList
> put getDifferences(weblist, locallist) into downloadList
> repeat for each line i in downloadList
> downloadComponent( line i)
> end repeat
> end goList
> 
> on downloadComponent pStackName
>   put "Downloading " & pStackName after fld "log"
>   put empty into gDownloadedFile
>   put pStackName into gDownloadedFile
>   put "C:/FarmOffice/LeaseManager/" into sBasePath
>   put "http://somethingHere.com/Update" into sWebPath
>   libURLSetStatusCallback "showProgress", the long name of me
>   hide scrollbar "download"
>   libURLDownloadToFile sWebPath & pStackName, sBasePath &
> pStackName,"downloadComplete"
> 
> end downloadComponent
> 
> 
> Basically, I don't want the next downloadComponent hanlder to go until the
> previous one has finished.
> 
> note: the callback handlers and the handler for the progress bar are
> intentionally left out as they would function just fine if I could make the
> loop wait on downloadComponent.
> 
> -- 
> View this message in context: http://runtime-revolution.278305.n4.nabble.com/a-blocking-download-tp2254935p2254935.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list