10.1 Changes

This article describes changes to AppleScript and related tools in Mac OS X v10.1 and its updates.

Mac OS X v10.1 - AppleScript 1.7

AppleScript 1.7 is included with Mac OS X version 10.1 and requires Mac OS X version 10.1 or later.

Developer Notes

  • The return value from the OSAScriptError() function historically returned an error range that was a record of two short integers, and therefore could not accurately report errors in scripts longer than 32K. AppleScript 1.7 returns a record of two typeLongInteger values. Existing code that gets these values as typeLongInteger will now work correctly; applications that asked for short integers will continue to get erroneous results on long scripts and should be revised to accommodate the new return value.

  • To support a wider variety of sources of script text, the compiler in AppleScript 1.7 accepts all three prevalent styles of line endings: Macintosh style (carriage return, ASCII 13), UNIX style (linefeed, ASCII 10) and Windows style (CRLF, ASCII 13-ASCII 10). Decompiled source will continue to be Macintosh-style.

  • Every event sent by AppleScript to an application or scripting addition now includes an enumConsidsAndIgnores ('csig') attribute whose value is a typeUInt32 bit field with bits set for every consideration or ignore currently in effect. Mask constants are defined in ASRegistry.h. This attribute obsoletes the older enumConsiderations attribute, which is difficult to interpret, incomplete, and is only sent with events that contain a whose clause.

  • The kAESave and kAEClose Apple events have been defined in the Apple Event Registry to accept a typeAlias value in their in and saving in parameters. This is technically inaccurate as scripters may specify files that do not exist for these parameters, and typeAlias cannot represent a file that does not exist. The historical solution has been to supply a typeFSS value (or a cFile value which is coerced to a typeFSS) and create the file using the file specification. In Mac OS X, however, file specifications are not valid values in Apple events, as they cannot represent long or Unicode file names and are not necessarily valid across processes. For AppleScript 1.7 and later, applications should get these parameters as typeFileURL and use the sample code provided in Tech Note TN2022 to find or create the file it represents.

New Features and Enhancements

  • Program Linking: Program Linking now works between Mac OS X machines as well as between Mac OS 9 and Mac OS X machines. When targeting applications running on a Mac OS X machine, you must use TCP/IP networking and addressing; AppleTalk is not supported. (In addition, AppleScript 1.7 now supports encoding the login name and password into the eppc URL.) For a Mac OS X machine to respond to Program Linking requests, Allow Remote Apple Events must be enabled in the Sharing panel of System Preferences.

  • SOAP and XML-RPC Support: AppleScript can now use Internet applications as targets of tell blocks. The URL for the application reference must be a correct URL for a SOAP (Simple Object Access Protocol) or XML-RPC (eXtensible Markup Language Remote Procedure Call) Web server. The syntax is:

  • An alternate syntax is:

  • but this form will be converted to the form above when the script is compiled.

  • File Extensions: Like most other Mac OS X functions, AppleScript now supports file extensions (as well as the historical file types) on all the file kinds it deals with. The file types for AppleScript are:

  • Applets: Prior to AppleScript 1.4.3, script applications (applets) were stored in a universal format that worked on both 680x0-based and Power PC-based Macintosh models. Because that format was 680x0-based, it would not work on Mac OS X, so a Mac OS X applet format was introduced in AppleScript 1.4.3. With improvements in Mac OS X since that time, it is now possible to produce a script application that works on 680x0-based, Power PC-based Mac OS 9, and Mac OS X configurations. Script Editor 1.7 again offers only one choice for saving script applications. Older formats continue to work on the configurations they were saved for.

  • Command Line Tools: The osacompile and osascript tools now have an include option (-i) that allows you to specify application terminology to be used when compiling the given scripts. This frees you from having to specify applications in tell blocks in the script itself. You can also use this to specify the static terminology for an application with dynamic terms, so you can prevent that application from being launched when you compile the script.

