Experimenting with AppleScript

By: Richard Glaser - Revised: 2006-06-07 devin


The first obvious step to learn AppleScript is experimenting with scriptable and recordable applications and trying some scripts. A great method of learning AppleScript syntax, is using a recordable application and record actions.

Scriptable Applications

Any Macintosh application that supports AppleScript must have a dictionary. The dictionary defines the commands that the application will understand in AppleScript. Not all applications support AppleScript or are AppleScript aware, but work arounds to use AppleScript with these non-scriptable applications.

Software for working with non-scriptable Applications:

Scripting IconPreFab Player is commercial software that adds verbs that query and manipulate the Macintosh user interface, giving your scripts access to otherwise non-scriptable applications, desk accessories and control panels.
Scripting IconSandi's Additions is a freeware Scripting Addition that has collection of commands for scripting keyboard, mouse input and more.

Finding Scriptable Applications
You can easily find the scriptable applications on your Mac's hard disk by using a program like "File Buddy". File Buddy is a popular and powerful file utility for getting info, finding files, making aliases, freeing your disk of unused files and much more.

Launch File Buddy, open up the "Find..." command from the "Find" menu. Select the "File Type" option and enter text APPL.

File Buddy Find Dialog Box

From the "More Options...", select "Find Resources" from the pop-up menu, in the "Resource Type" text box enter "aete".

File Buddy Find Resources Dialog Box

Then select the volume you would like to search and click the "Find" button.

Recordable Applications

AppleScript can automatically create a script based on a recording of real-time actions. There are a limited number of recordable applications, but those few are great learning the proper syntax, and demonstrating the power of AppleScript.

A good first step in learning AppleScript is using Script Editor's "record button" with a recordable application (i.e. Finder), do something in the application, and view the generated script.

The Record Button