[REBOL] How do use 'request-download'? Or difference between Windows and Linux??
From: bpaddock::csonline::net at: 24-Oct-2001 12:38
I'm trying to down load a series of .PDF files from a patent sever. The following snippet
of code is what gets each page.
This seems to work under Linux, but when I run it under Windows it seems to be using
the URL as the file name, which doesn't work
because the URL has odd things in it like question marks (?).
Why am I getting different behaviour between Linux and Windows?
Better question, now do I make this work in both places?
repeat CurrentPageNumber LastPage [
wait 1 ; Required to get the 'cancle' button to work
if stop [break]
stat/text: reform ["Downloading Page " CurrentPageNumber " Now"]
show stat
GetPageURL: probe to-url rejoin ["http://" pdf-url to-string CurrentPageNumber]
OutputNameFILE: probe to-file rejoin ["US" PatentNumber "pg" CurrentPageNumber ".pdf"]
; Don't get pages that we do not need:
if not exists? OutputNameFILE [
either data: request-download GetPageURL [
write/binary OutputNameFILE data
][
alert "Download failed or canceled." quit
]
]