AppleScript 1.7 (Mac OS 9.2.2 & Mac OS X 10.1/10.1.1 Puma)

Mac OS X 10.1 was announced by Steve Jobs during his Keynote address at the Seybold San Francisco 2001 show on September 25, 2001. It officially went on sale on September 29, 2001. It went by the development code name Puma. Rumors suggest that the next major release, version 10.2, may appear in the March 2002 time frame, somewhat later than earlier predictions of January 2002; it is said to bear the code name Jaguar. An interim 10.1.1 release came out on November 13, 2001; the release notes did not mention any AppleScript changes. The subsequent interim 10.1.2 release included AppleScript 1.8.1 and is the subject of a short separate AppleScript Sourcebook report. Apple’s press release announcing Mac OS X 10.1 included this description of its AppleScript support: substantial improvements to AppleScript® throughout the system, and full support for Internet scripting using SOAP and XML. 12/28/01

Version 10.1 is widely viewed as the first solid, mainstream release of Mac OS X having the speed, stability and functionality required to justify its use as the primary Macintosh operating system for home, business and other use. Mac OS X 10.0 has been shipping on new Macintosh computers for a few months now, but only as a secondary operating system that users must explicitly select as their startup operating system if they wish to use Mac OS X. Version 10.1 is now shipping on new machines, also as a secondary operating system. It is expected that Mac OS X will begin shipping as the default primary operating system around March 2002, perhaps with the release of version 10.2. Mac OS X-native applications and utilities are now becoming available by the hundreds, and the recent release of such major Mac workhorses as Microsoft Office v. X for Mac OS X should eliminate any lingering concern about adoption of Mac OS X. 12/28/01

AppleScript 1.7 is included in the native Mac OS X 10.1 environment. The official announcement of AppleScript 1.7 by Apple was very exciting to all scripters, because it revealed information about major new AppleScript-related features of Mac OS X that came as a surprise to most. These and other AppleScript developments will be detailed in this report.

An edition of AppleScript 1.7 for installation in the classic Mac OS and the Classic environment of Mac OS X was belatedly released on December 5, 2001, as part of an upgrade to Mac OS 9.2.2. This was the first time we saw a substantial delay between the release of a new AppleScript version for Mac OS X and the release of the corresponding version for the classic Mac OS. One may speculate that this represents the beginning of Apple’s abandonment of the concept of version parity between Mac OS X and the classic Mac OS. Indeed, the Working with AppleScript 1.7 in Mac OS 9 and Mac OS X topic in the What’s new about AppleScript section of the AppleScript Help book in the Help Center spoke of the existence of some differences between the Mac OS X and classic Mac OS versions of AppleScript 1.7, even before the latter was here. The most important feature of AppleScript 1.7 in the classic Mac OS, however, is the inordinate number of new bugs, relating for the most part to the parsing of file paths. In the initial version of this report, we cautioned users not to upgrade to Mac OS 9.2.2 until they had evaluated any older scripts on which they depend in the new environment. Subsequently, Apple itself replaced AppleScript 1.7 with AppleScript 1.6 in shipping Mac hardware and offered users who had already installed AppleScript 1.7 a means to revert to AppleScript 1.6. These problems with AppleScript 1.7 in Mac OS 9 did not affect AppleScript 1.7 in Mac OS X. See New AppleScript Features in Mac OS 9.2.2 for details. 10/8/02

AppleScript usage in Mac OS X is very similar to its usage in the classic Mac OS, but there are also significant differences, many of them dictated by the very different underpinnings of the two operating systems. Rather than repeat them all here, we recommend that users read The AppleScript Sourcebook’s report on AppleScript 1.6 in Mac OS X 10.0 first, then read this report on AppleScript 1.7 for the new features and changes that have appeared in Mac OS X 10.1. It is particularly important to understand the new multi-domain structure of Mac OS X and its impact on AppleScript, which is explained at some length in the AppleScript 1.6 report. Discussions in that report of limitations in AppleScript in Mac OS X 10.0 are less important, because many of the most severe limitations have been removed in Mac OS X 10.1, as detailed here.

Like the reports on previous versions of AppleScript, this report is based on information obtained from various sources, including official Apple publications and several AppleScript and Mac OS X mailing lists and news groups, and my own investigations. It includes information I have dug out of the product itself, as installed on my own computers.

PRODUCT UPGRADES FOR MAC OS X COMPATIBILITY

There have already been an overwhelming number of new and updated applications for Mac OS X that include robust AppleScript support, and many more have been announced for release over the next two or three months. Those listed here may be considered especially important to scripters because of their focus on providing an authoring and execution environment for AppleScript.

Script Editors and Environments
Apple’s Script Editor 1.7 remains a functional but spare script editor with minimal debugging features that is installed as part of Mac OS X. It is still virtually identical to the Script Editor that has been part of the classic Mac OS since 1993. It remains a suitable utility for writing simple AppleScripts, and it provides a very easy pathway for newcomers to learn AppleScript. Many expert and professional scripters still use it as their primary editor. Late Night Software’s Script Debugger 3.0 was announced and became available on the same day that Mac OS X 10.1 was announced, September 25, 2001, followed less than a month later by Script Debugger 3.0.1. It is a much more capable script editor and debugger having many powerful features not available in Apple’s own Script Editor. It adds significant new functionality over Script Debugger 2.0 that will be useful both to beginners and to experienced AppleScripters. It runs natively in Mac OS X and also in the classic Mac OS. It includes Late Night Software’s JavaScript OSA component, adding JavaScript to your portfolio of OSA scripting languages. As of this writing, a bug-fix release, Script Debugger 3.0.1, is imminent. Smile 2.2.0 from Satimage is a free alternative script editor for Mac OS X 10.1 with many interesting and powerful features. It has also since been updated, to version 2.3.0 at this writing. FaceSpan, the graphical user interface builder for AppleScript applications, from Digital Technology International (DTI), is reportedly being ported to Mac OS X. A release date has not been announced. (This news came in conjunction with reports in mid-November 2001 that Apple’s notoriously aggressive legal department had asked DTI to stop using the names Visual AppleScript, Visual AppleScripter, the www.visualapplescript.com domain and the tagline It’s Visual AppleScript, in connection with the product. At this writing, the FaceSpan web site still contains the offending language.) 12/28/01

Scripting Additions
Additional Mac OS X scripting additions are appearing. Look in the Scripting Additions section of The AppleScript Sourcebook’s Links chapter. A more complete list is available at osaxen.com hosted at MacScripter.net. One important Mac OS X scripting addition, especially now that Mac OS X 10.1 supports the XML-RPC and SOAP protocols, is Late Night Software’s XML Tools scripting addition; version 2.3.1 was released on October 5, 2001, shortly after the release of Mac OS X 10.1. Satimage has also released its Satimage scripting addition in Mac OS X native form, as part of the Smile package. It implements a number of string, math and other commands. Although primarily of interest to developers of scripting additions, it is worth mentioning here Eric Grant’s UniversalOSAX, a free CodeWarrior plugin that allows developers of scripting additions to create a single scripting addition file that executes on all Mac platforms that support AppleScript, from 68K machines running System 7 to the latest G4’s running OS X 10.1. Until now, it has appeared that separate versions of scripting additions would be required for the classic Mac OS and Mac OS X, but wide adoption of Eric’s new technology may change that.

Scriptable Applications
Additional and revised Mac OS X applications with AppleScript support are appearing at a rapid pace. See the Scriptable Applications section of The AppleScript Sourcebook’s Links chapter for details about some of them.

NEW FEATURES, CHANGES, AND LIMITATIONS IN APPLESCRIPT 1.7

New Features
The announcement of Mac OS X 10.1 was accompanied by a wealth of splashy new AppleScript-related material posted to Apple’s web site, describing major new AppleScript features:
In a new version of Apple’s chart of Mac OS X’s fundamental technology layers, AppleScript is shown alongside Aqua on the top line, signifying that AppleScript is a user interface in the same sense as the Aqua graphical user interface. We’ve known it all along, even though Apple hasn’t always shown it this way as this more common Aqua-only version of the chart demonstrates. It is nice to see Apple illustrating the whole truth vividly for all to see. One can only guess at the significance of the fact that the AppleScript segment of the line is shown at a ratio of approximately 9 units of length to Aqua’s 15 units (according to my trusty HO-gauge model railroad ruler). Fittingly, this is very nearly the Golden Mean or Divine Proportion known to the ancient Greeks and Egyptians, which is intrinsic in growth patterns in nature and which has important artistic and mathematical applications. AppleScript is, increasingly, an organic part of the Mac OS.

