AppleScript 1.10 (Tiger 10.4)

Standard Additions Fixes

User Interaction
The choose application, choose from list, choose URL, and display dialog commands will no longer present dialogs on remote machines.

The choose application command no longer leaks memory.

In Mac OS X version 10.3.x, the choose application dialog is not responsive to mouse clicks within the content area when inactive. This has been fixed.

The of type parameter to the choose file command now works correctly for packages that don’t contain a PkgInfo file (e.g., scripting additions).

choose file of type {“MooV”} now works as expected. Previously, it allowed the user to choose any file that QuickTime could open.

The choose file name dialog now recognizes packages.

The display dialog command will no longer create a dialog that is too tall for the screen when given a very long string to display.

The display dialog command now displays Japanese text correctly when an applet is running on a Japanese-primary system.

Script Handling Fixes
The do shell script command now works correctly with multiple commands when the administrator privileges parameter is specified.

When the administrator privileges parameter is specified to the do shell script command, the 5 minute authentication timestamp now applies only to the current script.

The do shell script command now returns the correct error code (-128) if the user cancels the authentication dialog.

The run script command no longer causes a stack overflow error if the direct parameter is not specified.

File Handling Fixes
The info for command now returns the correct file type and file creator for packages that don’t contain a PkgInfo file (e.g., scripting additions).

read before as date no longer causes an error.

Miscellaneous Fixes
The using parameter to the say command now works correctly when Speech Recognition is turned on.

The using parameter to the say command no longer causes an error if the specified voice is not capitalized correctly.

the clipboard as Unicode text now works correctly when the clipboard contains styled text but no Unicode text.

Error checking and reporting has been improved.

Several errors in the Standard Additions dictionary have been fixed.

New Features and Enhancements In AppleScript

Strings
A new Considering/Ignoring attribute has been added that affects string comparisons. The numeric strings attribute specifies that numeric substrings should be collated by their numeric value. For example, “version 1.9” is less than “version 1.10”.

A new string constant named quote has been added whose value is “"”.

String concatenation now uses the richer of the two operands. If either operand is Unicode, the result will be Unicode.

Dates
The date class now has hours, minutes, and seconds properties. The hours property always uses a 24-hour clock.

The month property of the date class can now be set to an integer.

The weekday constants can now be coerced to numbers. Sunday is 1.

Math
The coercion from version to real has been changed to allow the second and third parts of the version number to be 0…15 instead of 0…9. As a result, the version 1.2.3 will now coerce to the real number 1.0203. Previously, it would coerce to the real number 1.23.

Applications and Applets
A tell application “AppName” statement can now use the application’s short name (CFBundleName) if the application is currently running.

If a script application (applet) encounters an error, the “Edit” button in the error dialog will now open the applet in the default script editor. The default script editor can be set using the new AppleScript Utility application.

If an applet has a custom startup screen, the startup screen will now be displayed when the user selects the “About appletName” menu item. Previously, the generic applet About Box was displayed.

If a bundled applet has a custom startup screen stored in Contents/Resources/description.rtfd/TXT.rtf, that startup screen will be displayed instead of the startup screen stored in the bundle’s ‘TEXT’ and ‘styl’ resources. Note that non-text startup screens are not currently supported.

Bundled applets now display localized menus and dialogs.

The applet startup screen dialogs and error dialogs now conform to the Aqua Human Interface Guidelines.

The applet About Box has been updated.

New Features and Enhancements In Standard Additions

User Interaction
The with prompt and with title parameters to the choose application command now support Unicode text.

The choose application dialog box now remembers the column widths.

The choose file and choose folder commands now have a showing package contents parameter that specifies whether packages should be treated as folders. The default is false.

The of type parameter to the choose file command now accepts either a list of file types or a list of type identifiers.

The choose from list command now has a with title parameter that specifies the title of the dialog. By default, the dialog does not have a title.

The choose from list command now supports Unicode text.

The choose from list command now supports long prompts and multi-line prompts.

The choose from list dialog now allows a text item to be selected by typing the first few characters of its name.