Bug Fixes


  • In AppleScript 1.5 through 1.6, a script’s global variables could be lost under certain rare circumstances. If a script contains a tell block that targets a variable, and that variable specifies an application that does not exist, the “Where is application AppName?” dialog would be presented when the script is executed. After that point, further references to global variables in the handler that included the tell block would fail. This has been fixed.

  • In AppleScript 1.5 and 1.6 for Mac OS X, scripting additions behaved fundamentally differently than in Mac OS 9: they were only installed in certain applications that were AppleScript-aware. If a scripting addition command (such as display dialog) was sent to an application that was not AppleScript-aware, the event would instead be executed in the application running the script (e.g. Script Editor); that means the dialog would come up in the Script Editor layer, not the tell target application. In AppleScript 1.7 for Mac OS X, the scripting additions mechanism has been redesigned to behave more like Mac OS 9, and scripting addition commands sent to applications will be executed in the process space and window layer of the target application.

  • AppleScript 1.5 through 1.6 often launched applications unnecessarily in order to get their terminology, and often used the terminology of the script editing application (such as Script Debugger) instead of application terminology. This has been fixed.

  • In AppleScript 1.5 through 1.6 for Mac OS X, the version property of AppleScript or an application would be displayed as raw data rather than a string (unless the version property was explicitly converted to a string). This has been fixed.

  • In AppleScript 1.5 and 1.6 for Mac OS X, certain operations with file object specifiers (e.g. file "Mac OS X:Applications:Terminal.app:" as alias) would fail, when similar operations would succeed on AppleScript 1.3 through 1.6 for Mac OS 9. These operations now work in AppleScript 1.7 for Mac OS X. Note that, as always, while you can pass a file object specifier as a parameter to an event, or perform certain operations on it (like assignment and coercion), simply evaluating file "pathname" is itself an AppleScript error.

  • AppleScript 1.5 and 1.6 for Mac OS X could not target Mac OS 9 control panels running in the Classic environment. This has been fixed. Note that the Classic environment only supports a small number of control panels from Mac OS 9 (such as the Launcher).

  • Accessing paragraphs of AppleScript strings did not work correctly in AppleScript 1.5 through 1.6 if the line endings were Windows-style (CRLF). The result would be only the first half of the text paragraphs, interspersed with an equal number of blank strings. This has been fixed.

  • Occasionally with AppleScript 1.5 and 1.6, recompiling a script would get an “end of file” error reading an application’s terminology. This has been fixed.

  • In AppleScript 1.6, under certain circumstances calling a handler in an applet that has not been launched could cause a “Cannot continue” error. This has been fixed.

  • In AppleScript 1.6, Unicode text values stored in script properties of a saved script could not be reloaded reliably. This has been fixed.

  • In AppleScript 1.6, Unicode text received from certain applications that included a Unicode byte-order mark would behave incorrectly; the text would appear to begin with the Euro symbol, and some operations would fail. AppleScript 1.7 handles Unicode text with byte-order marks correctly.

  • In somewhat rare circumstances, comparing two references to the same file for equality can fail even if both references refer to the same file. This is true in AppleScript 1.0 through 1.6 and has been fixed in AppleScript 1.7.

  • In AppleScript 1.5 and 1.6, a running AppleScript applet will become non-responsive to any events (except command-period) after processing more than one incoming event. This has been fixed.

