2016

Table Of Contents
OBJECT HIERARCHY
The Apple events object hierarchy is based on the simple concept of placing
things inside other things. An application’s object hierarchy usually consists
of objects such as windows, layouts, boxes, and contents. A specific hierarchy
in QuarkXPress might include a layout that contains a page. The page contains
a text box and the text box contains a story. The story contains paragraphs, and
the paragraphs contain lines. The lines contain words and the words con tain
characters. Characters are at the end of the hierarchy because they can’t
contain anything.
Objects that enclose other objects are referred to as containers. Objects that are
enclosed by other objects are referred to as elements. For example, a layout is
a container for a page; the page is an element of the layout.
OBJECT REFERENCES
An Apple events message must identify a specific object in an application to
communicate. Objects are identified by a reference. For example, the message
might reference the second text box on the first page. The reference first iden-
tifies the container (the page) enclosing the object (the text box) that you’re
specifying. It then uses a reference form to separate a specific object (the second
text box) from all possible objects in the container.
REFERENCE FORMS
Objects in QuarkXPress can be referred to by six reference forms: index, ID,
name, range, relative position, or test. See the “Apple Events Terminology”
portion of the “Reference Materials” section of this document for an example
of how to use each reference form.
Index:
used to identify an ordered element in a container with an integer
number (for example, the first text box on a page).
Windows, text boxes, and picture boxes are numbered from front to back; lay-
outs are numbered from left to right. The left-most layout or front window is
always number [1]; the frontmost picture box or text box in the layout is always
number [1]. (The frontmost picture box or text box may change as you manip-
ulate and create other boxes.) Pages are numbered according to their absolute
page numbers rather than section page numbers.
As you create and insert objects in the hierarchy, the index reference form
for existing objects may change. For example, if you insert a text box before
“text box 1,” then “text box 1” becomes “text box 2.”
ID:
used to identify objects that have unique IDs. A unique ID is good for the
life of the layout.
Name:
used to identify objects that are named with a text string (for example,
a layout named “Ad Layout” by a user).
ABOUT THIS GUIDE
2
|
A GUIDE TO APPLE EVENTS SCRIPTING