The choose from list dialog now supports full keyboard access.

A new choose remote application command has been added that enables the user to choose a running application on a remote machine or on the local machine.

The choose URL command now supports CIFS file servers.

A new display alert command has been added that displays a standard alert dialog that conforms to the Aqua Human Interface Guidelines.
¨Note that standard alert dialogs have the following restrictions:¨¢ A default button is required. The right-most button will be the default button unless the user specifies otherwise using the default button parameter.¨¢ The cancel button cannot be the same as the default button.

The display dialog command now has a cancel button parameter that specifies the name or number of the cancel button.

The display dialog command now has a hidden answer parameter that specifies whether editable text should be displayed as bullets. The default is false.

The display dialog command now has a with title parameter that specifies the title of the dialog. By default, the dialog does not have a title.

The default answer parameter to the display dialog command now supports Unicode text and linefeeds.

The with icon parameter to the display dialog command now accepts an alias or file reference to a “.icns” file.

The display dialog dialog now supports full keyboard access.

The display dialogdialog now uses Aqua icons for note, caution, and stop.

The display dialog dialog now conforms to the Aqua Human Interface Guidelines.

Script Handling
The do shell script command now displays the Mac OS X authentication dialog in order to obtain administrator privileges.

The do shell script command now has a user name parameter that specifies an administrator account. This parameter can be used along with the password parameter and the administrator privileges parameter in order to execute commands as an administrator without displaying an authentication dialog.

File Handling
The info for command now has a size parameter that specifies whether the size of the item should be returned. The default is true.

The info for command now returns the type identifier for files.

The info for command now returns the short name (CFBundleName) for applications.

The info for command now returns the busy status for packages. The busy status is set to true if the package is marked as incomplete (kExtendedFlagObjectIsBusy).

The info for command now sets the busy status for non-bundled files to true if either the file is marked as open (kioFlAttribFileOpenBit) or the file is marked as incomplete (kExtendedFlagObjectIsBusy).

The list disks command now supports disk names that contain Unicode characters. The return value from the list disks command is now a list of Unicode strings. Previously, it was a list of plain strings.

Miscellaneous Commands
A new localized string command has been added that returns a localized string for a specified key.

The path to command now has a folder constant for the Automator workflows folder.

The path to me command now returns the correct result for compiled scripts, including those that are run using the run script command.

A new path to resource command has been added that returns an alias to the specified resource.

The say command now accepts Unicode text and numbers as the direct parameter and as the displaying parameter.

A new system info command has been added that returns a record containing information about the system.

Developer Information

A new Open Scripting Architecture (OSA) API has been added that lets you get the scripting dictionary of an application as an sdef (see ASDebugging.h and sdef(5)). If the target application does not have a true sdef but does have an ‘aete’ or Cocoa-generated dictionary, it will translate that, so the API will work on any scriptable application.

OSAError OSACopyScriptingDefinition (¨   const FSRef * ref,¨   SInt32 modeFlags,¨   CFDataRef * sdef¨);

Parameter Descriptions¨ref An FSRef to the application file or bundle.¨modeFlags There are no flags currently defined; pass 0.¨sdef If the result is noErr, a CFDataRef containing the sdef XML, which you are responsible for releasing; otherwise undefined.

Discussion¨To provide an sdef in your application, put the sdef in the Resources folder of your bundle, and add the key “OSAScriptingDefinition” to your Info.plist with the value of the sdef name (e.g., “MyApplication.sdef”).

Known Bugs and Limitations¨Dynamic generation of sdefs is not supported. sdefs in single-file applications are not supported.

A crash that occurred when calling OSAScriptError() with the kOSAErrorApp selector has been fixed.

The osascript command line tool now passes the kOSAModeCompileIntoContext mode flag when compiling a text script.

The osascript command line tool can now call scripts that take parameters. Any arguments following the script will be passed as a list of strings to the direct parameter of the “run” handler.

Applescript Release Notes for the Mac OS X 10.4 minor releases are available on the Apple Developer Connection site at this location.