A new set of pages about AppleScript summarizes what’s new with AppleScript in Mac OS X 10.1, including some surprises that had not previously gained any prominence in the rumor mill:

A partial list of scriptable applications that are installed with Mac OS X, including new scriptable versions of the Print Center, Internet Connect and the Terminal. Print Center 1.0 had a terminology dictionary in Mac OS X 10.0, but the dictionary has been expanded in Mac OS X 10.1 even though the application is still versioned at 1.0. Internet Connect and Terminal are newly scriptable.

A collection of downloadable AppleScript Toolbar Scripts for installation in the Finder toolbar, which can optionally be shown in every Finder window.

A brief explanation of the new AppleScript support in Mac OS X for SOAP (Simple Object Access Protocol) and XML-RPC (Remote Procedure Calls), which can be used to access a rapidly-growing variety of Web or Internet services, such as looking up stock quotes. Several links to Web sites explaining Web services are included. SOAP is a working standard defined by the WC3, and XML-RPC is a UserLand Software open specification first implemented in Frontier 5.1. Despite all the excitement about the new AppleScript Studio, described below, support for SOAP and XML-RPC may ultimately prove to be the more revolutionary new feature of Mac OS X 10.1. Dave Winer, of MORE and Userland Frontier fame and the first advocate of scripting on the Mac, was the originator of the XML-RPC specification and a tireless champion of both it and the SOAP standard. Dave had this to say in his Apple on Board! article on DaveNet, a couple of months before the final release of Mac OS X 10.1: UserLand worked with Apple on their XML-RPC and SOAP 1.1 implementation. It’s beautifully integrated into the OS, and very Mac-like, and should interop well with all the other implementations.

BlogScript by Tim Connor may be the first third-party script to make use of this facility, allowing you to post submissions to any Blogger-powered weblog. The Sending events to an application on a remote server topic in the News about AppleScript section of the AppleScript Help book explains that you simply target a URL for a SOAP or XML-RPC Web server using a tell block in this form, as if the URL were the name of the application: ‘tell application http://server.domain.com’. Additional sample scripts are available in Apple’s new Making XML-RPC and SOAP Requests With AppleScript developer document, and in the Internet Services Examples folder of the downloadable Script Menu scripts.

Script Menu, a downloadable utility that lets you install and execute scripts from the menu bar, much like the familiar classic Mac OS utility, OSA Menu, by Leonard Rosenthol. Scripts for the Script Menu are available for download, including scripts for use with Web services and Terminal. Script Menu not only runs AppleScript scripts, but also Perl scripts and shell, or command line, scripts. A QuickTime movie shows Menu Script in action, including its easy installation by simply dragging the application onto the menu bar. Script Menu has reportedly been a matter of some controversy within Apple. The Human Interface group believes that iconic menus on the right end of the menu bar should be limited to hardware control. John Geleynse, User Experience Technology Manager in Apple Worldwide Developer Relations, said on one of Apple’s mailing lists that [t]he Script menu itself was a technology demonstration more than anything else. It is not included as part of a normal Mac OS X 10.1 install and thus should not be interpreted as license to put anything in the menu bar. Inroads on the Human Interface policy are not confined to Menu Script; Aladdin Systems’ StuffIt Deluxe 6.5 product also installs its Magic Menu icon in the menu bar. The Script Runner floating button makes the same Script Menu scripts available in another fashion; whether you use either or both of them is a matter of user choice at this point. John Baxter has pointed out that scripts installed in, for example, a Basics subfolder in ~/Library/Scripts/ are not merged with scripts installed in /Library/Scripts/Basics/ to form a single menu item, as is done with most utilities that recognize items in both the user and the local domains, but are instead placed in different sections of the menu. Apple’s Chris Nebel has reported that Script Menu will run PERL and other scripts as well as AppleScript scripts: Indeed they do – Script Menu will treat any file that begins with ‘#!’ as a script and try to execute it. It’s a little weird about it, though – if it doesn’t see ‘#!/usr/bin/perl’, it executes it using /bin/sh, which means you can’t throw an arbitrary script at it. E.g., you couldn’t use a csh script by leading off with ‘#!/bin/csh’. This might be construed as a feature, but I’d consider it an iffy one at best. 12/28/01

AppleScript Studio, to be available later this year, is an exciting utility, reminiscent of FaceSpan, that will let you build and debug fully-interactive Mac applications in AppleScript with a large variety of Aqua interface widgets, such as buttons and text fields. The pictures on the Web site of a couple of widget palettes look very similar to the palettes in Interface Builder, Apple’s developer tool for building real applications in Carbon and Cocoa.

MacCentral’s report on Sal Soghoian’s demonstration of AppleScript Studio at Seybold included the following description of AppleScript Studio: Studio combines AppleScript with Apple’s IDE (Integrated Development Environment) tools Project Builder and Interface Builder. This makes AppleScript a peer language with Java and Objective C, said Sal Soghoian, Apple’s AppleScript guru. This combination will give scripters a tool to create professional level scripts that can take advantage of everything AppleScript offers and provides end-users an Aqua interface to run the script. Soghoian demonstrated a complex script, built with AppleScript Studio, where the script pulled data from FileMaker Pro and IMedia and placed the data into InDesign, creating a shake and bake real-estate catalog. Now is the time for scripting on Apple, said Soghoian to rapt applause. Apple’s Chris Nebel has disclosed that the version of Project Builder shipping with Mac OS X 10.1 already supports compilation of AppleScripts: just create a new AppleScript Build Phase, drag the appropriate source files in, and there you go. This is handy for maintaining any sufficiently complicated set of scripts, since Project Builder is a much better editor than Script Editor and lets you use source control. What AppleScript Studio will add is the ability to build interfaces hooked to AppleScripts in Interface Builder. I have some familiarity with Project Builder, but my attempts to compile an AppleScript with it have thus far been in vain, despite additional clues from Apple engineers on the AppleScript mailing lists. Macworld’s Best of Show awards at Seybold San Francisco 2001 honored AppleScript Studio even though it hasn’t yet been released, saying, [a]lready an extremely popular tool for creating customized publishing workflow systems, AppleScript systems can become more powerful and flexible than ever before when AppleScript Studio is added to the mix. The initial reaction from FaceSpan product support, in the person of Shirley Hopkins, was that AppleScript Studio was impressive to say the least, but she saw it as a product for developers, leaving a place for FaceSpan at the less technical end of the spectrum.

There is an AppleScript section in the Mac OS X Theater. It includes a QuickTime 5 movie showing two scripts, supplied with Mac OS X, being run from the floating Script Runner button: a Font Sampler script that creates samples of installed fonts in a TextEdit document, and a script that obtains the temperature in a specified area code using Internet services. The same movie is available at another page. Script Runner was also present in Mac OS X 10.0. It and the new Script Menu apparently expose the same set of scripts to the user and can therefore be viewed as alternatives.

The AppleScript Help book, in the Help Center installed on every Mac OS X 10.1 computer, contains information about other new AppleScript features, along with information on bugs and bug fixes summarized elsewhere in this report. The new features are summarized here. Note that most of the AppleScript Help book is maintained on Apple’s servers, and you must therefore have a live Internet connection to download it. Check the AppleScript Help book periodically for any updated information that Apple may provide from time to time.

