10.7 Changes

This article describes changes to AppleScript and related tools in OS X Lion v10.7.

Enhancements

Script Templates

AppleScript Editor now supports creating scripts from templates, a skeleton document designed for a particular task, using the New From Template command. Several templates are included in the system; to make your own, add an AppleScript Editor document to the folder Library/Application Support/Script Editor/Templates. Holding down the Command key while selecting a template menu item will reveal that template in Finder.

AppleScriptObjC in AppleScript Editor

AppleScript Editor provides a template “Cocoa-AppleScript Applet”, which is an AppleScriptObjC-based application that emulates the traditional on run and on open handlers for a script application (“applet”). As a result, you can write an applet much as you normally would, using AppleScript Editor, but with the added ability to call any Cocoa API.

AppleScriptObjC applets must be run from AppleScript Editor using the new Run Application command, which runs an applet by launching it as a separate process, as if it had been opened from the Finder. Run Application is also useful for applets that have special behavior when launched as their own process, such as on idle handlers.

Other Enhancements

System Events’ Processes Suite has a new pop over class to support the new pop-over windows in OS X Lion. [8948934]

path to has a new selector services folder, which returns the user’s Services folder. [6727316]

Bug Fixes

AppleScript

Performance of AppleScript applets has been improved. [3434887]

AppleScript will no longer hang looking for text item delimiters that current ignoring settings say to ignore. [7346401]

AppleScript now has built-in knowledge of System Events, and will never ask where it is when running a script. [8088421]

Standard Additions

mount volume now works correctly with passwords longer than 31 characters. [7154725]

beep now always beeps, even when used as the last command in a script. [7233358]

AppleScript Editor

Performance of saving script bundles and applets with large embedded resources has been improved. [4404257]

Save As… will copy embedded resources correctly. [7903069]

Compatibility Notes

For security reasons, AppleScript no longer supports initializer-based scripting additions. Scripting additions must use the Info.plist scheme introduced in Mac OS X v10.5 Leopard. If you have a now-unsupported initializer-based scripting addition, you will see a console message such as this:

OpenScripting.framework - scripting addition "/Library/ScriptingAdditions/Potrzebie.osax" declares no loadable handlers.

For details on implementing a scripting addition, see TN1164, Scripting Additions for Mac OS X.