Page 1 of 1
libURLDownloadToFile progress download
Posted: Mon Oct 02, 2017 10:35 am
by link76
Hi,
I'm follow one of the lessons here:-
http://lessons.livecode.com/s/lessons/m ... a-download
I would like to replace
Code: Select all
load URL tDownloadLink with message "downloadComplete"
with "libURLDownloadToFile" because I can not download the file properly.
I tried this way but download works only in development environment
Code: Select all
libURLDownloadToFile, tDownloadLink, ("binfile:" & IT),"downloadComplete"
thank you
Re: libURLDownloadToFile progress download
Posted: Mon Oct 02, 2017 10:55 am
by ittarter
Hi,
I used to use libURLDownloadToFile but stopped for some reason. These always work for me (I have an FTP server)
Code: Select all
put url ftpfilename into url ("binfile:" & localfilename)
Code: Select all
put urlencode(ftpfilename) into url ("binfile:" & localfilename)
I suspect that removing the binfile from your code might make it work, since libURLDownloadToFile does binary automatically.
For detecting errors,
and do whatever you want with tError. If it's empty, no errors were detected. The script doesn't progress until the file has been downloaded, anyway.
Re: libURLDownloadToFile progress download
Posted: Mon Oct 02, 2017 11:13 am
by link76
I tried this way:
Code: Select all
libURLDownloadToFile, tDownloadLink, IT, "downloadComplete"
but work only development environment
Re: libURLDownloadToFile progress download
Posted: Mon Oct 02, 2017 11:55 am
by jmburnod
Hi,
but work only development environment
Did you insert Internet inclusion in your standalone ?
Best regards
Jean-Marc
Re: libURLDownloadToFile progress download
Posted: Mon Oct 02, 2017 12:25 pm
by Klaus
And there is
NO comma after the command name "liburldownload", and better NOT use IT here, put it into a variable first to avoid surprises:
Code: Select all
...
put it into tFileNameOnDisk
...
libURLDownloadToFile tDownloadLink, ("binfile:" & tFileNameOnDisk),"downloadComplete"
...
Re: libURLDownloadToFile progress download
Posted: Mon Oct 02, 2017 1:24 pm
by link76
Hi,
the setting of save standalone application is set to: search for required inclusions ....
Re: libURLDownloadToFile progress download
Posted: Mon Oct 02, 2017 1:30 pm
by Klaus
Oh, and only provide the filename here:
Code: Select all
...
put it into tFileNameOnDisk
...
## libURLDownloadToFile tDownloadLink, ("binfile:" & tFileNameOnDisk),"downloadComplete"
libURLDownloadToFile tDownloadLink, tFileNameOnDisk,"downloadComplete"
...
I found that the automatism "Search for required inclusions..." does not always work sufficiently, so better set up your inclusions manually!
Re: libURLDownloadToFile progress download
Posted: Mon Oct 02, 2017 1:56 pm
by link76
this code how should it be modified?
Code: Select all
put "http://my_url/setup.exe" into tDownloadLink -- 2MB
libURLSetStatusCallback "showProgress", the long name of me
-- make sure the progress bar is hidden, as this property is used to initialise it
hide scrollbar "ProgressBar"
hide group "group Login"
show group "group update"
put empty into fld "ProgressField"
put the seconds into sDownloadStart
load URL tDownloadLink with message "downloadComplete" (don't work!!!)
.....
I set up inclusions manually but not work, which files should appear in extensions?
Re: libURLDownloadToFile progress download
Posted: Mon Oct 02, 2017 2:50 pm
by jmburnod
Hi,
Code: Select all
load URL tDownloadLink with message "checkStatus" (don't work!!!)
I think you might use something like that:
Code: Select all
local tDownloadLink
...
libUrlSetStatusCallback "checkStatus",the long id of me
libURLDownloadToFile tDownloadLink,DestinationFolder
...
on checkStatus pURL,pStatus
if pURL = tDownloadLink then
--•• watch process
-- if the vis of group "grDevTools" then
-- put the ticks & "," & "checkStatus" & "," & pUrl & "," & pStatus & cr before fld "fSpy"
-- end if
--•••
switch (item 1 of pStatus)
case "loading"
-- setpb item 3 of pStatus,word 1 of item 2 of pStatus -- custom progressbar
break
case "downloaded"
-- set the rect of grc "bar" to the rect of grc "border" -- custom progressbar
-- send "AfterDownload" to me in 1 seconds
break
default -- contacted, requested, etc.
end switch
end if
end checkStatus
Re: libURLDownloadToFile progress download
Posted: Tue Oct 03, 2017 7:41 am
by link76
Hi jmburdon,
I tried your code, it works in development environment but when I create the standalone application, a file is downloaded to 0 bytes
Code: Select all
local tDownloadLink
on mouseUp
put "http://myurl.it/setup.exe" into tDownloadLink
set the itemDel to slash
put last item of tDownloadLink into tFilename
put specialFolderPath("Desktop") & slash before tFileName
put URL tFileName into URL ("binfile:" & tFileName)
put tFileName into DestinationFolder
libUrlSetStatusCallback "checkStatus",the long id of me
libURLDownloadToFile tDownloadLink,DestinationFolder
end mouseUp
on checkStatus pURL,pStatus
if pURL = tDownloadLink then
switch (item 1 of pStatus)
case "loading"
-- setpb item 3 of pStatus,word 1 of item 2 of pStatus -- custom progressbar
break
case "downloaded"
-- set the rect of grc "bar" to the rect of grc "border" -- custom progressbar
-- send "AfterDownload" to me in 1 seconds
break
default -- contacted, requested, etc.
end switch
end if
end checkStatus
Re: libURLDownloadToFile progress download
Posted: Tue Oct 03, 2017 11:50 am
by jmburnod
Hi,
What about this :
Code: Select all
local tDownloadLink
on mouseUp
put "http://myurl.it/setup.exe" into tDownloadLink
set the itemDel to slash
put last item of tDownloadLink into tFilename
set the itemDel to ","
put specialFolderPath("Desktop") & slash before tFileName
-- put URL tFileName into URL ("binfile:" & tFileName)
-- put tFileName into DestinationFolder
libUrlSetStatusCallback "checkStatus",the long id of me
libURLDownloadToFile tDownloadLink,tFilename
end mouseUp
Best
Jean-Marc
Re: libURLDownloadToFile progress download
Posted: Wed Oct 04, 2017 11:28 am
by link76
Hi all,
I finally solved the problem.
The problem is in the revsecurity.dll library that is not implemented in the standalone application, copying it manually works!

Re: libURLDownloadToFile progress download
Posted: Thu Oct 05, 2017 4:50 pm
by jmburnod
Hi
The problem is in the revsecurity.dll library that is not implemented in the standalone application, copying it manually works!
I don't see revsecurity.dll in inclusions list. Where did you find it ?
Best regards
Jean-Marc
Re: libURLDownloadToFile progress download
Posted: Fri Oct 06, 2017 9:57 am
by link76
jmburnod wrote: ↑Thu Oct 05, 2017 4:50 pm
Hi
The problem is in the revsecurity.dll library that is not implemented in the standalone application, copying it manually works!
I don't see revsecurity.dll in inclusions list. Where did you find it ?
Best regards
Jean-Marc
Hi Jean-Marc,
I use LC 5.5, I have a commercial license.
When I created the standalone application, specifying the url: http: // myurl, it included the library in the root folder.
Re: libURLDownloadToFile progress download
Posted: Fri Oct 06, 2017 7:38 pm
by jmburnod
Thanks,
That could be useful for some unusual users of windows (i'm one of them)
Jean-Marc