Sending Apple events to applications on remote Mac OS X computers is now supported using TCP/IP, according to the Scripting remote applications topic in the What’s new about AppleScript section of the AppleScript Help book. AppleTalk is not supported for remote events. Remote events were not supported in Mac OS X 10.0. The eppc:// form of URL must be used to specify the IP address of the remote machine, as in this partial statement: ‘tell application of machine eppc://’. To enable receipt of Apple events from remote Mac OS X computers, the Allow Remote Apple events checkbox must be selected in the Application tab of the Sharing panel of System Preferences on the receiving machine. To allow receipt of Apple events from remote Mac OS 9 computers, also select the Allow Mac OS 9 computers to use remote Apple events checkbox and set a password. If you make these selections, be mindful of security issues. Unfortunately, remote events do not seem to be working; I always receive error number -916 (the port was closed), and others are reporting the same error.

Apple’s Chris Nebel has confirmed that program linking is limited to IP, which means you have to use an ‘eppc://’ URL as the machine name. The problem is that if it sees a machine name that isn’t an eppc URL, it will simply remove it.

As described in the Using the Open Location command to open a Web site topic in the News about AppleScript section of the AppleScript Help book, you can force a Web site to open in a specified application using the Open Location command in the Standard Additions scripting addition. Use a statement in the form 'tell application to open location , specifying a valid Web address. This will work with any valid URL, including, for example, http:// and ftp://. If you leave out the Tell part of the statement and just use Open Location, the URL will open in whatever application you designated in the Internet panel of System Preferences. In addition, by omitting the Tell block and providing an appropriate URL, you can mount an AFP or WebDAV file server located at the specified URL. For example, to mount your personal iDisk as an AppleShare volume, use this statement: 'open location afp://idisk.mac.com. You will be presented with a dialog in which to enter your iDisk user name and password, then your iDisk will be mounted on your desktop. (You can provide the user name and password programmatically if you use the Mount Volume command, instead of Open Location, as described later in this report.) It is generally preferable to mount your iDisk using Apple’s new WebDAV (Web-based Distributed Authoring and Versioning) server capability, which you should be able to do using this form: 'open location http://idisk.mac.com. However, at this writing, authentication errors prevent mounting your iDisk in this fashion. At first, I thought this might be a temporary problem on Apple’s iDisk servers as they work the bugs out of the new WebDAV setup, but the Mount Volume command can’t currently mount an iDisk using WebDAV, either, as described later in this report, so the problem may be more serious. Using the Mount Volume command in this form, ‘mount volume afp://idisk.mac.com’, is not an effective workaround because it mounts the iDisk as an AppleShare volume, not a WebDAV volume.

The Standard Additions scripting addition’s Choose URL command now works. The Using the Choose URL command topic in the News about AppleScript section of the AppleScript Help book misdescribes one aspect of its usage, however. Correctly speaking, if you pass False in the optional Editable URL parameter (‘choose URL without editable URL’), you are prevented from typing a custom URL but can choose from the same list you see when you choose Go → Connect to Server in the Finder. If you pass True (‘choose URL with editable URL’) or omit the parameter, you can either choose from the list or type a custom address.

Changes
The Scripts saved as applications work in Mac OS 9, Classic, and Mac OS X topic in the News about AppleScript section of the AppleScript Help book notes that you no longer have to choose whether to save an AppleScript application, or applet, for Mac OS X or for the Classic environment. Applets saved in Mac OS X 10.1 use a new universal format and will run in all three environments. This is true also for older scripts that are recompiled in Mac OS X 10.1. Of course, it is still up to you to write the script using syntax and terminology that will work in whatever environment it finds itself. A new option in the Finder’s Show Info box for AppleScript applets allows you to specify that an applet will run in the Classic environment when double clicked; otherwise, it will run in the native Mac OS X environment.

The Info For command in the Standard Additions scripting addition now recognizes packages. A package is an application in Mac OS 9 and Mac OS X that is composed of a folder and its contents, but which is disguised by the Finder and most other applications so as to look like a traditional application file. The File Information record returned by Info For now includes a new Boolean property, Package Folder, disclosing whether an application is a package (True) or a file (False). The File Type and File Creator properties of the File Information record are also now provided for packages.

The Using AppleTalk to connect to a server or disk topic in the News about AppleScript section of AppleScript Help indicates that new syntax is required to mount a disk or AppleShare server over AppleTalk with the Mount Volume command in Standard Additions. Recall that in Mac OS X 10.0, AppleTalk was limited to printing, and it is only with Mac OS X 10.1 that full support for AppleTalk networks is introduced. The new form for a statement to mount an AppleTalk server is ‘mount volume afp:/at//’. To specify the user and password in the script with the new syntax, use the form ‘mount volume afp:/at// as user name with password ’; otherwise, you will be presented with the standard log-in dialog. When supplying your user name in a script, make sure you use your AppleTalk user name, which may differ from your Mac OS X short user name. The dictionary has not been changed to note these new forms for AppleTalk servers.

The Help topic deals only with AppleTalk servers, but I have explored the Mount Volume command with respect to TCP/IP servers, as well. In general, TCP/IP, if it is available, is much preferred over AppleTalk. The dictionary’s advice to use an URL path starting with afp:// is still correct to mount a server over TCP/IP using the form ‘mount volume afp://10.0.1.51’, but this will cause a dialog to appear requiring you to select the desired volume name. To avoid the volume dialog, use the form ‘mount volume afp:///’. And to avoid the user and password dialog, as well, use either the form ‘mount volume afp:/// as user name with password ’ or the form ‘mount volume afp://:@/’. In any case, AppleTalk or TCP/IP, the Finder’s Show Info window describes the mounted volume as an AppleShare volume. In the case of TCP/IP servers, you can use your Mac OS X short user name, as well as your long user name. The dictionary also suggests that you can use a statement in the form ‘mount volume of server ’, but I find that this generates an error.

Scripts running in the Classic environment can now target Mac OS 9 control panels, although only some control panels work in the Classic environment, according to the Mac OS X scripts can send events to Classic control panels topic in the News about AppleScript section of AppleScript Help.

The AppleScript now supports file extensions topic in the News about AppleScript section of AppleScript Help notes that AppleScript 1.7 now supports both Mac OS X file name extensions for all file types and historical resource-based file types (and creators). This obviates the necessity to write elaborate routines to check both the traditional file type and the file extension to be sure of learning a file’s type, as was required in Mac OS X 10.0. AppleScript files themselves may bear the extensions .applescript for script text files, .scpt for compiled script files, .osax for scripting addition files, and .asdictionary for scripting dictionary files (typically in application bundles). We will not go into the very hotly-debated issue of Apple’s decision to introduce into Mac OS X 10.1 a mechanism to hide or show file extensions, at the user’s option, except to say that the eventual developer reaction, once Apple explained the complete protocol, was positive. AppleScripters may find it necessary to show a file’s extension, just to see what it is, in order to specify it properly when hard coding a file name into a script.

A similar issue relates to the .app file extension for applications. Scripters must include the extension in references to application files of the form ‘alias ((path to startup disk as string) & Applications:Chess)’. This is true even if file extensions are hidden in the Finder. There is also a problem with concatenated path names in application tell blocks; a workaround is to assign the concatenated path to a variable outside the tell block. (Thanks to Paul Berkowitz for these and other observations.) 10/8/02

In what will be a welcome change, Mac OS X 10.1 scripting addition commands sent to an application are now executed in that application’s window layer, according to the Mac OS X scripting addition commands work better topic of the News about AppleScript section of AppleScript Help. Formerly, in Mac OS X 10.0, scripting addition commands would not run in a targeted non-scriptable application, but instead in Script Editor, and it was sometimes necessary to take elaborate steps to ensure, for example, that the Display Dialog command in the Standard Additions scripting addition would display its dialog where the user could see it without having to manually bring some application to the front.

In file paths, volume names are case-sensitive, according to the Volume names are case-sensitive topic in the News about AppleScript section of AppleScript Help.

Apple’s Chris Nebel reported on one of the AppleScript mailing lists that, [a]s of version 1.7, AppleScript supports \n in strings directly, just like \r, so you could do something like this: ‘write This is\r a Mac line ending to mac_file’ and 'write This is\n a Unix line ending to unix_file. Scripts compiled using \n will work correctly with older versions of AppleScript, though the \n won’t be visible when you view the source.

