Hi
I haven’t used AppleScript in a couple of years so am really rusty. What I’m trying to do it create a script that downloads PDFs from a web site. It bascially starts at number x and then counts down to 0, downloading any PDF with the name x. I can get all that to work fine - the problem I have is that I want it to automatically save the file rather than having to click the button each time to save it (there are a couple of hundred thousand PDFS to download). The code I have done so far is:
tell application "Finder"
set theDestinationFolder to ((path to desktop) & "downloads") as string
if exists theDestinationFolder then
else
make new folder at (path to desktop) with properties {name:"downloads" as string}
end if
display dialog "Start at number? " default answer ("173184") buttons {"Cancel", "Go"} default button 2
set startvalue to text returned of the result
repeat with theIncrementValue from startvalue to 1 by -1
set theFileNumber to theIncrementValue as string
set theURL to "http://www.example.com/?judgmentID=" & theFileNumber
set theFileName to text -((offset of "/" in (reverse of characters of theURL) as text) - 13) thru -1 of theURL & ".pdf"
set theFile to (choose file name default name theFileName default location (theDestinationFolder as alias))
do shell script "/usr/bin/curl " & theURL & " -o " & quoted form of POSIX path of theFile
end repeat
end tell
The line I’m having problems with is:
set theFile to (choose file name default name theFileName default location (theDestinationFolder as alias))
How do I get it to automatically save each file into the folder theDestinationFolder?
Thanks in advance!!