I want to create a simple script that downloads a file using Fetch and saves it to my desktop. It works, but it prompts me for the saving location. Is there anyway to script it so that it will automatically save to the desktop (or a folder of choice)?
Here’s my code:
tell application "Fetch 3.0.1"
activate
make new transfer window at beginning with properties {hostname:"XXXXX", userid:"XXXXX", password:"XXXXX"}
open remote item "XXXXX" -- to get to a subfolder
download remote file "test - ignore"
end tell
I don’t have Fetch, but looked at the dictionary just now. The following should work:
tell application "Fetch 3.0.1"
set use download folder to true
make new transfer window at beginning with properties {hostname:"XXXXX", userid:"XXXXX", password:"XXXXX"}
open remote item "XXXXX" -- to get to a subfolder
download remote file "test - ignore"
end tell
Check out the properties of the ‘application’ class. You’ll find other flags you can set to change Fetch’s behavior. One in particular you may be interested in is ‘download folder’ with which you can change the default download location.
I didn’t realize at first what a good idea it was for Macscripter’s staff to post PDFs of scriptable applications’ dictionaries, but now I do!