I’m new to Applescript, and am excited about learning the language. I am a big user of LiveCode, which is a cross-platform incarnation of HyperCard, so Applescript strikes me as somewhat familiar.
I need to download a bunch of files from the Security and Exchange Commission’s public FTP site. Happily, I was able to write the script to download one file using Interarchy. Here is my first little script.
tell application "Interarchy"
fetch alias "Blue Note:Users:me:Downloads:theFilename.txt" host "[url=ftp://ftp.sec.gov]ftp.sec.gov[/url]" user "anonymous" password "myEmailAddress" path "edgar/data/704432/0000950110-99-000960.txt"
end tell
But I have hundreds of urls, like the one in the script above, of files that I want to download. These are stored in a text file with one url per line. How would I have Applescript set a variable to the content of the file of urls and then repeat my fetch statement for each line (url)? I’m guessing it involves a repeat-with loop.
Much obliged. Looks like using the read command without first asking that the file be opened for access simply reads the entire file, and in that way works just like the put command in HyperCard and LiveCode.