Limitations
The Using Classic scripting additions with Mac OS X topic in the What’s new with AppleScript section of the AppleScript Help book reminds us that scripting additions created for the classic Mac OS cannot be used directly with Mac OS X. They are for use only in the Classic environment, and they must be installed in the Scripting Additions folder of the classic Mac OS System Folder. Note that scripting additions created using Eric Grant’s UniversalOSAX CodeWarrior plugin will nevertheless work in both environments.

The Using terms from Mac OS 9 scripting additions in a Mac OS X script topic reminds us of a related point, that it is possible to force a Mac OS X script to execute in the Classic environment so that it can use terminology from classic Mac OS scripting additions. It explains that, to do so, you must nest a Using Terms From block inside a Tell block addressing an application in the Classic environment. Any Classic application will do, whether or not scriptable; the point is only to force the scripting addition to execute in the Classic environment. The Using Terms From block must specify the Classic scripting addition. This Apple Help topic still fails, as it did in Mac OS X 10.0, to explain how you address a scripting addition in a Using Terms From block, which is normally used with scriptable applications. There are two techniques that have been reported to work, reproduced here verbatim from our report on AppleScript 1.6 in Mac OS X 10.0:

In two steps: First, put the scripting addition commands in a Using Terms From block, addressing an alias to the scripting addition using its path in the classic Mac OS Scripting Additions folder, and compile. Then remove the Using Terms From wrapper from your script (leaving the innards of the block in place, with their raw event codes) and replace it with a Tell Application wrapper, and recompile.
In one step: Put your scripting addition statements in a Using Terms From block, addressing an alias to the scripting addition using its path in the classic Mac OS Scripting Additions folder. Wrap the Using Terms From block in a Tell Application block, using a variable containing the name of the application instead of the name itself. Before the Tell Application block, insert a script command to launch any classic Mac OS application using its path as a hard-coded string (since the Path To command won’t let you find the classic Scripting Additions folder when running in Mac OS X). Compile.

There is now a second way to force a Mac OS X script to run in the Classic environment: Save it as an AppleScript application, select its icon in the Finder, choose the Finder’s File → Show Info command, and select the Open in the Classic environment checkbox. Although I haven’t tried this, you can then presumably use the Using Terms From block techniques described above without having to enclose the block in a Tell block addressed to a Classic application.

NEW APPLESCRIPT FEATURES IN MAC OS 9.2.2 1 12/28/01
A standalone installer for an upgrade to Mac OS 9.2.2, which included AppleScript 1.7 for use in the classic Mac OS and the Classic environment of Mac OS X 10.1, was released on December 5, 2001. The upgrade included the following new AppleScript components: the AppleScript 1.7 system extension, Script Editor 1.7, the Standard Additions 1.7 scripting addition, a new version of the mount/unmount server aliases folder action script, and an About document.

For reasons described at the end of this section, users who rely on older scripts should not upgrade to Mac OS 9.2.2 until they have carefully evaluated whether certain bugs will require rewriting their scripts.

As noted elsewhere in this report, AppleScript applets and droplets now once again are compiled and saved in a single universal format, as they were before AppleScript 1.4.3. A single applet or droplet is now able to run on older 68K machines, on newer PPC machines under Mac OS 9, and under Mac OS X. Older applets and droplets compiled and saved for a specific environment, such as Mac OS X, will continue to run in that environment. Script Editor 1.7 does not require (nor permit) saving an applet or droplet for a specific environment.

Scripting additions configured as bundles or packages will load and run under AppleScript 1.7 on Mac OS 9.1 or later if the bundle has a root-level alias pointing to an included Mac OS 9 (non-Carbon) scripting addition file.

The following bug fix descriptions are based on information provided by Apple. In many cases, these fixes also apply to the Mac OS X-native edition of AppleScript 1.7, as described elsewhere in this report.

Coercing a file path in string form to a file specification (‘: as file specification’), and providing a file reference in object reference form (‘file specification :’) now return the generic file reference form (‘file :’). These statements failed in AppleScript 1.5.5 and 1.6.

Sending Unicode text to an application that expects plain text now works correctly. It did not in AppleScript 1.6 (although the coercion did work correctly in AppleScript itself).

Unicode values stored in persistent script properties now reload reliably. They did not in AppleScript 1.6.

Unicode text with byte-order marks received from some applications now work correctly, no longer beginning with the Euro symbol or causing other problems.

AppleScript can now get information about the Finder’s Process class when running in Mac OS 9 and the Classic environment, as it could not in AppleScript 1.6.

Comparison of two references to a single file for equality now correctly returns True in all cases, as it did not in AppleScript 1.0 through 1.6.

Scripts compiled under Mac OS X and targeting a remote application can now be run successfully on Mac OS 9 or in the Classic environment, using the classic edition of AppleScript 1.7, as they could not using the classic edition of AppleScript 1.6 because it used a different way of storing the eppc:// address of the remote application. (Scripts targeting remote applications and compiled with classic AppleScript 1.1 through 1.7 cannnot be read by AppleScript 1.7 on Mac OS X; they must be saved as text then reopened and recompiled under Mac OS X.)

Some operations in third-party script editors are more stable under the classic edition of AppleScript 1.7 than they are with the native Mac OS X edition of AppleScript 1.7 or with earlier versions of both the classic and Mac OS X-native editions of AppleScript.

Script Editor 1.7 displays a more descriptive error message when you try to print a script with no printer selected in the Chooser.

A running applet no longer becomes non-responsive to incoming events after the first event is handled.

AppleScript’s relatively new Missing Value data value is now returned by the Info For command in Standard Additions 1.7 when information is requested about a volume that doesn’t provide such information (such as the file creation date on Mac OS X disks configured as UFS volumes), and magnitude comparisons always return false in such cases. Formerly, Info For failed in these circumstances.

The Info For command in Standard Additions 1.7 now correctly returns error number -35 for a nonexistent file or a file in a nonexistent directory or inaccessible disk. It incorrectly returned -1401 in Standard Additions 1.6 both in the classic edition and the Mac OS X-native edition.

The Info For command in Standard Additions 1.7 now treats packages as files and can return a packaged file’s owning application type and creator.

Standard Additions 1.7 reverts to something similar, but not identical, to an older method of providing a seed value for the Random Number command. The seed value is now taken from the ticks counter, since that is more likely to yield a different value on each call than would the system clock used previously. In addition, whereas Standard Additions 1.5 and 1.6 used a seed value of 0 if none was supplied, Standard Additions 1.7 uses the ticks value in that case.

The big story about AppleScript 1.7 in Mac OS 9.2.2 is not bug fixes, however, but new bugs. Many, many users have reported major breakages in existing scripts. These problems do not affect AppleScript 1.7 in Mac OS X; instead they have something to do with applying the Mac OS X AppleScript improvements in the classic Mac OS. The problems mostly have to do with references to files, a technology which has undergone a sea change as Carbon has matured. Users of the classic Mac OS who depend heavily on older scripts that make use of references to files are cautioned to investigate carefully whether their scripts will require revision for AppleScript 1.7 in order to work as expected, and to avoid upgrading to Mac OS 9.2.2 until these questions are resolved.

Some of the reports are summarized here:

Scripts running from applications’ Scripts menus run very slowly or time out.
Scripts running in the Finder are slow.
‘Open for access with write permission’ doesn’t automatically create the file if it did not exist, as it should, but instead returns a file not found error. Relative file paths don’t work correctly. There are problems with using some scripting additions, presumably when referring to files. Using constant references to special folders with the Info For command in Standard additions (e.g., ‘tell application Finder to get (info for extensions folder)’) don’t work. According to Apple’s Chris Nebel, the workaround is to ‘tell application Finder to get info for (extensions folder as alias)’ or ‘get info for (path to extensions folder)’.

Finally, on January 15, 2002, Chris Espinosa, Apple’s Manager of Components & Scripting, publicly acknowledged that last-minute changes to AppleScript 1.7 had led to problems in the Mac OS 9 version and thanked users for their patience. He announced that shipping hardware with Mac OS 9.2.2 installed would include AppleScript 1.6 going forward. While the Mac OS 9.2.2 Software Update would continue to include AppleScript 1.7, he said that instructions would shortly be published for reinstalling AppleScript 1.6. While all of this was difficult at the time, more recent versions of AppleScript have resolved these problems, as discussed in our report on AppleScript 1.8.3. 10/8/02

