AppleScript by Mark Conway Munro

AppleScript by Mark Conway Munro

Author:Mark Conway Munro
Language: eng
Format: epub, pdf
Publisher: Wiley
Published: 2010-06-14T16:00:00+00:00


Working with Standard Additions

The Standard Additions package contains dozens of very useful commands. To get started, open the AppleScript Editor and choose Library ⇒Window from the menu. Then, double-click Standard Additions to see the library of commands shown in Figure 16.1.

Figure 16.1

The Standard Additions library of commands

User Interaction

The User Interaction suite of the Standard Additions package provides basic commands for interacting with a user. These enable you to ask a user to choose a file, folder, and other items as well as provide feedback to users or ask a question.

Beep

Perhaps the simplest command in AppleScript, beep enables you to make a script user's computer beep. The sound he hears varies based on which sound he chose in his System Preferences. To use this command, simply place it at the appropriate position of the script, typically before an error dialog box or some other event that you want to be sure they take notice of.

If you want the script to beep more than once, put an integer after the command causing it to beep that many times. For example:

beep 2

Typically, you shouldn't have too many beeps in your script, and when you do, one to three is usually enough at any single location. Use a single beep before a dialog box appears that requires the user's attention. Reserve two or three beeps for notifying the user of a serious error or issue that demands more attention than a simple dialog message.

Choose application

The choose application command enables a script to prompt the user to select one or more applications that are installed on the computer or on the network. This command is useful when a script needs to send a command to one of several applications, depending on the user's choice. The basic command, choose application, displays a dialog box containing all of the available applications, as shown in Figure 16.2.

When the user selects an application, the result is an application object:

application “Adobe Photoshop CS4”

Figure 16.2

The Choose Application dialog box



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.