Language Guide
CHAPTER 5
Objects and References
References 123
References allow you to identify objects in a flexible and intuitive way. Just as
there might be several ways to identify an object on the desktop, AppleScript
has different reference forms that allow you to specify the same object in
different ways. For example, here’s another way to specify the fifth word of
a document:
word after word 4 of document "Work in Progress"
To write effective scripts, you should be familiar with AppleScript’s reference
forms and know how to use containers and reference forms to identify the
objects you want to manipulate. The sections that follow describe containers
and reference forms.
Containers 5
A container is an object that contains one or more objects or properties. In a
reference, the container specifies where to find an object or a property. To
specify a container, use the word of or in, as in
word 5 of paragraph 10
and
character 2 in word 12
where word 5 is contained in a paragraph object and character 2 is
contained in a word object.
A container can be an object or a series of objects. In a series, list the smallest
object first, followed by the larger objects that contain it. Use the word of or in
to separate each object from its larger, containing object. For example, in
word 5 of paragraph 10 of document "Report"
word 5 is contained by the larger object, paragraph 10; paragraph 10 is
contained by the larger object document "Report".