Need Help With FTP

Phil Davis revdev at pdslabs.net
Thu Apr 23 18:43:11 EDT 2015


Hi Gregory,

I would probably use the "load" command because it's a non-blocking way 
to do it - it doesn't prevent interaction while it's working.

Maybe something like this (I didn't test this):


-- button --
on mouseUp
     doDownload
end mouseUp


-- card or stack --
# required:
# fld "status"
# fld "my links"
# fld "folderpath"

local sUrlList, sTotal, sCurrent=0

command doDownload
     put fld "my links" into sUrlList
     put (the number of lines in sUrlList) into sTotal
     _download
end doDownload


command _download
     -- let user know what's happening
     add 1 to sCurrent
     put ("downloading" && sCurrent && "of" && sTotal) into fld "status"
     load url (line sCurrent of sUrlList) with message "_saveFile"
end _download


command _saveFile
     set the itemDel to slash
     get (line sCurrent of sUrlList)
     put url it into url ("binfile:" & fld "folderpath" & "/" & last 
item of it)
     unload url it

     if sCurrent < sTotal then
         send "_download" to me in 1 tick -- get the next file
     else
         put empty into fld "status"
         answer "all files downloaded!"
         exit to top
     end if
end _saveFile


Best -
Phil Davis



On 4/23/15 2:18 PM, Gregory Lypny wrote:
> Hello everyone,
>
> I’m working on a big research project that requires that I download many small files (under 2MB) from the US Security and Exchange Commission’s (SEC) public FTP site. I have the links to all of the files I need, and I’m wondering how I would use a LiveCode “repeat with” loop to download the files while avoiding a session timed-out error.
>
> Any tips would be much appreciated.
>
> Regards,
>
> Gregory
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

-- 
Phil Davis





More information about the use-livecode mailing list