Here’s how it works when Script Editor compiles and executes the following code, which comprises a complete compilable script:
tell application "Finder" to sleep
This is what happens:
The AppleScript component has to find out which Apple event lies
behind the sleep command. The component knows
that the Finder is one of the places it should look for these
details, because the Finder is targeted by the
tell application "Finder"...
Remember that sleep is an English-language term for putting the computer to sleep, but it is implemented as the sleep Apple event beneath the surface. Figure 1-4 shows the structure of the sleep Apple event.
The AppleScript component discovers the attributes of the
sleep Apple event (e.g., the event id) from a
segment of the Finder file called the Apple event
'aete') resource. The
resource maps the sleep script command to the Apple event depicted in
The component then sends that Apple event to the Finder, which responds to sleep by powering down the computer.
Here is an explanation of the structure behind the Apple event in Figure 1-4.
Every Apple event is comprised of unique four-character codes that represent the:
Address of the target application
The event class represents a grouping of similar Apple events. The event id uniquely ...