Creating the Project
When you create an AppleScript action project, you start by selecting an Xcode template that provides all necessary project files and initial project settings.
The steps for creating a AppleScript action project are few and simple:
Launch the Xcode application.
You can find Xcode in
Choose New Project from the File menu.
Xcode displays the New Project assistant (see Figure 2-1). The Automator action project templates are near the top of the displayed list.
Select AppleScript Automator Action and click Next.
In the New AppleScript Automator Action assistant, enter a project name and select a file-system location for the project (see Figure 2-2).
For the tutorial project, the project name is Pass Random Items.
After you complete this step, Xcode displays the new project in its window, shown in Figure 2-3.
Almost all of the items in the project folder have special significance in the development process.
Any action project must import the Cocoa umbrella framework, which includes the Foundation and Application Kit frameworks. It also imports the Automator framework, which defines the programmatic interface for all Automator actions. See Automator Objective-C Reference for documentation of this interface.
The main AppleScript script file whose
on runhandler is called by Automator when the action runs in a workflow. You will write your AppleScript code in this file. An AppleScript action project can also have other (“helper”) AppleScript scripts, often to manually synchronize user settings with the action internal record of those settings.
Info.plistfile is the information property list for the action bundle. It contains configuration information that is generally related to the bundle and more specifically related to the action. The
InfoPlist.stringsfile contains English translations of items in
Info.plistthat might be displayed to the user. If your action is to be localized for languages or locales besides English, you will have to add an
InfoPlist.stringsfile to the project for each additional translation.
The nib file for the English version of the action. A nib file is an archive containing the view, controls, and other user-interface objects used by an executable, as well as the connections between those objects. You use the Interface Builder to create and maintain nib files. If your action is to be localized for languages or locales besides English, you will have to add a
main.nibfile for each additional localization.
Pass Random Items.action item shown in the project window is the action bundle. When the action project is built, the text color of the item will change from red to black to indicate that the bundle now exists in the build directory. All Automator action bundles must have an extension of