AppleScript 1.9.2 (Panther)

AppleScript 1.9.2 first appeared with Mac OS X version 10.3 (Panther). It requires Mac OS X 10.3 or later and is included in the Panther installer. This release had a lot of new features and enhancements as well as bug fixes for items for AppleScript 1.9.1.

A script written using AppleScript 1.9.2 will run fine on older versions of AppleScript back to version 1.1, assuming that the script does not use any added features that are specific to the 1.9.1 release. AppleScript 1.9.2 is backward compatible with scripting additions created for AppleScript 1.5 onward and applications that are scriptable from Mac OS 7.1 onward.

As with any piece of software, if you need to run your script or AppleScript Studio application on an older version of AppleScript or Mac OS, testing is the only way to assure yourself of compatibility.


Unicode text is strongly emphasized in this release, while the types Text, CString, PString are deprecated and the types Styled Text and International Text will be removed completely in future releases. There are technical reasons for this pertaining to the representation of certain unicode-only characters in some languages like Hungarian, Arabic, and Thai and the fact that the CString and PString types don’t support the full range of coercions and the others sometimes yield unpredictable results from coercion. Apple is now recommending that the unicode text type be used for text strings.

The offset command (from Standard Additions) no longer considers case when searching for substrings. This has been changed so that it is in line with the other AppleScript string handling functions which also ignore case. Scripts that rely on offset to be case-sensitve need to have a considering case block added to function the same way they did before AppleScript 1.9.2.

The store script command (from Standard Additions) can no longer create resource-fork scripts. However, scripts can be updated to the data-fork, but the script must be a script file. Previously the file could be anything and the script was stored as a script resource (scpt). Store script can now store scripts into script bundles (compiled script or applet). The type of script file created is dependent on the script’s file extension.

Scripts saved in the new bundled format (see below) will return a path that ends with a colon when using the path to me command.


AppleScript Changes

A new bundled format for compiled scripts and applets has been added for store script. It uses standard Mac OS X bundles. The file extensions “.app” for applet bundles and “.scptd” for compiled scripts have been added. Load script and run script also support these bundled types.

In addition, you can distribute scripting addtions with your applet by placing them inside the bundle’s Contents/Resources folder in a folder named “Scripting Addtions”. Note, however, that such addtions will not be loaded into the Script Editor when developing or maintenancing such an applet. You will need to place the scripting addtion in the normal places (~/Library/Scripting Addtions or /System/Library/Scripting Additions) while you are working on such an applet.

Prior to AppleScript 1.9.2, applets handled events in a LIFO (last-in, first-out) manner. This has been changed to the more appropriate FIFO (first-in, first-out) method.

On Idle handlers can now return a real value. Previously, only integers were supported, representing the number of seconds between calls to the idle handler. With the addition of real number support, you can now call an idle handler every half-second (.5) or some other fractional value of a second.

For date types, the month constants January, February, etc. can now be coerced directly to a number. They coerce as you would expect them to: January=1, February=2, etc. A short date property has also been added to the date type. The format used for the short date is that selected in System Preferences under the International pane.

AppleScript 1.9.2 adds the new picture types JPEG picture and GIF picture.

The zone class is no longer available, since EPPC over AppleTalk is not supported in Mac OS X. Constructions like the one below are invalid in AppleScript 1.9.2:

tell application "Finder" of machine ¬
    "Steve's PowerBook" of zone "Fourth Floor South"
        tell front window
        end tell
end tell

Instead, a reference to a machine on the network that is not a URL is assumed to be a Rendezvous/Bonjour reference to a named machine.

Standard Additions Changes

Choose application now displays localized applicatin names, remembers its previous size and postion, and allows selection of an application by typing the first few characters of the application name.

Choose color, a command to display the color picker, has been added. It returns the color selected as a list of RGB values. The command supports the default color parameter which, if not specified, is assumed to be black.

You can now specify a default starting directory for the choose file, choose file name, and choose folder commands by using the default location parameter.

In addtion, choose file and choose folder support the with/without invisibles parameter that controls whether files/folders that are normally not seen in the Finder are visible in the dialog box listing. The default for the parameter is true for choose file (invisibles are shown) and false for folders (invisibles are NOT shown).

Multiple selections are now also supported in choose file and choose folder if you specify the new parameter multple selections allowed. The default for this parameter is false (only 1 item can be selected).

Unicode and Styled Text prompts are supported by choose file and choose folder now. However, there is not longer a default prompt used with these commands, so if you want a prompt you must supply one using with prompt.

That being said, it’s odd then that a default prompt has been added to the choose file name command, along with a new title.

Since idle handlers can now return a real number, it should be no surprise that the delay command now accepts them as well.

The display dialog command has been given a Unicode update. It now support Unicode text for the text displayed and returns Unicode text in the button returned and text returned properties.

The save dialog presented by store script has a new default prompt and title and is resizable and moveable.

The do shell script adds a new parameter, as, that specifies the type of result to return from the command. The default is UTF-8 encoding. However, if as is not specified and the command returns something that is not valid UTF-8 code, the result will instead back down to type Text.

File information now can return kind (the item’s kind string from the Finder) and bundle identifier (the item’s bundle identifier if the item is a package). Package support now also includes short and long versions for the info for command.

path to can now create a needed folder if it does not exist. The default is to create the folder unless the parameter without folder creation is given.

New folder constants have also been added to path to:

and now supports a Classic domain constant that can be used with the from parameter that returns values as if the script were being run in Classic/OS 9 instead of OS X. The shut down folder constant has been renamed to shutdown folder to avoid being confused with the Finder’s shut down command.

Command Line Enhancements

