libURLDownloadToFile and LiveCode

Dave Cragg dave.cragg at lacscentre.co.uk
Fri Oct 29 04:38:05 EDT 2010


On 29 Oct 2010, at 06:58, Ludovic Thébault wrote:

> Hello,
> 
> Under Revolution 4, this script work like a charm :
> 
> on mouseup
> ...
>     libURLDownloadToFile theUrl, theDestUrl, "Downloaded"
>     wait 0 milliseconds with messages
>     ShowInfo theUrl
> 
> end mouseup
> 
> on ShowInfo pUrl
>    local tStatus,tResult
>    put URLStatus(pUrl) into tStatus 
>   switch
>     case tStatus....
> 	....
>   end switch
>   send "ShowInfo" && pUrl to me in 10 milliseconds
> end ShowInfo
> 	
> 
> But with liveCode i've haven't the status and nothing seem to happen.
> 
> What is wrong ?

I'm not sure, but perhaps this has something to do with the new asynchronous behavior of the hostNameToAddress function. It seems that urlStatus will now return empty for a short period between issuing the load command and the point after it has obtained the IP address of the host. (previously this stage was done synchronously)

Are you checking for tStatus = empty in your switch? Does your switch control do anything that stops the load continuing in that situation?

As an alternative, you could try this (probably not reliable as a permanent solution, but it might confirm that this is the problem )  :


on mouseup
...
    libURLDownloadToFile theUrl, theDestUrl, "Downloaded"
    send "ShowInfo theUrl" to me in 100 milliseconds
    
end mouseup

If you want to track the status during the download, libUrlSetStatusCallback may be a better option.

Dave 


More information about the use-livecode mailing list