Chapter 27. Writing Applications

You might wish to create a standalone application, perhaps as a way of distributing your script to other users in a form that's easy to use. AppleScript provides the simplest way in the world to write an application: just save your script as an applet . An applet is a true standalone application; it can even accept drag-and-drop of files and folders onto its icon, and (most surprising) it's scriptable. However, an applet has essentially no interface (except for display dialog and other user-interactive scripting addition commands). You can wrap your script in a full-fledged interface, with windows, buttons, text fields, menus, and similar bells and whistles, using AppleScript Studio, a free development environment that lets you create a Cocoa application even if the only programming language you know is AppleScript. Another use of AppleScript Studio is to wrap your script in the smaller interface of an Automator action; users can then customize it through its interface and link it to other actions to create their own workflows. This chapter also deals with some more advanced issues related to writing applications: how to get started adding scriptability to a Cocoa application, and how an AppleScript Studio application can communicate internally from Cocoa to AppleScript. (See also "Application" in Chapter 2.)

Applets

An applet is a compiled script wrapped up in a simple standalone application shell (see "Applet and Droplet" in Chapter 3). To make ...

Get AppleScript: The Definitive Guide, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.