Apple Event Registry

Along with scripting components, another important OSA element is the Apple Event Registry. The Registry is an Apple Computer-maintained database that maps all of the Apple events that the Mac OS standard software uses to a corresponding English-language command. This means that the activate AppleScript command is mapped to an activate Apple event, quit is mapped to a quit Apple event, and so on. You can use the Registry to discover the Apple event codes that are used by the Mac’s standard software (such as the Appearance control panel, the ColorSync extension, or Sherlock 2). Section 1.2.4 describes what these codes are.

Tip

The AppleScript software development kit (SDK) includes a FileMaker Pro file that contains the Apple Event Registry for AppleScript Version 1.3.4. Go to http://developer.apple.com/sdkfor more SDK information.

To make them easier to understand and incorporate into applications, Apple events are logically grouped into suites or categories, such as the Database Suite, the Standard Suite, and the Text Suite. All Mac applications are required to support four Standard Suite events (open, print, quit, and run; this was the “Required Suite” prior to AppleScript 1.3). This does not mean that all Mac programs do support these events; software developers don’t go to jail if they have not implemented these Apple events in their programs. However, this does mean that the vast majority of applications will reliably quit if, for example, your script sends them a quit Apple event.

Applications and scripting additions can (and usually do) define their own Apple events and corresponding human-language commands. For example, the BBEdit text editor supports a subset of the Standard Suite of Apple events that you can look up in the Registry database. BBEdit also contains a set of events and classes known as the BBEdit Suite, which is unique to BBEdit. Table 1-1 shows the Standard Suite Apple events and Apple event classes that BBEdit 5.1 supports. It also shows the Apple events and Apple event classes that are listed in the BBEdit Suite. (Section 1.2.6 describes Apple event classes in more detail.)

Table 1-1. BBEdit 5.1’s Standard Suite and BBEdit Suite

BBEdit Standard Suite Events

BBEdit Standard Suite Classes

BBEdit Suite Events

BBEdit Suite Classes

close

application

insert text

character

count

window

insert file

word

delete

document

insert folder

line

get

Recent file

insert project

text

make

 

find

text item

revert

 

replace

selection-object

save

 

find differences

hit

set

 

go to line

 
  

go to function

 
  

go to marker

 
  

select current paragraph

 
  

twiddle

 
  

change case

 
  

shift

 
  

hard wrap

 
  

insert line breaks

 
  

remove line breaks

 
  

unwrap

 
  

zap gremlins

 
  

entab

 
  

detab

 
  

insert glossary entry

 
  

get FTP file

 
  

put FTP file