Team LiB   Previous Section   Next Section

Chapter 18. URL Access Scripting

The URL Access Scripting application provides an easy method for scripts to download files from and upload them to a remote directory. This application is located in the startup disk:System Folder:Scripting Additions folder. It provides two intuitive commands that can be used with the File Transfer Protocol (FTP) and HyperText Transfer Protocol (HTTP), download and upload. You can use these commands anywhere in your script, including within a tell block that targets another application, as long as the two commands do not conflict with that application's own commands. In other words, if a hypothetical program called ScriptableWebApp already has a download command in its dictionary, then the usage of download within the tell block tell app "ScriptableWebApp" will invoke that application's download command, not the URL Access download command.

URL Access can use HTTP to download the source code of a web page to a file of your choice or FTP files and whole directories back and forth from a web server. You have to have the cooperation of a web server, however, before your scripts undertake any directory/file uploads or directory downloads. With URL Access and FTP, you can have your script display a dialog window to allow the user to enter a username and password and thus be authenticated by the web server (see Figure 18-4 later in the chapter). Figure 18-1 shows the URL Access Scripting icon in the Scripting Additions folder.

Figure 18-1. URL Access Scripting icon
figs/ascr_1801.gif
    Team LiB   Previous Section   Next Section