Page 1 of 1
Command DownloadFile() help!
Posted: Fri Jul 10, 2015 12:30 pm
by divsalv
Hi, I need help for the command DownloadFile (), i wrote an example, and I have a problem.
Code: Select all
Function tmp(cnt)
DebugPrint (cnt)
EndFunction
DownloadFile("www.url.it/file", {File = "tmp.txt",func=tmp(userdata=count)})
The file is downloaded, but the program stops, if I add code after the command DownloadFile () is not executed, and the function tmp () is executed only one time, how can I do to create a status bar if I do not return values ?
Thanks in advance for your help.
Would welcome an example.
Re: Command DownloadFile() help!
Posted: Sat Jul 11, 2015 2:07 pm
by divsalv
nobody?
Re: Command DownloadFile() help!
Posted: Sat Jul 11, 2015 5:18 pm
by airsoftsoftwair
There are lots of problems with your code. Check the documentation of
DownloadFile(). There is no "func" tag in the options table, it is an additional parameter. Also, read up on the basics of the Hollywood programming language because your code shows some misunderstanding of fundamental concepts, i.e. doing the following
will call the function tmp() with the result of the comparison "userdata=count" as the parameter and write the function's return value into the variable/table element "func". This is definitely not what you want.
Correct code would be something like this:
Code: Select all
Function func(msg)
DebugPrint(msg.action, msg.count, msg.total)
EndFunction
DownloadFile("http://www.url.it/file", {File = "tmp.txt"}, func)
Re: Command DownloadFile() help!
Posted: Tue Jan 05, 2016 11:10 pm
by lazi
There is a server which holds files with awkward names like this:
http://localhost/dokumentumok/$0000007E ... %A9ter.PNG
These file names are already encoded and can not do anything for
DownloadFile() to open it.
It sends this request to the server: GET /dokumentumok/%240000007EGy%f5ry%20P%e9ter.PNG HTTP/1.1
I have not found any strict restrictions about file naming of a http server. It varies on implementations and on the host filesystem/OS.
I think a switch would be nice for
DownloadFile() to control the file name encoding.
Or is there any other way?
Re: Command DownloadFile() help!
Posted: Fri Jan 08, 2016 10:55 pm
by airsoftsoftwair
Yes, I think this makes sense because in case the server can deal with non ISO 8859-1 characters you'll have a problem anyway so it would be good if
DownloadFile() also accepted encoded URLs. I'll see what I can do about this.
Re: Command DownloadFile() help!
Posted: Mon Feb 22, 2016 6:25 pm
by airsoftsoftwair
Code: Select all
- New: DownloadFile() and UploadFile() support a new tag named "Encoded" now; if this is set to TRUE,
DownloadFile() and UploadFile() will assume that the URL you've passed is already percentage-encoded
and no more encoding will be done
Re: Command DownloadFile() help!
Posted: Mon Feb 22, 2016 10:49 pm
by lazi
Hmm, I can smell the 6.1 in the air(soft)