osacompile supports the new bundled formats for scripts and applets and if the -o flag is provided and the file doesn’t exist osacompile will use the filename extension to decide the type of file to create. If the extension isn’t “.app” or “.scptd,” then the script will be placed in the data or resource fork of the output file (depends on other options specified).

When compiling a script into an applet, you can specify the -s flag which is equivalent to checking the “Stay open” checkbox in Script Editor. There is also a -u flag which is the same as checking “Use Startup screen.”

If an error happens during script execution of uncompiled scripts (text files), the osascript tool will report a character range that indicates where the syntax error is within the script.


AppleScript Fixes

Pathnames that contain non-ASCII characters no longer cause problems as they did prior to 1.9.2.

Coercion of miles, yards, feet to inches and cubic yards or cubic feet to cubic inches are fixed to give correct results.

Coercing Unicode Text to Text or Styled Text now handles byte-order-mark characters properly. Coercing the other way, from Styled Text to Unicode Text now handles failures and warnings correctly and example scripts whose language is Korean can now be opened in Script Editor.

Empty Values
Empty values for with timeout and considering or ignoring no longer cause crashes or stack overflows.

Text Handling
The statement paragraphs 2 thru -1 of “” no longer causes a crash.

Getting the text items of a string now works correctly when there are no text item delimiters (when they are set to {}).

Japanese systems now correctly handle backslashes in strings.

Long strings
Getting the characters of a very long string no longer causes a stack overflow. Using contains and ends with operators with long strings (more than 32,767 characters) works correctly now. Previously they returned false if no match was found in the first 32,767 characters.

Unicode Text
Getting the text items of a Unicode string now works correctly. Getting the text items or paragraphs of an empty Unicode string now returns an empty item{“”} instead of {} (an empty list).

Using ignoring punctuation, ignoring white space, or ignoring hyphens when testing using the containment operators with Unicode strings now works correctly, where before they did not ignore these things properly.

Containment tests work faster now on Unicode Text.

Coercing a Unicode constant that had been specified by using the data class («data utxt.») no longer causes a crash when using the & operator.

Math Fixes
Numbers larger than 4,294,967,295 now compile correctly. Previously they changed during a compile to their value minus this number.

Exponents between 32,767 and 65,536 are now handled correctly.

Correct results are now obtained when adding a negative number to dates in the range 1/1/1904 0:00:00 to 1/19/1972 3:14:07. Subtractions involving dates prior to 1/1/1904 have also been corrected.

Date arithmetic involving date object specifiers now works as expected instead of reporting an error that says the object specifier can’t be coerced to a date.

Miscellaneous Fixes
The randomness of the some item reference has been improved.

Using run script within a Finder tell block would cause a crash in some instances. This is fixed.

URL’s can now use “https” and will now compile properly.

Errors that occur when attempting to connect to a remote machine are no longer reported with a generic “can’t find application dictionary” message, but report the actual error.

Compile errors near the end of long scripts (more than 32,767 characters) now highlight the correct line in Script Editor.

Telling an application that wasn’t running to quit would launch the application, then quit it. If the application is not running there is now no action taken.

Loading an OSAX written in Objective-C no longer causes crashes.

A crash that would occur in certain circumstances after garbage collection has been fixed.

Unspecified memory leaks have been fixed.

Unspecified incorrect error messages have been fixed and a missing error message (also unspecified) has been added.

Script Editor’s default formatting has been changed. If you have already been using Script Editor on a given machine, you won’t notice these changes unless you:

Standard Additions Fixes

Display Dialog
display dialog now handles the Return, Enter, and Esc keys correctly.

It also reports an error if the default button parameter is set to 0, a negative number, or a number greater than the total number of buttons, or if a record is specified as the text to display.

Do Shell Script
do shell script with administrator privileges now knows the difference between a cancelled authentication and a failed authentication and no longer reports an authentication error if the admin user has no password.

Info For
info for longer returns the folder window for packages. The visible property is now correct for items whose name begins with a period.

List Folder
list folder no longer crashes when given a file instead of a folder. list folder without invisibles no longer lists items whose name begins with a period.

Open For Access
open for access would try to create a file that already existed in some circumstances, which resulted in a “duplicate file name” error. It’s now fixed.

In addition, you can now create a file whose name contains slashes or colons using open for access as long as that doesn’t clash with the style of path you are using (POSIX or Mac).

Path To
path to now works correctly with the folder constants startup, startup items, startup items folder.

Running a script from Script Menu would cause path to to return the path to System Events when attempting to get the path to the frontmost application. This is fixed.

read now works correctly when the file contains Unicode text and the before, until, or using delimiter parameters have been specified.

Run Script
run script encounters an error while compiling the script, it now reports the actual error instead of a generic script error.

A problem that caused the say command to hang has been fixed.

the clipboard now works correctly if the as parameter is specified. Previously, the as parameter was almost completely ignored.

the clipboard now works correctly if the as parameter is not specified. If the clipboard contains only one item, that item is returned. If the clipboard contains multiple items and at least one of the items is text, the “highest quality” text item will be returned. Unicode text is preferred over styled text which is preferred over plain text. If the clipboard contains multiple items but none of the items is text, the items are returned as a record.

Several unspecified errors in the Standard Additions dictionary have been fixed.


The functions OSALoadFile(), OSALoadExecuteFile(), OSAStoreFile(), and OSADoScriptFile() have been added to the OSA API to allow applications to load, execture and store scripts using both the old and new (bundled) script formats. For details, see the Open Scripting Architecture Reference.

AppleScript now sends the subject parameter in some cases where it previously failed to. This allows applications to make the at parameter for make new optional.

System terminology is now read into memory only when needed for compilation or decompilation. This reduces the memory cost for applications that simply run compiled scripts.

AppleScript now preserves international characters better when compiling Unicode source.