Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
link76
- Posts: 99
- Joined: Fri Nov 04, 2011 1:52 pm
Post
by link76 » Mon Oct 02, 2017 10:35 am
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
-
ittarter
- Posts: 151
- Joined: Sat Jun 13, 2015 2:13 pm
Post
by ittarter » Mon Oct 02, 2017 10:55 am
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.
-
link76
- Posts: 99
- Joined: Fri Nov 04, 2011 1:52 pm
Post
by link76 » Mon Oct 02, 2017 11:13 am
I tried this way:
Code: Select all
libURLDownloadToFile, tDownloadLink, IT, "downloadComplete"
but work only development environment
-
jmburnod
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
-
Contact:
Post
by jmburnod » Mon Oct 02, 2017 11:55 am
Hi,
but work only development environment
Did you insert Internet inclusion in your standalone ?
Best regards
Jean-Marc
https://alternatic.ch
-
Klaus
- Posts: 13806
- Joined: Sat Apr 08, 2006 8:41 am
- Location: Germany
-
Contact:
Post
by Klaus » Mon Oct 02, 2017 12:25 pm
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"
...
-
link76
- Posts: 99
- Joined: Fri Nov 04, 2011 1:52 pm
Post
by link76 » Mon Oct 02, 2017 1:24 pm
Hi,
the setting of save standalone application is set to: search for required inclusions ....
-
Klaus
- Posts: 13806
- Joined: Sat Apr 08, 2006 8:41 am
- Location: Germany
-
Contact:
Post
by Klaus » Mon Oct 02, 2017 1:30 pm
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!
-
link76
- Posts: 99
- Joined: Fri Nov 04, 2011 1:52 pm
Post
by link76 » Mon Oct 02, 2017 1:56 pm
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?
-
jmburnod
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
-
Contact:
Post
by jmburnod » Mon Oct 02, 2017 2:50 pm
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
https://alternatic.ch
-
link76
- Posts: 99
- Joined: Fri Nov 04, 2011 1:52 pm
Post
by link76 » Tue Oct 03, 2017 7:41 am
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
-
jmburnod
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
-
Contact:
Post
by jmburnod » Tue Oct 03, 2017 11:50 am
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
https://alternatic.ch
-
link76
- Posts: 99
- Joined: Fri Nov 04, 2011 1:52 pm
Post
by link76 » Wed Oct 04, 2017 11:28 am
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!
-
jmburnod
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
-
Contact:
Post
by jmburnod » 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
https://alternatic.ch
-
link76
- Posts: 99
- Joined: Fri Nov 04, 2011 1:52 pm
Post
by link76 » Fri Oct 06, 2017 9:57 am
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.
-
jmburnod
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
-
Contact:
Post
by jmburnod » Fri Oct 06, 2017 7:38 pm
Thanks,
That could be useful for some unusual users of windows (i'm one of them)
Jean-Marc
https://alternatic.ch