O'Reilly logo

AppleScript in a Nutshell by Bruce W. Perry

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

URL Access Scripting

Synopsis

The following descriptions detail the available URL Access commands (download and upload ) available for scripting.

Dictionary commands

download

The download command downloads a file using either FTP or HTTP to the disk of the machine running the script. The web file can then be viewed with a browser locally. Any images, however, are not downloaded with the web page using HTTP, so you would have to download the images separately using the download command. download takes two required parameters: a string URL (as in http://www.parkerriver.com) and a file specification object to which the script downloads the file. A file specification is an AppleScript data type that represents the name and location of a file before it is actually saved to the hard disk. In other words, you can create a new file with the new file scripting addition, which will have the operating system reserve a unique path for the new file. The new file osax displays a dialog box requesting that the user choose a location and name for the new file. Figure 18-2 shows this new file dialog window.

The dialog window displayed by the new file osax
Figure 18-2. The dialog window displayed by the new file osax

The return value for new file is a file specification object. You can then download a file to this reserved file path and an actual file is saved to the hard disk with the prior specified location and name. You have to enclose ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required