Other changes in behavior that have been reported as bugs are not. For example, for a while many scripters relied on the statement ‘: as alias’ to get a reference to the folder containing the script; this doesn’t work in Mac OS 9.2.2, but it was never a supported feature, in any event, but only a side effect. Similarly, the List Folder command in Standard Additions no longer returns a list of lists but a list of Unicode text, which is mentioned in the release notes as an intentional design change.

DOCUMENTATION FOR NEW APPLESCRIPT FEATURES
The first and most readily accessible source of documentation for AppleScript 1.7 is the AppleScript Help book in the Apple Help Center, available from the Finder’s Help menu on your computer. For the most part, you must have an active Internet connection to read AppleScript Help because Apple Help Viewer downloads up-to-date content from Apple’s servers.

Apple originally published the AppleScript 1.7 for Mac OS X 10.1 - Release Notes around October 15, 2001. This document is unusually long and detailed, as AppleScript release notes go, and very informative about new features, bug fixes and remaining and new bugs. At this writing, they are available from the AppleScript Release Notes page and as AppleCare KnowledgeBase Document 75205 (1/22/02). 10/8/02

The AppleScript 1.7 for Mac OS 9 and Classic: Release Notes became available later. 10/8/02

It was anticipated that some of the AppleScript Guide Modules would become available for installation on Mac OS X from Apple’s AppleScript site by mid-October, but a new module did not in fact appear until late December. 12/28/01

A number of documents have been published for developers documenting some important changes in AppleScript 1.7, and scripters can find valuable information in them. The most important of these is Mac OS X v10.1 (Technical Note TN2029 10/15/01). Although it contains a wealth of developer-oriented information about Mac OS X 10.1 in general, its primary interest for AppleScripters is its very extensive section detailing new features and bug fixes. Much of the content of the AppleScript section of the TechNote is identical to what is in the AppleScript 1.7 release notes, but they are not identical. It pays to read both; for example, the TechNote contains a page of information about scripting improvements to the Finder which is absent from the Release Notes, and the Release Notes contain a long list of known problems relating to AppleScript 1.7 in Mac OS X 10.1 that is not to be found in the TechNote. In addition, there are scattered references to AppleScript throughout the TechNote. For example, it reveals that bugs in the Build web page script for Image Capture have been fixed.

The fairly short Mac OS X Developer Release Notes: AppleScript 1.7 may hold some interest for general users, as well. In addition, Making XML-RPC and SOAP Requests With AppleScript, a new developer document explaining how to make calls from within an application using Apple events, includes some sample scripts showing how to make XML-RPC and SOAP requests from AppleScript scripts. Basically, a script can specify Internet applications as targets of Tell statements or within Using Terms From blocks. When you specify an XML-RPC server or a SOAP server in one of these statements, the Apple Event Manager generates a dictionary that makes the terminology for remote procedure calls available to your script. That terminology includes the following terms that specify XML-RPC and SOAP requests: call xmlrpc, call soap. See the Information for Developers section, below, for details about these and other developer documents.

TESTING WHETHER APPLESCRIPT 1.7 IS INSTALLED
We have said in every one of our reports on successive AppleScript versions in the Mac OS that, before using new features of AppleScript, careful writers of scripts intended for public distribution will want to determine which version of AppleScript is present on the user’s machine.

A good, universal way to determine whether AppleScript 1.7 is available is to use a much simplified version of the script that was developed for AppleScript 1.6:


on AppleScript17orNewer()
	tell application "Finder"
			to get system attribute "ascv"
			return (result is greater than or equal to 17826160)
end AppleScript17orNewer

See our report on AppleScript 1.6 for a detailed explanation of the complexities that were required for the equivalent script to test whether AppleScript 1.6 or newer is running. The test for AppleScript 1.7 or newer is simpler because AppleScript 1.7 returns the correct value as its version, 17826160, which is the integer equivalent of the binary-coded decimal version number. This script also runs correctly under AppleScript 1.7 for the classic Mac OS. 12/28/01

A simple trick for determing whether a script is running in the classic Mac OS or the Classic environment of Mac OS X, not in the native environment of Mac OS X, is found in some of Apple’s scripts, for example, the Import Entourage script in the Mail Import Scripts 1.1 package. The idea is to get the path to a special folder that exists only in the classic Mac OS, such as Extensions, and trap the error that occurs if the script is running in the native environment of Mac OS X.

WHERE APPLESCRIPT ITEMS ARE LOCATED
AppleScript items in Mac OS X 10.1 are located where they were in Mac OS X 10.0, with some exceptions; see our report on AppleScript 1.6 for details. One item no longer exists, the OSAApplet.component. The Example Scripts for use with Script Runner (and ScriptMenu) are now preinstalled in /Library/Scripts/, so that Script Runner can be used out of the box, instead of being placed in the AppleScript folder in the main Applications folder as they were in Mac OS X 10.0. Speakable Items, which contains one traditional AppleScript out of the box, is created in a new Speech folder in ~/Library the first time you turn on speech recognition in System Preferences.

APPLESCRIPT TOOLS, SCRIPTING ADDITIONS, AND SCRIPTABLE APPLICATIONS

I count more than 25 items in Mac OS X 10.1 that are scriptable, if you install the Developer Tools as well as the basic system. But a small number of these items are apparently only accidentally scriptable, and some are merely delegates or helpers for other items, so the overall picture of AppleScript support in Mac OS X 10.1 is still not fully developed. We are grateful for the progress and look forward to more.

Installed Software and Dictionary Changes
Apple Help Indexing Tool 1.3.1 This is the first Mac OS X native version of Apple’s utility for creating the index used by an Apple Help module. It is installed from the Developer Tools CD and is of interest only to authors of Apple Help modules. It is installed in the /Developer/Documentation/Apple Help/ folder, and an alias to it also appears in /Developer/Applications/. You will also find documentation, templates and a tutorial about writing Apple Help modules. An Apple Help Reference document is offered both in PDF and HTML form; the latter can be dragged to /Developer/Documentation/Help/ to make it appear in Apple Help Viewer’s Developer Help Center, if you installed Developer Tools. There is a little information in this reference about using AppleScripts in Apple Help modules.
It is encouraging to see AppleScript support in this utility, because some aspects of creating Apple Help modules are tedious, and bringing AppleScript into the picture bodes well for automating some of the process.

The dictionary includes several generic AppleScript commands that are provided automatically by a well-known third-party development system if you don’t remember to turn off the feature, but in this case (unlike some others) the AppleScript support apparently is not accidental. It includes a Help Indexing Tool Suite with a few commands that are unique to this application. The syntax does not conform to AppleScript standards, however. For example, there are Turn Remote Root and Turn Anchor Indexing commands, which are incomplete grammatical constructs that you complete by supplying the string on or off as the direct parameter. Among other problems, this violates the rule that an AppleScript command should be a verb that is complete in itself. More to the point, AppleScript standards would lead one to expect these to appear instead either as Boolean properties of, say, the Application or Document class, or Boolean parameters of a command. With a properly designed deictionary, you might write a statement like this: ‘tell application Apple Help Indexing Tool to set anchor indexing of front document to true’, or ‘tell application Apple Help Indexing Tool to index document 1 with anchor indexing’. Instead, this dictionary requires you to write ‘tell application Apple Help Indexing Tool to turn anchor indexing on’. Inconsistently, the Application class in the Help Indexing Tool Suite does include one Boolean property, idleStatus, which is read-only and unexplained.

Apple System Profiler 2.7f1
The guts of the scripting dictionary of Apple System Profiler remains the very extensive lists of properties that are available as part of the Application and Report classes. Using these, you can find out just about anything you want to know about your computer using AppleScript.

There are no changes to the dictionary from version 2.6b21 in Mac OS X 10.0.

Classic Support 2.0
I only recently noticed that the Classic Support application, installed in the classic Mac OS System Folder to support the Classic environment of Mac OS X, purports to be scriptable. Although it doesn’t appear in the list of classic and Mac OS X scriptable items in Mac OS X’s Script Editor when you use the Open Dictionary command, it does have a dictionary. You can open its dictionary by dragging its icon onto the Script Editor icon. The dictionary suggests that it is actually the dictionary of the classic Application Switcher application, and I can’t get it to work. Perhaps this has to do with enabling Mac OS X scripts to control the Classic environment.

