Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting several files from Web
#3
similar, with a sub-function

Macro Macro2472
Code:
Copy      Help
;allow single instance
if(getopt(nthreads)>1) end "The thread is already running. You can end it in the 'Running items' pane."
;create folder for files
str folder="$desktop$\test643"
mkdir folder

;list of files to download
str files=
;http://www.quickmacros.com/download.html
;http://www.quickmacros.com/support.html

;call sub-function Download for each file
str s
foreach s files
,sub.Download folder s


#sub Download
function str'folder str'url
spe -1

str sf sd ;;variables

;download imagefile data into variable sd
int downloaded
rep 60 ;;repeat max 10 minutes every 10 s until success
,IntGetFile url sd
,err 10; continue ;;if error, retry after 10 s
,downloaded=1
,break
if(!downloaded) end F"failed to download {url}"

;format filename and save to file
sf.getfilename(url 1)
sd.setfile(F"{folder}\{sf}")


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)