12-26-2014, 07:03 AM
similar, with a sub-function
Macro Macro2472
Macro Macro2472
;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}")