How to use urlProgress

Andrew Kluthe andrew at ctech.me
Thu Jun 20 16:36:02 EDT 2013


I would try to use the following instead of put url into url. This let's
you do it in a non-blocking way as well as let you process the data in a
callback.

load URL myURL with message "downloadComplete"

I really like the example Andre used on his site when describing his pubSub
library.

His example is pretty concise and works better than anything I have ever
used when combined with his pubSub lib for updating progress bars or other
UI elements.




On Thu, Jun 20, 2013 at 1:08 PM, Devin Asay <devin_asay at byu.edu> wrote:

> Hi folks,
>
> Maybe I'm missing something. I want to get progress information from a
> rather large download from an HTTP server. This is what I'm doing:
>
> command downloadFile
>     set the cursor to watch
>     put "http://server.com/data/myfile.gz" into tRemote_GZ
>     put "/path/to/file/pwr_complete.gz" into tLocal_GZ
>     put url tRemote_GZ into url ("binfile:" & tLocal_GZ)
> end downloadFile
>
> on urlProgress pURL, pStatus, pMessage, pBytesTotal
>     put "Downloading " & pURL & cr & "Status: " & pStatus &&  pMessage &&
>  "of TotalBytes: " & pBytesTotal \
>           into fld "prog"
> end urlProgress
>
> Nothing ever shows up in field "prog", but the download eventually
> succeeds. I can see the file on my hard drive after it has downloaded.
>
> Am I doing something wrong? I'm on OS X 10.7.x and LC 6.0.2.
>
> Devin
>
>
>
>
> Devin Asay
> Humanities Technology and Research Support Center
> Brigham Young University
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



-- 
Regards,

Andrew Kluthe
andrew at ctech.me



More information about the use-livecode mailing list