ColorSyncScripting 4.0
The ColorSyncScripting application is, loosely speaking, a scripting addition in the /System/Library/ScriptingAdditions/ folder. There are no changes to its dictionary compared to verson 3.1 in Mac OS 10.0.

FontSyncScripting 2.0
The FontSyncScripting application is a scripting addition in the /System/Library/ScriptingAdditions/ folder. It is new in Mac OS X 10.1. It is distinguished from the other scripting additions installed with Mac OS X 10.1 by a different icon consisting of a document with a script or scroll superimposed, rather than the new cube icon style. The significance of this eludes me.

Help Viewer 1.7.2
Help Viewer is found in /System/Library/CoreServices/. It continues to have a small dictionary designed to be of use to authors of Apple Help modules. There are no terminology changes from Help Viewer 1.7 in Mac OS X 10.0.

Image Capture Scripting 1.5
The Image Capture Scripting application is a new scripting addition in Mac OS X 10.1. It is designed to assist with automation of the Mac OS X feature that lets you download digital images from many digital cameras directly into your computer. With Image Capture Scripting you can automate scaling and rotating of images and determine the height and width of an image.

iMovie 2.1.1
iMovie has but a single command in its dictionary, DoCommand, and the dictionary explains nothing about it. I therefore hesitate to call it scriptable.