Standard Additions

  • All disks formatted as Enhanced Macintosh File System (HFS Plus) are able to store files with file names greater than 32 characters and stored as Unicode text. When older software accesses such files, those names are represented in an encoded form (with something like #28AF in the name). With AppleScript 1.6 and earlier, the results of many Standard Additions commands (like path to, info for, and list folder), as well as creation and display of alias objects, would require and return encoded names. In AppleScript 1.7, long and Unicode file names in aliases and for scripting additions are represented by styled or Unicode text. Encoded file names are no longer supported.

  • In Mac OS X v10.0 through 10.0.4, the choose file name command in Standard Additions 1.6 would crash if given an empty string ("") as the default file name. This has been fixed. In addition, on Mac OS X the default file name can be a Unicode string.

  • The choose from list command in Scripting Additions 1.4 through 1.6 allowed the scripter to create a situation where it would return an empty selection even if the scripter specifically disallowed that case. (This can be done by supplying a default item that does not appear in the list). In Scripting Additions 1.7 and later, the OK button will not be enabled in such cases.

  • In versions of Standard Additions prior to 1.7, the choose URL command’s using editable URL parameter was present in the Scripting Additions dictionary but was nonfunctional (URLs were always editable regardless of the setting of the parameter). It now behaves correctly: if set to false, the user can choose a URL only by browsing, not by editing the URL in the text box.

  • In Mac OS X, the info for command now returns additional record items that provide information about the file’s extensions. The displayed name item returns the name of the item as the user sees it in the Finder or file dialogs, and the name extension item now returns the file extension (if any) that is on the indicated file (without the “.”, which is considered a separator, and not part of either the name or the extension). Both of these fields (along with the name field itself) are Unicode text values.

  • Mac OS 9.1 and Mac OS X Public Beta introduced the concept of a package, that is, a file composed of a folder of several files and folders, which is treated as an integral file by the Finder and other applications. The info for command in AppleScript 1.6 and earlier treated such packaged data application files as folders, not files, and would not return file- or application-related information about them. In Standard Additions 1.7 and later, getting the information for any directory (including package folders) returns an additional record item package folder (if this Boolean value is true, then the directory is a package), and the file’s type and creator.

  • In Standard Additions 1.6 and earlier, the info for scripting addition would fail if any piece of information in the requested file or directory was unavailable. On UFS (Mac OS X) disks and mounted NFS volumes, the file creation date is unavailable, and accessing it causes a -8850 error (in trying to convert it to Universal Time). Starting with Standard Additions 1.7, any missing piece of information in the info for result is provided as the value missing value without failure. In AppleScript 1.6 and earlier, magnitude comparisons (<, ≤, >, ≥) against the missing value would signal a coercion error for most types; in 1.7 and later, these comparisons always return false without error. These two changes ensure that scripts that use info for against UFS and NFS volumes do not fail, though they may not get correct results because any comparison to the creation date is always false.

  • In Standard Additions 1.6 on both Mac OS 9 and Mac OS X, the info for command would return an error -1401 for a nonexistent file, rather than the normal -35 returned in previous versions. In Standard Additions 1.7, trying to get the info for a nonexistent file (or a file in a nonexistent directory or inaccessible disk) will return the -35 error.

  • From AppleScript 1.1, the offset command has not worked correctly when the direct parameter is styled text. It also has not worked correctly with the newly-introduced Unicode text type. It now produces correct results with both styled and Unicode text.

  • Standard Additions 1.5 through 1.6 changed the way that the random number seed worked in the random number command. Older versions used the system clock as the seed value if no seed value (or a seed value of 0) was provided; Scripting Additions 1.5 and 1.6 always use a seed value of 0 in these cases. In Scripting Additions 1.7 the older behavior has been restored. In addition, the seed value is now taken from the 60Hz “ticks” counter rather than the system clock, because the increased speed of new machines makes it more likely that two consecutive random number calls may receive the same system clock time as their seed value.

  • The read command in Scripting Additions 1.6 had specific problems with the using delimiters parameter. In previous versions, read f as list using delimiters {tab} would return a list, but in AppleScript 1.6, it returns a list of one-item lists. In AppleScript 1.7 and later it behaves as it did prior to version 1.6

  • The read command in Scripting Additions 1.6 had specific problems with the before and until parameters if used in conjunction with the as parameter. Instead of returning a value of a given type, it would return random data or an error. This has been fixed.

Command Line Tools

  • For the osacompile and osascript tools, the requirement that they be invoked with full paths (i.e. /usr/bin/osacompile) has been eliminated. They can now be invoked with implicit paths like any other command-line tool.

  • In Mac OS X v10.0.0 through 10.0.4, the -l and -d options for the osalang tool did not work as documented. In Mac OS X v10.1 and later, -l prints the subtype, manufacturer, flags, and name; and -L also prints the description in parentheses after the name.

  • The osacompile and osascript tools previously had a limit of 32K of input text. This limit has been lifted in Mac OS X v10.1.

  • The osacompile and osascript tools execute as background applications; they cannot involve any user interface. If you want to call display dialog, choose from list, or other user-interface scripting additions from a script being executed by osascript, you must enclose it in a tell block targeting a running application (such as the Finder).

December 2001 Developer Tools Update - AppleScript 1.8

AppleScript 1.8 for Mac OS X is included with the December 2001 Developer Tools Update and requires Mac OS X version 10.1 or later.

Developer Notes

  • In Mac OS X v10.1 and 10.1.1, scripting additions would have their initialization function called at application launch time, but their termination functions would not be called when the application quit. Scripting additions that used system resources would not get a chance to release those resources. Every scripting addition termination function is now called when an application exits. [2811696]

New Features and Enhancements


  • To provide better access to Mac OS X’s underlying UNIX functionality, AppleScript 1.8 adds a new Standard Additions command (do shell script), a new file property (POSIX path), and a new object (POSIX file).

Standard Additions

  • The new do shell script command and the scriptable Terminal allow AppleScript scripts to execute strings of text as UNIX shell scripts. Many interesting shell commands act on files, and require POSIX-style file paths as input parameters. To create POSIX-style file paths from AppleScript file objects, the property POSIX path has been added to the file and alias classes. All file types, including file specification and file reference, support this property. Its use is straightforward:

  • The do shell script command and the scriptable Terminal allow AppleScript to execute UNIX shell scripts and get the results as strings of text. Frequently these strings are the pathnames of files in the UNIX format, i.e. starting at root with directory names separated by forward slashes. To convert these POSIX paths into an AppleScript file object, you can use the new POSIX file object:

  • The new do shell script command takes a string as its direct parameter and executes that string in a UNIX shell. The text can be anything from a single command with parameters to a long script. The results of the script execution (standard out) are returned as the result of the command; if there is an error (or no output), the error output (standard error) are returned as the error message and can be processed in an AppleScript on error handler. Note that the environment in which a shell script is executed is a separate process in the user’s process group, and does not have a terminal set up, so commands that require interaction (vi, top) will not function. There is no way at present to direct any information to standard in of a shell script. Note also that do shell script uses the sh shell, which is different than the default tcsh shell used in the Terminal. Command paths and environment variables are different in sh; you will need to adjust your shell scripts accordingly.

  • The system attribute command has been extended to provide information on the user’s environment variables. These are set up at user login time and cannot be altered. If the direct parameter to system attribute is a four-character Gestalt code, it is executed as in Standard Additions 1.7; if not, it attempts to get an environment variable by that name, returning either the value of the variable or an empty string. (Note that system attribute now will not fail with an error; it simply returns an empty string.) If called with no parameters, system attribute returns a list of all currently-defined environment variables.

Bug Fixes


  • AppleScript 1.7 could not perform certain operations on file names or file paths that contain certain characters (such as accented characters like é). This has been fixed. [2816363]

  • In AppleScript 1.7, references to the process class of the Finder on a remote machine did not work. This has been fixed. Note that you need to be running Mac OS X v10.1 or later on the target machine, and Mac OS X v10.1.2 or later on the machine executing the script. [2775419]

  • With AppleScript 1.6 and 1.7, applications that attempted to convert Unicode text to plain text would get an error (though AppleScript itself could perform such conversions successfully). This prevented older applications from being able to use information (such as file names) that is now supplied as Unicode text. This has been fixed. [2816500]

  • Certain development environments can create scripts whose parent is an application object, rather than a top-level script. Attempting to get any parent properties of such objects (including the information returned by OSAGetScriptInfo) would cause AppleScript to crash. This has been fixed. [2755096]

  • With AppleScript 1.7 in Mac OS X v10.1, applets that are set to show their startup (splash) screens occasionally failed to do so. This has been fixed in AppleScript 1.8. The applications do not need to be recompiled or re-saved. [2756226]

Standard Additions

  • In Standard Additions 1.7, the description of the choose application command stated that it allows users to choose a running application. On Mac OS X it allows users to choose any application, running or not. [2785713]

  • In Standard Additions 1.7, using the mount volume command with an AppleTalk server name in the on server parameter did not work. This has been fixed. [2656820]

  • In Standard Additions 1.7, if the path to command was requested to return the path of a folder that did not exist (such as scripting additions folder from local domain), it would fail. In previous versions, and now in 1.8 as well, it creates the folder and returns the path to the created folder. Note that if the user does not have authorization to create the folder (e.g. is not an administrator and requests a nonexistent folder in the System domain), the operation will still fail. [2751119]

  • In Standard Additions 1.7, the store script command would crash if no in parameter was supplied. This has been fixed. [2782590]

  • Previous versions of Standard Additions improperly list the parameters for the store script command. Both the direct parameter (the script) and the in parameter (the file) are optional. If the script is omitted, an empty script is stored in the file; if the in parameter is omitted, the user is prompted for a file name. [2784735]

Command Line Tools

  • The osacompile tool would fail if provided with a -i parameter specifying a nonexistent file. It is now more lenient and issues a warning, but continues compilation. [2796415]

Mac OS X v10.1.2 - AppleScript 1.8.1

AppleScript 1.8.1 is included with Mac OS X version 10.1.2 and requires Mac OS X version 10.1 or later.

Bug Fixes


  • In Mac OS X version 10.1 and 10.1.1, installing certain multimedia software (such as Roxio Toast or QuickTime 5) would cause all AppleScript applets to crash when launching. This has been fixed. [2785067]

April 2002 Developer Tools Update - AppleScript 1.8.2

AppleScript 1.8.2 for Mac OS X is included with the April 2002 Developer Tools Update and requires Mac OS X version 10.1 or later.

New Features and Enhancements


  • The do shell script command and the scriptable Terminal allow AppleScript scripts to execute strings of text as UNIX shell scripts. The UNIX shell interprets certain characters specially (including single-quote, double-quote, dollar sign, slash, and backslash). In order to pass text containing these characters to the shell, they need to be quoted to let the shell know to process them literally, rather than apply its special interpretation. The property quoted form has been added to the string and Unicode text classes. The value of this property is the text enclosed in single quotes, with any single quotes in the string (such as apostrophes in filenames) handled by concatenation. In general, all POSIX file paths and most text parameters provided to shell commands should be quoted. A common use of this is in commands like:

Standard Additions

  • The dialogs for display dialog and choose from list are now moveable modal dialogs and can be moved by the user. [2845800]

  • The do shell script command has a new altering line endings optional parameter. When this optional parameter is omitted or true, the result of do shell script will have Mac-style line endings (CR, ASCII character 13) and always be terminated by a CR; with this optional parameter set to false (i.e. without altering line endings), the results will have UNIX-style line endings (LF, ASCII character 10) and may or may not have a terminating LF. The default results are compatible with AppleScript 1.8.1, while the without altering line endings form returns the unaltered output of the UNIX script. [2850410]

Bug Fixes


  • In AppleScript 1.8.1 and earlier, using text item delimiters to extract text items from Unicode text can cause the application to crash. This has been fixed. [2848981]

  • In AppleScript 1.6 through 1.8.1, a script comparing two Unicode strings could occasionally crash the application running the script. This has been fixed. [2885328]

  • In AppleScript 1.8.1 and earlier, certain applications executing scripts can become unstable when coercing identifiers to strings in tight loops. This includes FaceSpan and AppleScript Studio applications. This has been fixed. [2858324]

  • In AppleScript 1.8 and 1.8.1, the Use Startup Screen menu item in script applications does not work. This has been fixed. [2844978]

  • In AppleScript 1.8 and 1.8.1 for Mac OS X, getting the POSIX path property of a directory would omit the terminating colon. This has been fixed. [2851963]

  • In AppleScript 1.1 and later, loading any script would cause a small memory leak. This has been fixed. [2852866]

  • With AppleScript 1.8 and 1.8.1, some applications that create and/or execute scripts (such as Script Debugger) will occasionally crash when trying to get certain information about a script. This has been fixed. [2811897]

  • In AppleScript 1.8 and 1.8.1, some applications that execute scripts that target themselves will crash unexpectedly. This has been fixed. [2839367]

  • On some rare occasions in AppleScript 1.8 (often during recording), the name of an application in a tell statement is changed to AEServer. This has been fixed. [2822232]

  • In all versions of AppleScript 1.5.5 and earlier, using the some operator on a record to select a type that does not exist in the record (e.g. some string of {a:2, b:3, c:{5, 7, 11}}) would return the entire record, rather than an error. This was fixed in AppleScript 1.6 for Mac OS 9, but has not been fixed in Mac OS X until now. [2842496]

  • AppleScript 1.7 could not open scripts saved on Mac OS 9 by any version of AppleScript if those scripts contained references to applications on remote machines. AppleScript 1.8 can open those scripts, but omits the first two characters of the host name. AppleScript 1.8.2 and later will correctly read and display an application reference created on Mac OS 9. [2781523]

Standard Additions

  • Many commands in Standard Additions 1.7 through 1.8.1 adopted a new style of processing input parameters that refer to files. This was found to fail when used inside application tell blocks with application objects (such as Finder file objects). Those commands have been modified to work harder to understand file references in applications. [2840037]

  • The display dialog command now recognizes a user-defined button with the button name “Cancel” as the cancel button when the computer is using a non-English system. [2765410]

  • In Standard Additions 1.7 through 1.8.1, using lengthy button titles in the display dialog command could cause the prompt text to be truncated. This has been fixed. [2844857]

  • The performance of the do shell script command has been significantly improved when executing lengthy shell scripts. [2853370]

  • Prior to Standard Additions 1.7, the list folder command had a special case to accept a path string as its direct parameter (though it is documented to accept an alias). In Standard Additions 1.7, this special case was omitted, causing scripts that used the form list folder "Macintosh HD:" to fail. This special case has been restored. [2850766]

  • In Standard Additions 1.7 through 1.8.1, the open for access command would not set the file type and creator of newly-created files. This has been fixed. [2836047]

  • The run script command in Standard Additions 1.5 through 1.8.1 did not handle the in parameter correctly when choosing an OSA scripting component. It would in fact select the first OSA scripting component that was not the one named. This has been fixed. [2889646]

  • In Standard Additions 1.7, the write command signals an error -50 (parameter error) when a script attempts to write an empty string to a file. This has been fixed. [2823197]

Command Line Tools

  • In AppleScript 1.7 through 1.8.1, the osascript tool truncates output text if it contains a null character. This has been fixed. [2827241]

AppleScript 1.8.3

AppleScript 1.8.3 for Mac OS X is available as an independent Software Update and requires Mac OS X version 10.1 or later.

Bug Fixes


  • In AppleScript 1.8.2 and earlier, operations using AppleScript’s text item delimiters fail if the delimiters are set to Unicode string values. This has been fixed. [2895572]

  • In AppleScript 1.8.2 and earlier, converting a list of values to a Unicode string will ignore any text encoding information in those values, so the resulting Unicode string will not be correct. This has been fixed. [2895579]

Standard Additions

  • In Standard Additions 1.6 through 1.8.2, the as parameter for the read and write commands was not handled correctly (especially if the value of the parameter was short or a list). This has been fixed. [2751784, 2892057]