A Wave of Automation
Not content to chill and sip sodas in the sunny surf, Apple waxes its boards and delivers important updates and innovations to the automation tools in OS X Mavericks.
The new automation features in OS X Mavericks range from integration with key OS frameworks (iCloud, Notifications, Security), to important advancements in popular established technology (AppleScript Libraries, the “use” statement), to the downright cool and innovative (Speakable-Workflows). Any way you look at it, a solid release with lots of automation goodness to explore and absorb. Cowabunga dude!
iCloud “Documents in the Cloud” support has been added to both the AppleScript Editor and Automator applications.
As with other Apple applications, users can store their automation documents, including AppleScript scripts, applets, droplets, and Automator workflow files and applets, to the document storage area provided with their Apple iCloud accounts. Use of this service ensures that your favorite automation tools can easily be shared across all of your Apple laptop and desktop computers.
Code Signing support has been added as an export feature to both the AppleScript Editor and Automator applications, enabling Apple developers to easily generate signed copies of their applets and droplets.
Code signed automation applets will not trigger OS security warnings on computers that are using the default Gatekeeper setting of only allowing applications downloaded from the Mac App Store and identified developers to execute. This feature is a boon for developers of automation-supporting Mac applications, and solution-providers, allowing them to distribute smooth-launching automation solutions to their customers and clients.
AppleScript Libraries provide a new plugin architecture for extending the power and abilities of AppleScript. AppleScript Libraries are user-created script files and bundles, written using AppleScript or AppleScript/Objective-C, that can be referenced in scripts to provide specialized handlers and functionality.
In addition to providing access to standard Cocoa classes and methods through the use of AppleScript/Objective-C, AppleScript Libraries can publish their own scripting terminology, making it easier for scripters to remember and incorporate custom commands in their scripts.
AppleScript Libraries are made universally available on a computer through their placement in new Script Libraries directories created in the standard OS Library domains, enabling AppleScript Libraries to be easily distributed between multiple computers running OS X Mavericks.
Watch the video: Libraries with Terminology (26:12-1152×720)
NOTE: Detailed developer documentation about creating scripting dictionaries, is available on the Apple developer site. See: Preparing a Scripting Definition File
A new AppleScript construct, called the “use” statement, imports the terminology and functionality of AppleScript Libraries and scriptable Applications through a simple single-line declaration placed at the top of a script, such as: use application "Finder", or: use "My AppleScript Text Library".
The handlers, scriptable objects, properties, and terminology of AppleScript Libraries and scriptable applications imported via a “use statement,” are automatically available globally throughout the hosting script, no longer requiring numerous “tell statements” or “tell blocks” to be compiled and executed. Scripts taking advantage of the “use statement” are more streamlined and clearer than similar scripts not implementing this new construct.
In addition, AppleScript Libraries written in AppleScript/Objective-C, can incorporate “use” statements to import Cocoa frameworks, such as MapKit, EventKit, and WebKit.
The ability to create and display system notifications has been added to both AppleScript and Automator. The use of Notification banners and alerts can now be incorporated into scripts and workflows by utilizing a new default AppleScript “display notification” command, and a new Automator Display Notifications action.
Automation processes requiring extended time to execute no longer need to display notification dialogs to communicate their progress or completion. Custom notifications, containing relevant information about the automation processing, can be placed at the start, end, or throughout an automation workflow, providing current feedback and status to the user.
If the Speakable Items feature is activated in the Accessibility system preference pane, Automator will now present a new option in the Automator save dialog, to save applets as Speakable Items, automatically added to the Speakable Items Speech Recognition architecture, and becoming available for execution by simply speaking the names of the saved applets. Speakable-Workflows extend the scope of the built-in Accessibility Speech Recognition commands with the power and abilities of OS X’s expansive automation architecture.
Watch the video: Speakable-Workflows (6:09-1152×720)
Developers have often relied upon AppleScript’s ability to control the user-interface, to provide an automation solution when no direct scripting support of an application or process was available. While this valued ability continues to be fully supported in Mavericks, the enhanced security focus of the new OS requires a few changes in how scripters access and apply the Accessibility frameworks.