Interface Builder 2.1
Interface Builder is installed in /Developer/Applications/ when you install the Developer Tools CD. It is the graphical user interface builder portion of Apple’s Mac OS X Integrated Development System (IDE) inherited from Next. (Developers know that it is in fact much more than a visual interface design tool, in that the so-called nib files that it produces contain, at least in the Cocoa environment, a serialised archive of objects that are unarchived and restored to their original states when an application is launched. Unlike many other GUI design tools, Interface Builder is not a code generator, and it provides much more flexibility in controlling the appearance of an application. (You may think you didn’t need to know that, but once AppleScript Studio is released you will begin to understand the implications.)

The dictionary has changed somewhat since Interface Builder 2.0 in Mac OS X 10.0, but for the most part only because of the changes made in the Cocoa frameworks on which InterfaceBuilder is based. See the discussion of Mail, below, for details. Also, the Cell and Control classes have lost their Supertype and Type properties, but they remain available through the Object superclass from which they inherit. The application class has lost its Frontmost, Name and Version properties.

The fact that Interface Builder is scriptable has generated some excitement among Mac OS X developers. However, Apple engineers have mentioned on the developer mailing lists that it is not yet the complete scripting implementation that is expected.

Interface Builder has been at the heart of even more excitement among AppleScript developers since Apple announced that AppleScript Studio will become available later this year. The screenshots on Apple’s teaser web site for AppleScript Studio bear a striking resemblance to Interface Builder user interface widget palettes, and reports of Sal Soghoian’s demonstration at Seybold in September 2001 indicate that AppleScript Studio makes use of Project Builder technology, as well. The prevailing expectation among observers is that AppleScript Studio will enable scripters to develop complex, sophisticated AppleScript-based applications with all manner of standard Macintosh user controls such as buttons, sliders, pop-up menus and the like. Advanced Project Builder-style debugging capability is also expected.

Internet Connect 1.1
The Internet Connect application is newly scriptable in Mac OS X 10.1. Using AppleScript, you can connect to the Internet using a specified configuration (AirPort, PPP or PPPoE), optionally supplying a telephone number for a modem. The AirPort configuration class allows you to determine whether the AirPort card is powered on, the base station’s ID, and the signal strength, for example. The PPP configuration class includes the telephone number. A Status Record class exists for every configuration, from which you can obtain the connection’s speed, the number of seconds connected and remaining, the number of bytes sent and received, the protocol, and other items of information. (Note that you cannot obtain the Status object itself using AppleScript, but only its individual properties.)

Internet Connect’s dictionary bears some similarities to the classic Mac OS AirPort Scripting scripting addition that was released only recently with the AirPort 1.3.1 package, but which is not available in Mac OS X. For example, you can use the new Connect command to connect to the Internet using AppleScript with a telephone number, user name, and password, just as you can in the classic Mac OS using Airport Scripting’s Dial command. However, in Mac OS X you can also use the Disconnect command to hang up the base station modem, but there was no way to hang up in the classic Mac OS using Airport Scripting. (Note that you cannot tell an AirPort base station’s modem to disconnect if you are wired to the base station using Internet instead of AirPort’s wireless network.) In Internet Connect you can turn your computer’s AirPort card on and off using the AirPort Power property of the AirPort Configuration class, just as you could using the Power property of the Card class in AirPort Scripting. You can also monitor many aspects of a PPP or PPPoE connection, such as protocol, speed, bytes sent and the like. AirPort Scripting did some of these things in a more useful manner (it defined many protocol types as enumeration constants, for example, whereas Internet Connect uses integers). Internet Connect is mostly an Internet utility, so it lacks AirPort Scripting’s Join and Scan commands, with which you could obtain a list of available AirPort networks and sign on to one of them, and its Create command with which you could create a new network; but you can obtain an AirPort network’s name, type and signal level as properties of its AirPort Configuration class.

I find that scripting Internet Connect is difficult. In particular, the properties of a status record seem to be inaccessible. One user has reported that the Apple event code for a status record is misspelled.

Apple’s Chris Nebel has reported that the Connect command returns immediately, so you have to use an Idle handler or a repeat loop to detect whether the connection has been made. A better implementation is promised for the future. 12/28/01

Internet Explorer 5.1.2 (3707)
The Microsoft Internet Explorer application comes with Mac OS X 10.1, and it remains scriptable. There are no terminology changes from Internet Explorer 5.1b1 (5502) installed by Mac OS X 10.0.

Mail 1.1
Mail, a Cocoa application, is scriptable with a fairly extensive terminology dictionary.

There are a number of changes to the dictionary since Mail 1.0 in Mac OS X 10.0. Most of these reflect changes made to the Cocoa frameworks, on which Mail is based, so these changes also appear in other Cocoa-based applications, such as TextEdit. Most of them correct the very awkward terminology for the Window class implemented in earlier versions of the Cocoa frameworks; the Window class terminology has since been changed to conform to longstanding AppleScript standards.
The Count command now takes an optional Each parameter, as specified by the Standard Suite.
In the Window class, several properties have been changed to use correct AppleScript terminology: Is Running Modal is now Modal, Has Close Box is now Closeable, Is Resizable is now Resizable, Is Miniaturizable, is now Miniaturizable, Is Miniaturized is now Miniaturized, Is Floating is now Floating, Is Zoomed is now Zoomed, Is Visible is now Visible, Has Title Bar is now Titled, and Is Zoomable is now Zoomable.
The Class property, returning an integer, has been removed from the Window, Application, Color and Document classes. However, it is still accessible through the Abstract Object super class from which they inherit and which is still present in the dictionary. A similar change appears in the other Cocoa applications, and this point will not be repeated in the discussion of them in this report.

PEFViewer 1.0
PEFViewer is installed in /Developer/Applications/ when you install the Developer Tools. It is a technical developer utility which happens to contain the standard dictionary that is automatically implemented in applications built using a certain standard third-party development system. It is unchanged from PEFViewer 1.0 in Mac OS X 10.0.

Print Center 1.0
The Print Center application is still at version 1.0, as it was in Mac OS X 10.0, yet its dictionary has changed. It now includes a new Print Center (notice the space) Suite, in addition to the somewhat mysterious PrintCenter Suite (no space) that was there in Mac OS X 10.0. The new Print Center Suite includes the Run, Quit and Count commands, and Application, Printer and Job classes. With the Current Printer property of the Application class, you can get and set the current printer, and with the Printer class, you can get the Name of the current printer, its Status (Printing, Idle, Stopped or Error), and its Kind (the manufacturer’s description). With the Job class, you can get the Name of a print job, its Status (Printing, Waiting, Hold Until, Hold and Error), as well as its Priority (Low, Normal or Urgent).

Print Center, with its new dictionary, gives Mac users a wide-ranging ability to monitor and control the printing process through AppleScript. Print Center lets you identify all printers known to Print Center, to determine the current status of each printer and each print job.

Note that the various properties of the current printer must be accessed by first getting the Current Printer, then getting, for example, the Name or Status of the result.

The use and purpose of the PrintCenter Suite are not clear. If, as appears to be the case, they cannot be used in AppleScript scripts, they should not be disclosed in the dictionary.

Project Builder 1.1
The Project Builder application is installed in /Developer/Applications/ when you install the Developer Tools. It is the other half of Apple’s Integrated Development Environment (IDE). It is newly scriptable in Mac OS X 10.1, although there is nothing in its scriptability that relates directly to Project Builder’s mission; its dictionary consists only of the Standard Suite and the Text Suite as implemented in the Cocoa frameworks. See the discussion of Interface Builder for details.

QuickTime Player 5.0.2
Apple has been very aggressively touting the scriptability of QuickTime Player. A major update to the bevy of QuickTime scripts was available on Apple’s web site the day Mac OS X 10.1 was announced.

Changes to the terminology of QuickTime Player since QuickTime Player 5.0, which shipped with Mac OS X 10.0, are nevertheless minor. The Display class has lost its Name property. The Movie class has gained Current Chapter Track, Current Chapter, Streaming Status Code and Streaming Status Message properties.

Days before the release of Mac OS X 10.1, Apple published a What’s New in QuickTime 5 PDF document detailing the features of QuickTime 5.0.2. Included is a nine-page chapter on AppleScript Changes and Additions in QuickTime 5 and a detailed discussion and explanation of an example script for adding custom skins to the QuickTime Player.

Script Runner 1.0
Script Runner, the floating button implementing a customizable menu of scripts, is not scriptable in the traditional sense, but it runs scripts. It still sports the same 1.0 version number that it did in Mac OS X 10.0. One very important change has occurred, however: it now remembers where you left it when you reboot your computer. Gone is the annoying problem which, in Mac OS X 10.0, required you to move it away from the upper left corner of your screen, where it always blocked your view of any application’s frontmost window. I have Script Runner set as an automatic startup or login item in the Login panel of System Preferences, and I keep the button in the lower right corner of the screen where I can pop the menu up instead of down. Script Runner is located in the AppleScript subfolder in the Applications folder.
Script runner is unusual in several respects, one being that, although it has a visible user interface, it does not appear in the Dock and it does not have any accessible commands in the menu bar. As a result, you can’t easily make it quit once you launch it. Or can you? If you use Script Runner, save this script as a compiled script and place it at the root level of /Library/Scripts/; it will add a Quit Script Runner command to your Script Runner button’s pop-up menu: ‘tell application Script Runner to quit’.

Sherlock 3.2
Sherlock has been scriptable for a long time, allowing you to search your computer or the Internet under AppleScript control. There are no changes in its terminology since Sherlock 3.1 in Mac OS X 10.0.

Sketch 1.2.0
Sketch is a scriptable drawing application used as an example for developers of how to write Cocoa applications. It is installed in /Developer/Applications/Extras/ when you install the Developer Tools CD. Its dictionary remains unchanged from the same Sketch 1.2.0 that was installed from the Developer Tools CD with Mac OS X 10.0, except that it was recompiled with the newest version of the Cocoa frameworks and therefore gains the terminology improvements in the Window class that are part of Cocoa’s improvements; see the discussion of Mail for details.

SpeakableItems 3.0.1
The SpeakableItems application is found in:
/System/Library/Speech/Recognizers/AppleSpeakableItems.SpeechRecognizer/Contents/Resources/
To write scripts using its supplied commands, use the form ‘tell application SpeakableItems to’. The SpeakableItems dictionary is actually entitled the Speakable Items Server Dictionary. In a bit of Mac OS X magic, once you turn on speakable items in System Preferences, a new Speech folder will be created automatically in your ~/Library/ folder. In it, you will find a Speakable Items folder containing all of the familiar speakable items, such as Tell me a joke, and an Application Speakable Items folder containing speakable items for three applications. Only one of the speakable items, Open Sherlock, is configured as a traditional AppleScript, but you can write more of your own.

SpeechRecognitionServer 3.0.1
The Mac OS X v10.1 Technical Note refers to improvements in Speech Listener. The classic Mac OS has a scripting addition with the name Speech Listener, a relatively recent addition to Apple’s standard set of scripting additions, which allows you to write custom interactive speech-based scripts. Speech Listener appeared at first glance to be missing in action in Mac OS X 10.1. Thanks to Kim Silverman, Apple’s Principal Research Scientist and Manager, Spoken Language Technologies, I have learned that it has simply been incorporated into the speech recognition engine in Carbon frameworks, where it uses less memory and is much more robust, accurate and responsive. To open its dictionary, navigate to this rather daunting address:
/System/Library/Frameworks/Carbon.framework/Versions/
A/Frameworks/SpeechRecognition.framework/Versions/A/Resources/SpeechRecognitionServer

If you plan to do any speech recognition scripting, I recommend that you save an alias to it in a more convenient location. Scripting it is easy; just ‘tell application SpeechRecognitionServer to’, although its dictionary is entitled Speech Recognition Server Dictionary (with spaces).

Standard Additions 1.7 (Mac OS X)
Standard Additions for Mac OS X has undergone only minor amendment since Mac OS X 10.0. It continues to provide an essential set of terminology add-ons to the core AppleScript language. It is located in /System/Library/ScriptingAdditions/.

Terminology changes since Standard Additions 1.6 in Mac OS X 10.0 are confined to the addition of these properties to the File Information class returned by the Info For command: Displayed Name, Name Extension, Extension Hidden, and Package Folder. The first three of these correspond to the same new properties implemented in the Finder 10.1 Item class and are intended to assist scripters in dealing with the new Mac OS X 10.1 file name extension regime.

In addition, a number of existing commands are now fully implemented or enhanced, as described in the New Features and Changes sections, above.

Standard Additions continues to offer the Folder Actions commands, but Folder Actions capability is still missing from Finder 10.1.

Standard Additions 1.7 (Mac OS 9.2.2)
The Standard Additions scripting addition for the classic Mac OS and the Classic environment of Mac OS X contains several terminology changes from version 1.6, one of which is important for scripts that attempt to ensure backwards compatibility by detecting the version of system software that is currently running. 12/28/01

The important fix in the classic edition of Standard Additions 1.7 is that it now includes, in the Miscellaneous Commands suite, the same new System Attribute command that first appeared in the Mac OS X-native edition of Standard Additions 1.6. We described at length in The AppleScript Sourcebook’s Report on AppleScript 1.6 how the absence of the System Attribute command in the classic edition of Standard Additions 1.6, coupled with the fact that the classic Finder’s old Computer command was not accessible when running a script in the Classic environment of Mac OS X, caused old scripts that rely on the Computer command to fail. Now, with AppleScript 1.7 installed in the Classic environment, those old scripts will run correctly.

The following additional terminology changes appear in the classic edition of Standard Additions 1.7 (Standard Additions bug fixes are described under Bug Fixes, below):

The Choose Application command no longer contains an optional As parameter. It isn’t needed, anyway, since normal coercions can be applied to the returned result. Note, however, that the optional As parameter remains in several other commands, such as the Path To command and the File Read/Write commands.

The result of the Choose File Name command is now File, not File Specification.

A number of parameters to various commands take Plain Text, not String, data.

Other parameters to other commands, and values returned by some commands, such as the Name property of class File Information returned by the Info For command, take Unicode text, not international text, data. This is important for obtaining the full file name of file names that are longer than 32 characters. These commands and values no longer support the encoded file names generated by older software when encountering file names longer than 32 characters.

Descriptions of some command results have changed. For example, the Choose From List command is said to return a list of plain text, not just a list; the List Disks command returns a list of alias instead of a list of list; and the List Folder command returns a list of Unicode text rather than a list of list.

In class File Information, returned by the Info For command, the same new Package Folder Boolean property is added as appears in the Mac OS X-native edition of Standard Additions 1.7.

The Store Script command’s dictionary entry now correctly lists the In parameter as optional, where formerly it was incorrectly listed as a required parameter. Omitting the In parameter causes the user to be prompted for a file name.

Users have reported a variety of major bugs in some of the Standard Additions 1.7 commands in Mac OS 9.2.2, as in the Finder. These problems are detailed under New Bugs, below.

StuffIt Expander 6.0.1
Aladdin Systems’ StuffIt Expander application, unchanged since Mac OS X 10.0, has the single AppleScript command that it needs, Expand. StuffIt Expander 6.5 is now available for free from Aladdin.

System Events
System Events is a new application to service certain AppleScript commands formerly handled by the Finder relating to processes. It is located in /System/Library/CoreServices/. This is the mysterious application to which the Finder delegates the handling of certain AppleScript commands formerly handled by the Finder. Although it has a dictionary and can be told to execute commands, you can do the same thing by using the traditional Finder commands; System Events will be invoked behind the scenes to carry them out. See the discussion of Finder 10.1 for details.

This statement, ‘tell application System Events to get name of front process’, returns loginwindow. But a script will be more compatible with the classic Mac OS if it gets the same result with this statement: ‘tell application Finder to get name of front process’.

Terminal 1.1
Terminal, providing the UNIX command line interface (CLI) for Mac OS X, is newly scriptable in Mac OS X 10.1, finally fulfilling the longstanding promise to make AppleScript a two-way street in Terminal. You have been able to execute AppleScript scripts from within Terminal, and now you can use AppleScript to tell Terminal to execute shell scripts by using the new Do Script command. The power this potentially makes available to AppleScripters to control the innards of Mac OS X is amazing, and more than a little scary but you have to learn UNIX shell commands, first. (Hmm. Can we write an AppleScript to tell Terminal to execute an AppleScript to tell Terminal to execute an AppleScript to…)

TextEdit 1.1
TextEdit is a Cocoa application that serves as the SimpleText of Mac OS X. Unlike SimpleText, it can handle text exceeding 32K in length, and it is scriptable.

It contains the same Window class property name changes from TextEdit 1.0 in Mac OS X 10.0 as does Mail, as well as the same addition of the optional Each parameter to the Count command and the same omission of the Class property from several classes, because both are based on the Cocoa frameworks and inherited changes in those frameworks.

In addition, the Text Suite has seen some change. The Font, Color, and Size properties of the Text Attachment class have been removed, presumably because unnecessary; they remain available as properties of several other classes, such as the Character class.

URL Access Scripting 1.0.1 (v7)
The URL Access Scripting application, in /System/Library/ScriptingAdditions/, is a scripting addition with two commands allowing you to Download and Upload items from the Internet. Each command has a number of optional parameters to control the specifics of how this is done. Its dictionary remains unchanged since version 1.0 (v3) in Mac OS X 10.0.

WorldText 1.2
WorldText is Apple’s demonstration of MLTE, the Multi-Lingual Text Editor, a set of system facilities that makes it easier to write text applications for the modern world. It is installed in /Developer/Applications/Extras/ when you intall the Developer Tools CD. It is scriptable by dint of that certain third-party development environment that puts a scripting dictionary in your application if you forget to tell it not to. Its dictionary is unchanged from WorldText 1.1 in Mac OS X 10.0.

The Scriptable Finder
Finder 10.1 is found in /System/Library/CoreServices/. Its dictionary contains many changes from that of Finder 10.0. The many explicit warnings in the Finder 10.0 dictionary to the effect that terminology was preliminary and intended only for debugging are gone. The dictionary now seems largely complete in terms of terminology (save for two exceptions mentioned below), and only a few commands and other items are not yet functional. Finder scripting has come a long way since Mac OS X 10.0, but it still has a little way to go.

As in Mac OS X 10.0, there is a fake Finder application in the same location, whose version is given as Mac OS X Fake Finder 10.0. It is very small (4K on my hard drive) and is said by the Get Info panel to be a Classic application.

In Finder 10.1, you will find that only a few commands and other items are marked (NOT AVAILABLE YET) or, in one case, (NOT AVAILABLE, SUBJECT TO CHANGE) These are Copy (to the clipboard), Sort, the Clipboard and Finder Preferences properties of the Application class, Add To Favorites, Clean Up, Erase, the Expandable, Expanded and Completely Expanded properties of the Container class; the Clipping Window property of the Clipping class; the Preferences Window class; the Preferences class (this is the one that is marked SUBJECT TO CHANGE); the Label class; and the Icon Family class.

In addition, the Accepts High Level Events property of the Application File class is marked OBSOLETE, and it always returns true. This has to do with the nature of Mac OS X.

A new Legacy suite identifies [o]perations formerly handled by the Finder, but now automatically delegated to other applications. These are the Restart, Shut Down, and Sleep commands, and the Process, Application Process, and Desk Accessory Process classes. What is meant by automatically delegated to other applications isn’t altogether clear, but one point to note is that you can still issue these commands to the Finder in a ‘tell application Finder’ block. For example, I just ran ‘tell application Finder to get name of front process,’ and it returned loginwindow. (This demonstrates not only that it works, but also that we have a lot to learn about how Mac OS X works under the hood.) The application to which commands relating to processes are delegated is System Events, described below.

At least some of these legacy Finder commands are now handled by the System Events application, described elsewhere in this report. Apple’s official position is that these commands should still continue to be issued in ‘tell application Finder’ commands, not ‘tell application System Events’ commands, to avoid potential future problems in the event the System Events architecture is changed. (Apple reversed this position beginning with Mac OS X 10.2 (Jaguar), when System Events acquired much greater importance as the home of Folder Action commands and others.) The Finder redirects these events if you send them as named events. However, if you send them to the Finder as raw Apple events, AppleScript will generate undocumented error number -1799. 10/8/02

There are a number of other interesting and useful changes to the dictionary in Finder 10.1. By and large, scripting the Finder is rapidly becoming the pleasure we had grown used to in the classic Mac OS.

Desktop Picture is a new property in the Application class, providing a Finder reference to the file containing the desktop picture of the main monitor. It can be used to set the desktop picture, as well.
Displayed Name, Name Extension, and Extension Hidden are new properties of the Item class, allowing users to set and view the new options that are available in Mac OS X 10.1 for handling file name extensions.
Both versions of the Icon Size property (one returning an integer and the other returning the enumeration constants Mini, Small and Large) have been removed from the Container class, as has the Selection property. I am puzzled by the omission of the Selection property. It is still possible to get the selection of the Finder, but I am unable to set the selection.
Several new enumeration constants are available with the format property of the Disk class, namely, UFS Format, NFS Format, Audio Format, and WebDAV format.
A new read-only property, Ignore Privileges, has been added to the Disk class, allowing you to determine whether the user has selected the option to ignore permissions on the disk.
The Application File class has a new Opens In Classic property, indicating whether this application has been marked to open in the Classic environment when double clicked.
The Finder Window class has acquired three new properties, Current View, Icon View Options and List View Options. The latter two are read-only. Icon View returns one of three enumeration constants, Icon View, List View or Column View.
The Inspector Window class has been renamed the Information Window class, complying with a system-wide elimination of the old Next term, inspector, in favor of the more familiar Mac OS term, information. It retains only two of it old properties, Item and Current Panel, losing a bunch of properties that apparently appeared in error in the Finder 10.0 dictionary.
The Preferences Window class’s Current Panel property no longer lists a number of enumeration constants as return values, but instead the OS type ‘pple’. This is presumably an artifact of the fact that the class has not yet been implemented. A new Legacy Suite contains a number of commands that were handled by the Finder in previous versions of the Mac OS but that are now automatically delegated to other applications. You still use them in a Finder Tell block, but they will be executed by other applications. The commands in this suite are Restart, Shut Down and Sleep. The classes are Process, Application Process and Desk Accessory Process. None of these appeared in the Finder 10.0 dictionary.

Mac OS X v10.1 (Technical Note TN2029 10/15/01) has a page-long section devoted to additional AppleScript changes affecting the Finder.