2016

Table Of Contents
You can do everything from simple formatting tasks to complex database
p
ublishing with scripts. For example, you might have a script that alphabetizes
paragraphs or formats texts. You can also write a script to merge addresses from
a database into a QuarkXPress letter template. It’s even possible to produce an
entire catalog automatically by linking a QuarkXPress layout to a database of
pictures and text.
THE OBJECT MODEL
The Apple events object model is a message protocol that allows Mac OS appli-
cations to communicate. Messages built according to the object model consist
of events and objects, but can include data. Objects are distinct items in an
application, such as a text box. Events are the actions that objects are capable
of performing.
If you’re familiar with QuarkXPress, you understand that an application is com-
posed of objects. QuarkXPress layouts contain pages, pages contain text boxes,
text boxes contain text, and text has various styles associated with it. Each
object has specific capabilities. For example, a text box can be moved, resized,
copied, and linked to other boxes. A text box has item specifications that can
be changed (such as background color, number of columns, and text inset)
and it can contain formatted text.
OBJECTS
An object is a distinct item (in an application) that can be manipulated by an
Apple event. Objects are defined according to their class, properties, elements,
and the events they can respond to. QuarkXPress users are familiar with objects
such as layouts, pages, text boxes, picture boxes, and lines.
Object class:
Objects that share specific characteristics are categorized into object
classes. For example, all layouts belong to the “layout” object class.
Properties:
Properties are the characteristics shared by objects in the same object
class. For example, the object class for layout has properties such as file path,
name, print setup, and version.
Elements:
Elements are the objects directly accessible from within another
object. For example, a page is an element of a layout.
Events:
Events are the actions an object is capable of performing. Objects in
the same object class respond to the same events. For example, the set event
can be used to change the tool mode of all layouts.
QuarkXPress uses the layout and project object classes; however, the document
object class is included in the QuarkXPress dictionary for AppleScript, so scripts
that refer to documents should still operate correctly.
INTRODUCTION
A GUIDE TO APPLE EVENTS SCRIPTING | 1