Quark Apple Events Scripting User Manual

A Guide to Apple Events Scripting

A Guide to Apple Events Scripting
ntroduction 1
I
About this Guide 1
What You Need 1
Scripting Overview 2
Introduction to Apple Events 2
The Object Model 3
Script Writing Syntax 9
Script Writing Sample 11
The Layout Construction Script 12
Breakdown of the Layout Construction Script 19
Definitions and Examples — Apple Events Terminology 33
Format 34
Object Reference Forms 34
II |
Insertion Points in the Hierarchy 35
Definitions and Examples — Events Supported by QuarkXPress 35
Standard Suite 35
Word Filter Suite 39
Miscellaneous Suite 40
QuarkXPress Suite 40
Data Coercion Chart 41
Data Coercion Using the AppleScript Dictionary 42
Events, Objects, and Parameters 42
Elements and Properties 43
Inherited Properties 43
Reference Material for QuarkXPress Objects 44
Application Events and Examples 44
Application Elements and Reference Forms 44
TA BL E OF C ONTENTS
Application Properties, Data Types, and Descriptions 45
Project Events and Examples 48
Project Elements and Reference Forms 48
Project Properties, Data Types, and Descriptions 49
Layout Space Events and Examples 50
Layout Space Elements and Reference Forms 50
Layout Space Properties, Data Types, and Descriptions 51
Window Events and Examples 57
Window Elements and Reference Forms 57
Selection Object Properties, Data Types, and Descriptions 58
Character Events and Examples 58
Line Events and Examples 61
Line Elements and Reference Forms 61
Line Properties, Data Types, and Descriptions 61
Paragraph Events and Examples 63
Paragraph Elements and Reference Forms 64
Paragraph Properties, Data Types, and Descriptions 64
Story Events and Examples 68
Story Elements and Reference Forms 68
Story Properties, Data Types, and Descriptions 68
Text Events and Examples 71
Text Elements and Reference Forms 71
Text Properties, Data Types, and Descriptions 72
Word Events and Examples 74
Word Elements and Reference Forms 74
Word Properties, Data Types, and Descriptions 75
III
|
TABLE OF CON TE NT S
Open Type Style Record Properties, Data Types, and Descriptions 77
Menu Events and Examples 77
Menu Elements and Reference Forms 78
Menu Properties, Data Types, and Descriptions 78
Character Spec Events and Examples 78
Character Spec Elements and Reference Forms 78
Character Spec Properties, Data Types, and Descriptions 78
Color Spec Elements and Reference Forms 80
Color Spec Properties, Data Types, and Descriptions 80
Color System Events and Examples 81
Color System Elements and Reference Forms 81
Color System Properties, Data Types, and Descriptions 81
Table Column Events and Examples 82
Table Column Elements and Reference forms 82
Table Column Properties, Data Types, and Descriptions 82
Table Row Events and Examples 82
Table Row Elements and Reference forms 82
Table Row Properties, Data Types, and Descriptions 83
Horizontal Gridline Events and Examples 83
Horizontal Gridline Properties, Data Types, and Descriptions 83
Vertical Gridline Events and Examples 84
Vertical Gridline Properties, Data Types, and Descriptions 84
Contour Events and Examples 84
Contour Elements and Reference Forms 85
IV
|
TA BL E OF C ONTENTS
Shape Path Events and Examples 85
Shape Path Elements and Reference Forms 85
Shape Path Properties, Data Types, and Descriptions 85
Default Document Events and Examples 85
Default Document Properties, Data Types, and Descriptions 86
Delimit Item Events and Examples 91
Delimit Item Elements and Reference Forms 91
Delimit Item Properties, Data Types, and Descriptions 92
Delimit Table Events and Examples 92
Delimit Table Elements and Reference Forms 92
Delimit Table Properties, Data Types, and Descriptions 92
Fontset Spec Events and Examples (East Asian Only) 93
Fontset Spec Elements and Reference Forms (East Asian Only) 93
Fontset Spec Properties, Data Types, and Descriptions (East Asian only) 93
Generic Box Events and Examples 94
Generic Box Elements and Reference Forms 94
Generic Box Properties, Data Types, and Descriptions 94
Generic Cell Events and Examples 97
Generic Cell Properties, Data Types, and Descriptions 97
Graphic Box Events and Examples 98
Graphic Box Elements and Reference Forms 99
Graphic Box Properties, Data Types, and Descriptions 99
V
|
TABLE OF CON TE NT S
Graphic Cell Events and Examples 102
Graphic Cell Properties, Data Types, and Descriptions 102
Group Box Properties, Data Types, and Descriptions 103
H and J Spec Events and Examples 103
H and J Spec Elements and Reference Forms 104
H and J Spec Properties, Data Types, and Descriptions 104
Image Events and Examples 105
Image Elements and Reference Forms 105
Image Properties, Data Types, and Descriptions 106
Layer Events and Examples 108
Layer Elements and Reference Forms 108
Layer Properties, Data Types, and Descriptions 109
Line box Events and Examples 109
Line box Elements and Reference Forms 109
Line box Properties, Data Types, and Descriptions 110
Master Layout space Events and Examples 113
Master Layout space Elements and Reference Forms 113
Master Layout space Properties, Data Types, and Descriptions 114
Page Events and Examples 120
Page Elements and Reference Forms 120
Page Properties, Data Types, and Descriptions 121
Clipping Path Events and Examples 122
Clipping Path Elements and Reference Forms 122
Clipping Path Properties, Data Types, and Descriptions 122
VI
|
TA BL E OF C ONTENTS
Picture Box Events and Examples 122
Picture Box Elements and Reference Forms 123
Picture Box Properties, Data Types, and Descriptions 123
Picture Cell Events and Examples 126
Picture Cell Elements and Reference Forms 126
Picture Cell Properties, Data Types, and Descriptions 126
Spread Events and Examples 127
Spread Elements and Reference Forms 127
Spread Properties, Data Types, and Descriptions 128
Style Spec Events and Examples 128
Style Spec Elements and Reference Forms 128
Style Spec Properties, Data Types, and Descriptions 129
Table Box Events and Examples 130
Table Box Elements and Reference forms 130
Table Box Properties, Data Types, and Descriptions 130
Text Box Events and Examples 133
Text box Elements and Reference Forms 133
Text box Properties, Data Types, and Descriptions 134
Text Cell Events and Examples 138
Text Cell Elements and Reference Forms 139
Text Cell Properties, Data Types, and Descriptions 139
Text Style Range Events and Examples 140
Text Style Range Elements and Reference Forms 141
Text Style Range Properties, Data Types, and Descriptions 141
Vertex Events and Examples 144
Vertex Elements and Reference Forms 144
Vertex Properties, Data Types, and Descriptions 144
|
VII
TABLE OF CON TE NT S
Vertical Guide Events and Examples 145
Vertical Guide Elements and Reference Forms 145
Vertical Guide Properties, Data Types, and Descriptions 145
Xtension Events and Examples 146
Xtension Elements and Reference Forms 146
Custom Bleeds Setup Properties, Data Types, and Descriptions (Requires Custom Bleeds QuarkXTensions Software) 146
Blend Record Events and Examples 147
Blend Record Elements and Reference Forms 147
Blend Record Properties, Data Types, and Descriptions 147
Fixed Point Properties, Data Types, and Descriptions 147
Fixed Rectangle Properties, Data Types, and Descriptions 147
Font Record Properties, Data Types, and Descriptions 148
Frame Record Properties, Data Types, and Descriptions 148
Justification Record Properties, Data Types, and Descriptions 149
OPI Setup Record Properties, Data Types, and Descriptions(Requires OPI QuarkXTensions software) 150
OPI Setup object 150
Print Setup record Properties, Data Types, and Descriptions 150
Rule Record Properties, Data Types, and Descriptions 152
Tab Record Properties, Data Types, and Descriptions 153
Glossary
VIII
|
TA BL E OF C ONTENTS
INTRODUCTION
This guide provides information about Apple®events scripting with
uarkXPress
Q are identified as such.
ABOUT THIS G UIDE
This document is for people who are ready to create scripts that communicate with QuarkXPress. If you need assistance writing or debugging scripts, consult the documentation provided with your scripting application and the scripting forums on the online services. Quark also provides additional online scripting support (Forum: scriptsupport@quark.com).
To learn more about Apple events scripting, you may want to purchase a third-party book such as The
Dummies,
exist, some of which include scripting software. You can also visit
www.apple.com to find electronic resources and URLs for Apple events script-
ing.
WHAT YOU NEE D
To write scripts, you need the following:
• Mac OS
®
X or later.
• A scripting application such as AppleScript
• The documentation (included with your scripting application) that teaches you the scripting language. You should familiarize yourself with the scripting language before attempting to write scripts for QuarkXPress.
• A basic understanding of programming (including concepts such as loops, conditional processing, if-then-else constructs, and variables) gained through writing HyperTalk scripts or macros, or working in programming languages such as C, BASIC, Java
®
Apple event properties that are specific to East Asian features
.
www.quark.com/service/forums/, and e-mail:
AppleScript Handbook, AppleScript for
or
AppleScripting QuarkXPress.
, or Pascal.
Many other third-party books
®
.
To run AppleScript scripts that communicate with QuarkXPress, you must have Script XTensions refer to
A Guide to QuarkXPress 2016
®
software loaded. For information about this software,
.
|
IX
INTRODUCTION
Script XTensions software is not required to run scripts that communicate with
ersions of QuarkXPress prior to QuarkXPress 5.0.
v
A basic understanding of programming is optional. AppleScript is a relatively easy language to learn. You can begin by writing basic scripts, and add to them when your understanding of the language is more advanced.
WH AT THIS G UIDE PR OVI DE S
This guide provides background information on Apple events, an analysis of a sample script, and specific information about writing scripts for QuarkXPress. If you are unfamiliar with Apple events terminology, read the chapters sequentially and refer to the glossary as necessary.
SCRIPTING OV ERVIE W
This section provides an overview of Apple events scripting with QuarkXPress. First, it introduces the concepts and terminology involved, including: the object model, objects, object hierarchy, object references, reference forms, insertion points in the hierarchy, events, suites, and the QuarkXPress object hierarchy. You should understand these concepts and terms before you attempt to write scripts for QuarkXPress.
The second part of this section provides information on optimizing the performance of scripts.
INTRODUCTION TO A PPLE EVENTS
Apple events, a Mac OS feature, allows interapplication communication on a local system or across a network. Applications communicate through standard Apple events messages that give instructions, respond to instructions, and send or receive data. The terminology for Apple events messages is listed in the Apple Events Registry for each application, which is maintained by Apple.
SC RI PTS
Apple events can be generated by scripts, which are a series of statements sent to applications that tell them to do a series of tasks. The scripting language is provided by scripting software such as AppleScript. Scripts combine the scripting language syntax with the standard Apple events terminology defined in the Apple Events Registry.
SY ST EM-LE VE L SCR IP TIN G
Scripting software is developed specifically for script writing. It is more powerful than scripting systems built into applications because it allows you to use one scripting language to write scripts for any application that supports Apple events. You can even write scripts to link applications that are Apple events-aware.
X
|

IN TR OD UC TION

You can do everything from simple formatting tasks to complex database
ublishing with scripts. For example, you might have a script that alphabetizes
p 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 M ODEL
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.
OB JE CTS
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.
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 1
ABOUT THIS G UI DE
OB JE CT HI ER ARCHY
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.
OB JE CT RE FE RENCE S
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.
RE FE RENCE F ORMS
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).
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
2
|
SC RI PT IN G OVERVIEW
Range:
used to identify a range of objects (for example, text boxes three
through five).
Relative Position:
used to identify objects that are before or after other
objects (for example, the text box before the last text box on the page).
Test:
used to identify objects that meet certain conditions, (for example, the first
• text box with a red background).
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 3
SCRIPTING OV ER VI EW
IN SE RTION P OINTS I N T HE H IER AR CH Y
An insertion point specifies where to place an object within the container hierarchy. For an example of how to use each insertion point, see the “Apple Events Terminology” portion of the “Reference Materials” section of this document.
Beginning:
fied container (for example, to create a text box at the beginning of page one).
Ending:
(for example, to create a page at the end of a layout).
After:
to move the first page of a layout after the fourth page).
Before:
to move the last page of a layout before the first page).
Replace:
ple, to replace one text box with another text box).
EV EN TS
Events are the actions that an object is capable of performing. In an English sentence, an event is com parable to a verb and an object is comparable to a noun. Events are used to tell objects what to do. QuarkXPress uses most of the standard events defined by Apple.
Used to insert or create an object at the beginning of the speci-
Used to insert or create an object at the end of the specified container
Used to insert or create an object after a specified object (for example,
Used to insert or create an object before the specified object (for example,
Used to replace the specified object with a new object (for exam-
SU IT ES
Groups of events and objects that relate to a similar purpose are arranged in suites. The Required Suite, Standard Suite, and Miscellaneous Standards Suite include the events and objects that most Mac OS applications support. In addition, events and objects specific to QuarkXPress are defined in the Custom Bleeds Suite, the QuarkCMS Suite, the Layers Suite, the OPI Setup Record Suite, the QuarkXPress Suite, the QuarkXPress Ancillary Objects Suite, the Table Suite, the Text Suite, and the Word Filter Suite.
QuarkXPress supports the events and objects in the Required, Standard, Miscellaneous, and QuarkXPress Suites, as well as objects in the Custom Bleeds Suite, the CMS Suite, the Layers Suite, the OPI Setup Record Suite, the QuarkXPress Ancillary Objects Suite, the Table Suite, the Text Suite, and the Word Filter suite. An object can respond to events from a variety of suites, and events can apply to objects from a variety of suites. For example, objects in the QuarkXPress Suite are generally manipulated using events in the Standard Suite.
RE QU IRED SU ITE
Events:
All of the events in the Required Suite are handled by events in the
Standard Suite.
Objects:
The Required Suite does not define any objects.
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
4
|
SC RI PT IN G OVERVIEW
ST AN DARD SU ITE
Events:
The Standard Suite events are common to most applications: duplicate, close, count, make, data size, delete, exists, get, move, open, print, save, set, and quit.
Objects:
The Standard Suite objects are common to most applications:
application, document, file, insertion point, selection object, and window.
MI SC ELLAN EO US ST AN DAR DS S UIT E
Events:
The Miscellaneous Standards Suite events are related to the Clipboard and other menu-related functions: copy, cut, do script, paste, revert, show, and select.
Objects:
The only objects in the Miscellaneous Suite are those related to menus:
menu and menu item.
CU ST OM BL EE DS SU IT E
Events:
Objects:
The Custom Bleeds Suite does not define any events.
The custom bleeds setup object encapsulates custom bleeds settings.
The events defined by the Custom Bleeds Suite is only available if Custom Bleeds XTensions software is running.
CM S SUITE
Events:
Objects:
The CMS Suite does not define any events.
The print setup record object encapsulates an output setup (for use
in color management).
LA YE RS SU IT E
Events:
Objects:
The Layers Suite includes the merge event, for merging layers.
The layer object represents a layer. The Layers Suite also adds layer­related elements and properties to document, generic box, layout space, page, and table box objects.
OP I SETUP R ECORD SU ITE
Events:
Objects:
The OPI Setup Record Suite does not define any events.
The OPI setup object encapsulates OPI settings for print output. The OPI
Setup Record Suite also adds the OPI swap object to the picture box object.
The events defined by the OPI Setup Record Suite is only available if OPI XTensions software is running.
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 5
SCRIPTING OV ER VI EW
QU AR KXPRE SS SUIT E
Events:
Objects:
• spec, clipping path, color spec, color system, contour, default document, delimit item, delimit table, generic box, graphic box, group box, h and j spec, horizontal guide, image, line box, layout space, master layout space, page, picture box, project, runaround path, shape path, spread, style spec, text box, text style range, user box, vertex, vertical guide, and xtension.
QU AR KXPRE SS ANCI LL ARY O BJ ECT S
Events:
Objects:
• for inheritance, returned as records, or data types: base class, box properties, blend record, character properties, containing box properties, fixed point, fixed rectangle, font record, frame record, justification record, non containing box properties, open type style record, paragraph properties, print setup record, rule record, tab record, text container properties, text path properties, text properties, and text and paragraph properties.
QU AR KXPRE SS TERM S AND O BJ ECT S
The “Definitions and Examples” section of this document provides definitions and sample syntax for each event that QuarkXPress supports. The AppleScript dictionary defines each event and object that QuarkXPress supports. The follow­ing objects in the hierarchy are not familiar QuarkXPress terms. Their properties are defined fully in the AppleScript dictionary.
The QuarkXPress Suite includes two events: coerce and do updates.
The QuarkXPress Suite objects are specific to the application: character
The QuarkXPress Ancillary Objects Suite does not include any events.
The QuarkXPress Ancillary Objects Suite contains objects that are used
• Color systems: the color models that QuarkXPress supports.
• Contour: a continuous path. Shape paths, clipping paths, and runaround paths are made up of contours. For instance, if you had a Bézier element in the shape of a bagel, you would have two contours: one contour for the outside shape and one contour for the inside shape.
• Default document: the object that contains all default layout settings including colors, style sheets, hyphenation and justification specifications (H&Js), layout settings specified in the New Layout dialog box, and all layout-related preferences.
• Delimit item: each character has an associated delimit item that QuarkXPress uses to determine whether a character should be part of a word.
• Delimit table: a container for 256 “delimit items.”
• Generic box: any type of box on a page. Use generic box if you want to change the properties of a box in a specific location, regardless of what type of box it is.
• Group box: An item that consists of a group of boxes. A group box can be either a “true” group, for example, boxes that have been grouped, or it can be a selection of multiple boxes.
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
6
|
SC RI PT IN G OVERVIEW
• Insertion point: The location where new text will be entered; identified by the text insertion point icon i.
• Master layout: A container for master pages. The master layout allows access to master pages and master page objects.
• Path: A path is a Bézier element, and can be either a shape path, clipping path, or a runaround path.
• Text style range: A range of text with a single set of styles specified. Use text style range for functions such as Find/Change.
• User box: A user box is a box that is created by an XTensions module to serve a specific purpose.
• Vertex: A vertex is a point on a Bézier line. A vertex is defined by its position, and can be modified by its anchor point or handles.
TA BL E SUI TE
Events:
Objects:
The Table Suite does not define any events.
Table column, generic cell, horizontal gridline, graphic cell, picture cell,
table row, table box, text cell, and vertical gridline.
TE XT SUIT E
Events:
Objects:
The Text Suite does not define any events.
The Text Suite objects are the text-related objects common to most
applications: character, line, paragraph, story, text, text style info, and word.
WO RD FILT ER SUIT E
Events:
Objects:
The Word Filter Suite events are export and import.
The Word Filter Suite does not define any objects.
The events defined by the Word Filter Suite is only available if the MS-Word filter is running.
QU AR KXPRE SS OBJE CT HI ER AR CHY
When you create a layout in QuarkXPress, you are working within the QuarkXPress object hierarchy. At the application level, you set default values and create layouts. At the layout level, you create pages, spreads, style sheets, colors, and hyphenation and justification specifications. You then add picture boxes and images, text boxes and text, and line boxes at the page level.
QU AR KXPRE SS SCRI PT ING C ON TAI NM EN T H IE RARCH Y OB JE CT LIM IT ATION S
The Apple events implementation in QuarkXPress does not currently support the following:
• Long-document features: Books, libraries, lists, indexing, and section page numbers
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 7
SCRIPTING OV ER VI EW
• Text: Editing auxiliary dictionaries and hyphenation exceptions
• Pictures: Editing clipping paths
• Items: Merge/split functions, box creation default settings, and anchored boxes
• Color and printing: Multi-Ink colors, Hexachrome the PPD Manager
• XTensions Manager and most QuarkXTensions®software distributed by Quark
Apple events are supported by some third-party XTensions software, including XData and BeyondPress. Future versions of QuarkXPress may support the objects listed above. This document will be updated and distributed with new versions of QuarkXPress as necessary.
SCRIPT WRITI NG SY NTAX
To write a script, you need to learn the scripting language of the scripting application. Scripts combine events, objects, properties, and data in the order specified by the scripting language. AppleScript syntax is similar to the English language.
SA MP LE AP PL ESCRI PT SY NT AX
EVENT PROPERTY OBJEC T DATA
set the color of text box 1 to “Red”
set the runaround of picture manual
box 5 to
®
colors, print styles, and
SP AC ES
In AppleScript, you can use the names of all objects and properties as shown in the AppleScript dictionary. AppleScript is not case-sensitive.
QU OT ATION M ARKS
In AppleScript, you should enclose data in straight quotation marks and use typographer’s quotation marks as foot and inch marks. For example, to specify six inches, use “6” rather than "6" or '6'. You can also use a back slash to precede a straight quotation mark when indicating feet or inches. For example, to specify six inches, you can use "6\"". The back slash can be used any time you want to tell AppleScript that the following character is not to be used as a control character.
OPTIMIZING T HE PE RFORMANCE OF SCRIP TS
These suggestions, and any techniques advocated by your scripting software, will help you write more efficient scripts.
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
8
|
SC RI PT IN G OVERVIEW
PR OC ESS I N QUARK XP RES S
Allow QuarkXPress to do calculations using its own built-in functions, and minimize context switches between QuarkXPress and the scripting application. For example, to set the color of all generic boxes to red:
DO
set the color of every generic box to "Red"
DO N’ T
set numberOfBoxes to count of generic boxes
repeat with i from 1 to numberOfBoxes
set color of generic box i to "Red"
end repeat
To change the color of all green generic boxes to red:
DO
set color of every generic box whose color equals "Green" to "Red"
DO N’ T
set numberOfBoxes to count of generic boxes
repeat with i from 1 to numberOfBoxes
if name of color of generic box i equals "Green" then set color of generic box i to "Red"
end repeat
SP EC IFY I NI TIAL PR OPE RT IE S W HE N PER FO RMING A MAKE E VENT
Use the
make
event to specify initial properties rather than using subsequent
set
events. You can also set multiple properties. In AppleScript, you specify the initial properties within the make statement.
DO
make picture box at beginning of last page with properties
{rotation:90,color:"Cyan",shade:80}
Set multiple properties:
DO
tell layout space 1 of project 1
set properties of picture box 1 to {rotation:90,color:"Cyan",shade:80}
end tell
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 9
SCRIPTING OV ER VI EW
DO N’ T
tell page 1 of layout space 1 of project 1
tell picture box 1
set rotation to 90
set color to "Cyan"
set shade to 80
end tell
end tell
CO MP ILE S CR IPTS
Using the where it is pro cessed completely within the application before anything appears on-screen.
Add the following lines to AppleScript scripts to have them automatically compile and execute within QuarkXPress:
script theRealScript
tell application "QuarkXPress"
do
script event sends a compiled script directly to QuarkXPress
--the script goes here
end tell
end script
tell application "QuarkXPress"
do script {theRealScript}
end tell
SCRIPT WRITI NG SA MPLE
To illustrate how scripts interact with QuarkXPress objects, we have dissected a script that uses a representative sample of the objects that QuarkXPress sup­ports. The breakdown discusses creating objects, specifying initial properties, and chang ing properties. In addition, the various aspects of the scripting environment, including suites, events, the object model, the object hierarchy, and object references, are discussed in the context of the objects in this script. You can apply similar syntactical constructs to other objects in other scripts.
The sample script, “Layout Construction,” written in AppleScript, illustrates how Apple events control objects within QuarkXPress. The script sets guides, makes text and picture boxes, imports text and images, then specifies the properties of these objects and their elements to produce a final layout.
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
10
|
SC RI PT IN G OVERVIEW
THE LAYOUT C ONSTR UCTION SCRIPT
Before reading this section, run the “Layout Construction” AppleScript script to familiarize yourself with its actions. The script and the files it requires are in the “Apple Events Scripting” folder within the “Documents” folder inside the QuarkXPress application folder.
AP PL ESCRI PT SYNT AX : L AY OU T C ON ST RUC TI ON SC RI PT
tell application "QuarkXPress"
activate
try
set thepath to (choose folder with prompt "Choose Sample " &
"Documents folder in Documents:Apple Events Scripting:")
as text
tell default document 1
set oldHeight to page height
set oldWidth to page width
set oldAutoTextBox to automatic text box
set oldGuidesShowing to guides showing
set oldGruidesFront to guides in front
set xDocMeasure to horizontal measure
set yDocMeasure to vertical measure
set page height to "30 cm"
set page width to "34 cm"
set automatic text box to false
set guides showing to true
set guides in front to true
set horizontal measure to centimeters
set vertical measure to centimeters
end tell
make new project at beginning
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 11
SCRIPT WRITI NG S AM PL E
tell default document 1
set page height to oldHeight
set page width to oldWidth
set automatic text box to oldAutoTextBox
set guides showing to oldGuidesShowing
set guides in front to oldGruidesFront
set horizontal measure to xDocMeasure
set vertical measure to yDocMeasure
end tell
tell layout space 1 of project 1
set view scale to fit page in window
end tell
--CREATE GUIDES TO LAYOUT ELEMENTS ON THE PAGE
tell page 1 of layout space 1 of project 1
make horizontal guide at beginning with properties
{position: "3.875 cm"}
make horizontal guide at end with properties
{position: "8.447 cm"}
make horizontal guide at beginning with properties
{position: "27.152 cm"}
make vertical guide at end with properties {position:"2 cm"}
make vertical guide at end with properties
{position:"4.962 cm"}
make vertical guide at end with properties
{position:"18.742 cm"}
make vertical guide at end with properties {position:"32 cm"}
end tell
--CREATE FIRST TEXT BOX
tell page 1 of layout space 1 of project 1
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
12
|
SC RI PT W RI TING SAMPLE
set HeadlineBox to make text box at beginning with properties
{bounds:{"3.875 cm", "4.962 cm", "8 cm", "18.742 cm"}}
tell text box 1
set vertical justification to bottom justified
set color to "none"
end tell
end tell
tell story 1 of HeadlineBox
set contents of it to "Biking Gear"
set font to "Times"
set size of word 1 to 30
set style of word 1 to all caps
set base shift of word 1 to 60
set track of word 1 to 50
set kern of last character of word 1 to -100
set size of word 2 to 120
set color of word 2 to "Blue"
set style of word 2 to italic
set kern of character 1 of word 2 to -5
set kern of character 2 of word 2 to -5
end tell
--CREATE SECOND TEXT BOX
tell page 1 of layout space 1 of project 1
set BodyCopyBox to make text box at end with properties
{bounds:{"8.5 cm", "5 cm", "29.959 cm", "18.472 cm"}}
tell BodyCopyBox
try
set story 1 to alias (thepath & "ASB Text")
on error
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 13
SCRIPT WRITI NG S AM PL E
set story 1 to (choose file with prompt "Please select
end try
set size of story 1 to 11
set leading of every paragraph of story 1 to 43
set justification of every paragraph of story 1 to full
set font of story 1 to "Times"
end tell
tell paragraph 1 of story 1 of text box 2
set drop cap characters to 1
set drop cap lines to 3
set color of character 1 of word 1 to "Blue"
end tell
tell last paragraph of story 1 of text box 2
set color of character 1 of word 1 to "Blue"
the file \"ASB Text.\"" of type {"TEXT"})
set size of character 1 of word 1 to 28
set rule on of rule above to true
set text length of rule above to false
set width of rule above to 0.5
set position of rule above to "1 cm"
set color of rule above to "Cyan"
set shade of rule above to 100
end tell
end tell
--CREATE FIRST PICTURE BOX
tell page 1 of layout space 1 of project 1
make picture box at beginning with properties
{bounds:{"11.886 cm", "21.79 cm", "29.136 cm",
"34.54 cm"}, color:"None"}
tell picture box 1
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
14
|
SC RI PT W RI TING SAMPLE
set rotation to -25
try
set image 1 to alias (thepath & "Shirts.TIFF")
on error
set image 1 to (choose file with prompt "Please select the
file \"Shirts.TIFF.\"" of type {"TIFF"})
end try
tell image 1
set scale to {"115", "115"}
end tell
end tell
end tell
--CREATE SECOND PICTURE BOX
tell page 1 of layout space 1 of project 1
make picture box at beginning with properties {bounds:
{"8.447 cm", "18.742 cm", "14.301 cm", "26.747 cm"}, color:"None", runaround:none runaround}
tell picture box 1
try
set image 1 to alias (thepath & "Helmet.TIFF")
on error
set image 1 to (choose file with prompt "Please select" &
"the file \"Helmet.TIFF\"" of type {"TIFF"})
end try
tell image 1
set scale to {"74", "74"}
set offset to {"0.557 cm", "1.254 cm"}
end tell
end tell
end tell
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 15
SCRIPT WRITI NG S AM PL E
--CREATE THIRD PICTURE BOX
tell page 1 of layout space 1 of project 1
make picture box at end with properties {bounds:
{"8.471 cm", "2 cm", "9.971 cm", "3.5 cm"}, color:"None"}
tell picture box 3
try
set image 1 to alias (thepath & "Glove.TIFF")
on error
set image 1 to (choose file with prompt "Please select the
end try
set bounds of image 1 to exact fit
end tell
duplicate picture box 3 to after picture box 3
tell picture box 4
file \"Glove.TIFF.\"" of type {"TIFF"})
set bounds to {"12.471 cm", "2 cm", "13.971 cm", "3.5 cm"}
end tell
duplicate picture box 4 to after picture box 4
tell picture box 5
set bounds to {"16.471 cm", "2 cm", "17.971 cm", "3.5 cm"}
end tell
duplicate picture box 5 to after picture box 5
tell picture box 6
set bounds to {"20.471 cm", "2 cm", "21.971 cm", "3.5 cm"}
end tell
end tell
--CREATE LINES
tell page 1 of layout space 1 of project 1
make line box at end with properties {left point:
{"0 cm", "21.406 cm"}, right point:{"8 cm", "21.406 cm"}}
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
16
|
SC RI PT W RI TING SAMPLE
tell line box 1
set color to "Magenta"
set width to 3
set style to dotted
end tell
make line box at end
tell line box 2
set left point to {"8 cm", "2 cm"}
set right point to {"8 cm", "32 cm"}
set width to 0.5
end tell
end tell
set guides showing of layout space 1 of project 1 to false
try
save project 1 in (thepath & "Constructed Layout.qxp")
on error
set filePath to (choose file name with prompt "Where would you
like to save the file?" default name "Constructed Layout.qxp") as string
save project 1 in filePath
end try
beep 2
on error errmsg number errnum
if errnum ≠ -128 then
beep
display dialog errmsg & " [" & errnum & "]" buttons {"OK"}
default button 1 with icon stop
end if
-- For compatibility with non-US English operating systems
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 17
SCRIPT WRITI NG S AM PL E
return
end try
end tell
ABOUT THE SC RIPT BREAKDOWN
This section first discusses how to direct a script to QuarkXPress. The script is then divided into the steps a user would perform when constructing a layout. The steps include creating a new layout, creating a text box, importing text, for­matting the text, and so on. The script syntax is then displayed in the Courier font. Following the syntax is a concept line that translates the scripting language into actions in QuarkXPress. The events, objects, and properties set in the script are then analyzed line by line. The script breakdown follows this format:
A ST EP IN T HE LA YO UT CO NS TRU CT IO N P RO CESS
code
CO NC EPTS
The code above is described in terms of actions in QuarkXPress.
Each event, object, or property is discussed line by line.
BREAKDOWN OF THE LAYOUT CONSTRUCTIO N SCRIPT
LO CA TE TH E TERMI NO LOG Y FO R Q UA RK XPR ES S OBJ EC TS AN D E VENTS
tell application "QuarkXPress"
CO NC EPTS
This statement specifies the location of QuarkXPress terminology.
• Use the
tell
statement to identify which object is being addressed. Using this statement is necessary because certain actions and properties only apply to specific objects.
• In the remainder of this section, the previous format will be used to reference the location of items in AppleScript. The following formats will be used to reference the location of items:
application "QuarkXPress"
DE CL ARE T HE VARI AB LES C ON CEP TS
This statement declares local variables for the script.
Although it is not essential to declare local variables, it makes scripts much safer. Making variables local ensures that QuarkXPress table entries will not be altered inadvertently if they have the same name as a variable used in a script.
Declaring local variables is not required in AppleScript.
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
18
|
tell layout space 1 of project 1 of
.
SC RI PT W RI TING SAMPLE
AC TI VATE QU ARKXP RE SS
activate
CO NC EPTS
This statement is similar to choosing QuarkXPress from the QuarkXPress menu.
Activate
is a standard command used with AppleScript.
ES TA BLISH T HE PA TH
set thepath to (Choose folder with prompt "Select the Sample Documents folder inside the Apple Events Scripting folder of your QuarkXPress folder:") as text
CO NC EPTS
This statement establishes a path for sample text and image files that will be used later in the script.
• The AppleScript example uses the choose folder command, which displays an Open dialog box that you can use to specify the desired folder.
• This statement gives the variable thepath a string value that is the path to the location of the text and image files.
SA VE CURR EN T LAY OU T’S D EF AUL T SP ECI FI CA TIO NS
tell default document 1
set oldHeight to page height
set oldWidth to page width
set oldAutoTextBox to automatic text box
set oldGuidesShowing to guides showing
set oldGuidePos to guides in front
set xDocMeasure to horizontal measure
set yDocMeasure to vertical measure
CO NC EPTS
• The
tell
statement references the current default document by index [1]. (The default document is the object that contains all default layout settings including colors, style sheets, hyphenation and justification settings, layout settings specified in the New Layout dialog box, and all preferences.)
• AppleScript does not require that get be specified; get is assumed if it is not specified.
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 19
SCRIPT WRITI NG S AM PL E
SE T DEFAU LT SPEC IF ICA TI ON S F OR A NE W LAYOU T
set page height to "30 cm"
set page width to "34 cm"
set automatic text box to false
set guides showing to true
set guides in front to true
set horizontal measure to centimeters
set vertical measure to centimeters
end tell
CO NC EPTS
The first three set statements are similar to setting default specifications in the New Layout dialog box. The next set statement is similar to choosing Show Guides from the View menu. The last three statements are settings in the General pane of the Preferences dialog box.
• The first two
• The third box, depending on the Boolean operator. If the Boolean operator is layout will not have an automatic text box. If the Boolean operator is
set
events specify the page height and page width properties.
set
event determines whether the layout will have an automatic text
false
, the
true
it will.
• The fourth ing on the Boolean operator. If the Boolean operator is display. If the Boolean operator is
• The fifth page elements. The
set
event determines whether the layout will display guides, depend-
true
, all guides will
false
, all guides will be hidden.
set
event determines whether the guides will display in front of the
true
Boolean operator indicates that the guides will display
in front.
set
• The last two
events specify the default horizontal and vertical measurement
system as centimeters.
CR EA TE A NE W LAY OU T W IT H DEF AU LT SP EC IFICA TI ONS
make new project at end
CO NC EPTS
This
make
event is similar to clicking OK in the New Layout dialog box.
• The first parameter, layout, refers to the object that will be created.
• You can make an object at any insertion point: beginning, ending, after, before, or replace. However, layouts are always created at the end.
,
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
20
|
SC RI PT W RI TING SAMPLE
SE T THE V IE W SCA LE
tell layout space 1
set view scale to fit page in window
end tell
CO NC EPTS
The lines above are similar to choosing Fit in Window from the View menu for the active layout.
• The
tell
statement references the left-most layout space.
set
• The
event changes the view scale property to the data
fit page in window
The view scale property can be a percentage or specific view. For example, to specify 100% view, use use
thumbnails
for the second parameter.
100
for the second parameter. To specify thumbnails,
CR EA TE GU ID ES
tell page 1 of layout space 1 of project 1
make horizontal guide at beginning with properties {position:"4.218 cm"}
make horizontal guide at end with properties {position:"8.447 cm"}
.
make horizontal guide at end with properties {position:"27.152 cm"}
make vertical guide at end with properties {position:"2 cm"}
make vertical guide at end with properties {position:"4.962 cm"}
make vertical guide at end with properties {position:"18.742 cm"}
make vertical guide at end with properties {position:"32 cm"}
end tell
CO NC EPTS
The
make
events above simulate clicking the horizontal and vertical rulers to
create guides, and then dragging the guides into position.
• The
tell
statement references the layout by index [1]. The index value [1]
refers to the left-most layout space.
• Each
make
event makes a horizontal guide or vertical guide. The guides are
created with the properties specified in the properties record.
• The first guide is created at the beginning of page 1 in the object hierarchy according to the fourth parameter. Subsequent guides are created at the end of page 1.
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 21
SCRIPT WRITI NG S AM PL E
CR EA TE TH E FIRST T EXT B OX
tell page 1 of layout space 1
make text box at beginning with properties {bounds:{"2 cm", "5 cm", "8 cm", "19 cm"}}
CO NC EPTS
The lines above are similar to creating a text box with the rectangular Text Box tool, and then sizing and positioning it using the Measurements palette.
• The
tell
both are referenced by index [1].
• If you want to see an object after it is created (and while the script is running), add the line corner of the layout window.
EN TE R THE H EADLI NE IN TO A TE XT B OX
tell text box 1
set vertical justification to bottom justified
set color to "None"
end tell
statement references the first
show
or
show(it)
. This places the current object in the upper-left
page
of the left-most
layout space;
tell story 1 of text box 1 of page 1 of layout space 1
set contents of it to "Biking Gear"
end tell
CO NC EPTS
The statements above are similar to specifying a vertical alignment and back­ground color in the Text tab of the Modify dialog box, and then entering “Biking Gear” in the text box.
• The
tell
statement references the first text box by index [1].
set
• The next two
events change the vertical justification to bottom and the
background color to None.
• The
tell
statement references the story in the active text box; both are referenced by index [1]. (Only one story is possible per text box or chain of linked text boxes.)
• The
set
event specifies it(itrefers to the story, the last object referenced in
the
with
statement). The text “Biking Gear” is entered into the text box. It is then formatted with properties defined in the Normal style sheet for the default layout.
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
22
|
SC RI PT W RI TING SAMPLE
FO RM AT TH E HEADL IN E
set font to "Times"
set size of word 1 to 30
set style of word 1 to all caps
set base shift of word 1 to 60
set track of word 1 to 50
set kern of last character of word 1 to -100
set size of word 2 to 120
set color of word 2 to "Blue"
set style of word 2 to italic
set kern of character 1 of word 2 to -5
set kern of character 2 of word 2 to -5
end tell
CO NC EPTS
The set statements above are comparable to the Font, Size, Type Style, Color, Baseline Shift, Track, and Kern commands in the Style menu.
• The first
• The next four
set
event changes the font for the story to Times.
set
events reference the first word by index [1]. The size, text
style, baseline shift, and track properties of the word “Biking” are changed.
• The next
set
event references the last character of the first word; the character is referenced by relative position. The kern property is changed to –100. (To kern the space between two words, reference the last character of the first word.)
• The next three
set
events reference the second word by index [2]. The size,
color, and type style properties of the word “Gear” are changed.
• The last two
set
events reference the first and second character of the second word; all are referenced by index. The kern property of each character is changed to –5. (To kern a pair of characters, you only need to reference the first character.)
CR EA TE TH E SECON D TEX T BO X
tell page 1 of layout space 1
make text box at end with properties {bounds:{"8.5 cm", "5 cm", "29.959 cm", "18.472 cm"}}
end tell
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 23
SCRIPT WRITI NG S AM PL E
CO NC EPTS
The lines above are similar to creating a text box with the rectangular Text Box tool, and then sizing and positioning it using the Measurements palette.
LO CA TE AN D IMPOR T A T EX T FIL E
tell text box 2
try
set story 1 to alias (thepath & "ASB Text")
on error
set story 1 to (choose file with prompt "Please select the file
\"ASB Text\"" of type {"TEXT"})
end try
end tell
CO NC EPTS
The statements above are similar to locating and importing a text file in the Get Text dialog box.
• The
try
defined by of the “Breakdown of the Layout Construction Script” section of this document). If the file exists in this location, the replacing the story in the text box.
• If “ASB Text” does not exist in the location defined by continue with the if your hard drive and folders are named the same as those defined in
• The first parameter is a message to the user shown at the bottom of the dialog box, “Open the file named ‘ASB Text.’” The second parameter stores the path to the text file in an address — this path is used to import the text file. The third parameter is the signature for a text file (file type). Once the user locates the text file and clicks OK, the set event imports the text.
• If you want to open a QuarkXPress layout using the the signature would be “XDOC.” This limits the displayed files to QuarkXPress layouts. This is an optional parameter.
statement looks for the “ASB Text” file in the location previously
thepath
(see the “Establish the path” portion near the beginning
set
event imports the “ASB Text” file,
on error
thepath
statement. (The file will only be located by
, the script will
thepath
thepath
getFileDialog
script,
.)
FO RM AT TH E BODY CO PY
set size of story 1 to 11
set leading of story 1 to 43
set justification of story 1 to fully justified
set font of story 1 to "Times"
end tell
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
24
|
SC RI PT W RI TING SAMPLE
CO NC EPTS
The set statements above are comparable to choosing Font, Size, Leading, and Alignment from the Style menu.
The four set events reference the entire story by index [1]. The font, size, leading, and justification properties of the story are set.
CR EA TE A CO LORED D ROP C AP
tell paragraph 1 of story 1 of text box 2
set drop cap characters to 1
set drop cap lines to 3
set color of character 1 of word 1 to "Blue"
end tell
CO NC EPTS
The statements above are similar to checking Drop Cap in the Formats tab of the Paragraph Attributes dialog box. The color Blue is then applied to the drop cap character.
• The
tell
statement references the first paragraph of the story in the second
text box; the objects are all referenced by index.
• The first The second
• The third
set
event specifies that the first character will be a drop cap.
set
event specifies that it will be a three-line drop cap.
set
event references the drop cap, which is the first character of the first word; both are referenced by index [1]. The color property is changed to Blue.
CR EA TE AN I NITIA L CAP
tell last paragraph of story 1 of text box 2
set color of character 1 of word 1 to "Blue"
set size of character 1 of word 1 to 28
CO NC EPTS
The lines above are similar to creating a decorative initial cap with local formatting.
• The
tell
statement references the last paragraph of story in the second text box. The story and text box are referenced by index; the paragraph is referenced by relative position.
• The two
set
statements reference the first character of the first word; they are referenced by index. The color property is changed to Blue and the size property is changed to 28.
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 25
SCRIPT WRITI NG S AM PL E
SP EC IFY A R ULE A BO VE
set rule on of rule above to true
set text length of rule above to false
set width of rule above to 0.5
set position of rule above to "1 cm"
set color of rule above to "Cyan"
set shade of rule above to 100
end tell
end tell
CO NC EPTS
The set events above are comparable to settings in the expanded Rules tab of the Paragraph Attributes dialog box.
• The first above will be turned on (rule on). The
set
event uses a Boolean operator to determine if the paragraph’s rule
true
Boolean operator indicates that the
paragraph will have a rule above it.
• The second match the text length. The
set
event uses a Boolean operator to determine if the rule will
false
Boolean operator indicates that it will not match the length of the text. The rule will extend the width of the text box (minus any defined text inset).
• The last four
set
events specify the width, position, color, and shade properties
of the rule.
CR EA TE TH E FIRST P ICT UR E BOX
tell page 1 of layout space 1 of project 1
make picture box at beginning with properties {bounds:{"10.386 cm", "20.758 cm", "27.636 cm","33.508 cm"}, color:"None"}
CO NC EPTS
The lines above are similar to creating a picture box, sizing and positioning it, and then specifying a background color as you would in the Picture tab of the Modify dialog box.
The
tell
statement references the first page of the left-most layout; both are
referenced by index [1].
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
26
|
SC RI PT W RI TING SAMPLE
IM PO RT TH E FIRST P ICT UR E
tell picture box 1
set rotation to -25
try
set image 1 to alias (thepath & "Shirts.TIFF")
on error
set image 1 to (choose file with prompt "Please select the file
\'Shirts.TIFF\'." of type {"TIFF"})
end try
tell image 1
set scale to {115, 115}
end tell
end tell
end tell
CO NC EPTS
The statements above are similar to locating and importing an image file in the Get Picture dialog box (File menu).
• The
with
statement references the first picture box by index [1].
• The first
• The defined by
set
event specifies the rotation property of the picture box.
try
statement looks for the “Shirts.tiff” file in the location previously
thepath
. If the file exists in this location, the
set
event specifies “Shirts.tiff” as the image in the picture box. (A picture box can only have one image.)
• If “Shirts.tiff” does not exist in the location defined by continue with the
on error
statement. This statement handles error conditions
thepath
, the script will
by providing another set of instructions if an error occurs.
• The first string is a message to the user shown at the bottom of the dialog box, “Open the image named ‘Shirts.tiff.’” Once the user locates the image file and clicks OK, the set event imports the image.
• The second
tell
statement references the image by index [1].
CR EA TE TH E SECON D PIC TU RE BO X AN D I MP ORT A P ICTUR E
tell page 1 of layout space 1 of project 1
make picture box at end with properties {bounds:{"8.471 cm", "2 cm", "9.971 cm", "3.5 cm"}, color:"None"}
tell picture box 2
try
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 27
SCRIPT WRITI NG S AM PL E
set image 1 to alias (thepath & "Glove.TIFF")
on error
set image 1 to (choose file with prompt "Please select the file
\"Glove.TIFF\"." of type {"TIFF"})
end try
set bounds of image 1 to exact fit
end tell
CO NC EPTS
The first seven lines above are similar to creating a picture box, sizing and positioning it, and then specifying a background color as you would in the Picture tab of the Modify dialog box. The last six statements are similar to locating and importing an image file in the Get Picture dialog box.
• The
tell
referenced by index [1].
• The
make
tell
• The
try
• The defined by “Glove.tiff” as the image in the second picture box.
• If “Glove.tiff” does not exist in the location defined by continue with the by providing another set of instructions if an error occurs.
• The first string is a message to the user shown at the bottom of the dialog box, “Please select the file ‘Glove.tiff.’” Once the user locates the image file and clicks OK, the
• The last the image is set to exact fit.
statement references the first page of the active layout; both are
event makes a picture box using the specified properties.
statement references the second picture box by index [2].
statement looks for the “Glove.tiff” file in the location previously
thepath
set
. If the file exists in this location, the
on error
set
event imports the image.
statement. This statement handles error conditions
set
thepath
event specifies
, the script will
event references the image by index [1]. The bounds property of
CR EA TE AN D POSIT IO N C OP IE S O F TH E P IC TURE BO X
duplicate picture box 2 to after picture box 2
tell picture box 3
set bounds to {"12.471 cm", "2 cm", "13.971 cm", "3.5 cm"}
end tell
duplicate picture box 2 to after picture box 3
tell picture box 4
set bounds to {"16.471 cm", "2 cm", "17.971 cm", "3.5 cm"}
end tell
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
28
|
SC RI PT W RI TING SAMPLE
duplicate picture box 2 to after picture box 4
tell picture box 5
set bounds to {"20.471 cm", "2 cm", "21.971 cm", "3.5 cm"}
end tell
end tell
CO NC EPTS
The
duplicate
and
set
events above are similar to using the Step and
Repeat feature.
• The first
duplicate
event references the second picture box by index [2].
A copy of the picture box is placed after the second picture box.
• The first
set
statement sets numerical values for the picture box boundaries. The four parameters indicate how far from the top-left corner of the layout page the top, left, bottom, and right sides of the box will be positioned.
• The following lines use the object hierarchy to duplicate picture box 2 after picture box 3, then after picture box 4. Each new picture box is referenced by index and positioned.
Create the third picture box and import a picture
tell page 1 of layout space 1 of project 1
make picture box at end with properties {bounds:{"6.875 cm", "18.425 cm", "12.729 cm", "26.4 cm"},
color:"None"}
tell picture box 6
try
set image 1 to alias (thepath & "Helmet.TIFF")
on error
set image 1 to (choose file with prompt "Please select the file
\'Helmet.TIFF\'." of type {"TIFF"})
end try
tell image 1
set scale to {70, 70}
set offset to {"0.557 cm", "1.254 cm"}
end tell
end tell
end tell
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 29
SCRIPT WRITI NG S AM PL E
CO NC EPTS
The statements above are similar to creating a picture box and importing a picture. The properties are then specified with
• The
tell
referenced by index [1].
• The
make
• The second
• The four parameters indicate how far from the top-left corner of the layout page the top, left, bottom, and right sides of the box will be positioned.
• The background color property of the picture box is set to None in the
make
statement.
• The
try
defined by “Helmet.tiff” as the image in the second picture box.
• If “Helmet.tiff” does not exist in the location defined by continue with the by providing another set of instructions if an error occurs.
• The first string is a message to the user shown at the bottom of the dialog box, “Please select the file ‘Helmet.tiff.’” Once the user locates the image file and clicks OK, the
• The third event sets the offset property of the image in centimeters.
set
events.
statement references the first page of the left-most layout; both are
event makes a picture box using the specified properties.
tell
statement references the third picture box by index [3].
statement looks for the “Helmet.tiff” file in the location previously
thepath
set
. If the file exists in this location, the
on error
set
event imports the image.
statement. This statement handles error conditions
set
thepath
event specifies
, the script will
event sets the scale property of the image to 70%. The last
set
CR EA TE A VE RTICA L LIN E
tell page 1 of layout space 1 of project 1
make line box at end with properties (left point:{"0 cm", "21.406 cm"}, right point:{"8 cm", "21.406 cm"}}
tell line box 1
set color to "Magenta"
set width to 3
set style to dotted
end tell
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
30
|
SC RI PT W RI TING SAMPLE
CO NC EPTS
The statements above are similar to creating and positioning a vertical line with the Orthogonal Line tool + and choosing Color, Width, and Line Style from the Style menu.
• The
"tell"
statement references the first page of the left-most layout; both are
referenced by index [1].
• The
make
event makes a line box with the specified settings and in the specified
location, and specifies the left point and right point of the line in centimeters.
CR EA TE A HO RIZON TA L L IN E
make line box at end
tell line box 2
set left point to {"8 cm", "2 cm"}
set right point to {"8 cm", "32 cm"}
set width to 0.5
end tell
end tell
CO NC EPTS
The statements above are similar to creating and positioning a horizontal line with the Orthogonal Line tool + and choosing a Width from the Style menu.
• The
make
event makes a line box with the specified settings and in the
specified location.
• The next two
set
events specify the left point and right point of the line
in centimeters.
• The last
set
event sets the line width property of the line box to “0.5.” Line widths are set according to points, the default line measurement system in QuarkXPress.
HI DE GUID ES AND SA VE TH E LAY OU T
set guides showing of layout space 1 to false
save project 1 in (thepath & "Constructed Layout")
CO NC EPTS
The scripts above simulate choosing Hide Guides from the View menu and Save As from the File menu.
• The first
• The
set
event hides the guides by setting
save
event saves the project in
thepath
guides showing
with the name
to
false
“Constructed Layout.”
.
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 31
SCRIPT WRITI NG S AM PL E
RE SE T DEF AU LT SP EC IFI CA TI ONS F OR FU TU RE LA YO UTS
tell default document 1
set page height to oldHeight
set page width to oldWidth
set automatic text box to oldAutoTextBox
set guides showing to oldGuidesShowing
set guides in front to oldGuidePos
set horizontal measure to xDocMeasure
set vertical measure to yDocMeasure
end tell
end tell
CO NC EPTS
The
set
original specifications.
• The
tell
• Each
set
to the local variable. For example, the page height property is specified as the variable display, the guide locations, and the default measurement system are reset.
statements above replace the layout default specifications with your
statement references the current default document by index [1].
statement specifies a property of the default document according
oldHeight
. The original page size, automatic text box setting, guide
DEFINITIONS AND E XAMPLES — APP LE EV ENTS TERMINOLOGY
This section provides AppleScript definitions and examples for object references, insertion points, and each event that QuarkXPress supports.
Once you are familiar with the scripting language’s syntax, you should be able to write scripts for QuarkXPress by referring to the information in the AppleScript dictionary.
This section also includes definitions of object reference forms and insertion points, including descriptions of their usage and examples in AppleScript. The examples are taken from various scripts and are shown out of context.
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
32
|
SC RI PT W RI TING SAMPLE
FORMAT
Each event is listed with a description of its usage, a prototype in AppleScript, and any applicable possible values and results. The terms and events are shown in the following format:
TE RM OR E VE NT
Usage: description of when to use this term or event.
AppleScript prototype parameters in italics
Possible values:
variable
options
Result: result (for example, integer, text string, and so on)
OBJECT REFER ENCE FORMS
To communicate, an Apple event message must reference a specific object in an application. The reference first identifies the container enclosing the object you’re specifying. It then uses a reference form to separate a specific object from all possible objects in the container. The reference form can be defined by index, ID, name, range, relative position, or test.
IN DE X
Usage: to identify ordered elements in a container with an integer number.
set the kern of character 1 of word 2 to -14
ID
Usage: to identify objects that have a unique ID.
set color of text box id 7 to "Red"
NA ME
Usage: to identify named objects with a text string.
set runaround of picture box "Pear" to manual runaround
RA NG E
Usage: to identify a range of objects.
set color of words 2 through 5 to "Cyan"
RE LA TIVE PO SITIO N
Usage: to identify objects that are before or after other objects.
set the rotation of the picture box after picture box 2 to 45
TE ST
Usage: to identify objects that meet certain conditions.
set the color of (every word whose color = "Red") to "Blue"
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 33
DEFINITIONS AN D EX AM PL ES — A PP LE EVENTS TERMINOLOGY
INSERTION PO INTS IN THE HIERARCHY
An insertion point specifies where you want to place an object within the container hierarchy. As you create and insert objects in the hierarchy, the index reference form for existing objects may change.
AF TE R
Usage: to insert or create an object after a specified object (the specified object will not be the container). For example, use
after
in a story so that it follows the seventh paragraph.
move paragraph 1 to after paragraph 7
BE FO RE
Usage: to insert or create an object before the specified object (the specified object will not be the container). For example, use “before” to paste a copy of the fifth word before the first word in a sentence.
duplicate word 5 to before word 1
BE GI NNING
Usage: to insert or create an object at the beginning of the specified container. For example, use “beginning” to insert a word as the first word of a paragraph.
move word 1 to beginning of paragraph 1
to move the first paragraph
EN DI NG
Usage: to insert or create an object at the end of the specified container. For example, use “ending” to create a text box that is the last text box on the layout page.
make text box at end
DEFINITIONS AND E XAMPLES — EVE NTS S UPPORTED BY QUARKX PRESS
This section provides definitions and examples for object references, insertion points, and each event that QuarkXPress supports.
This section also covers the important events in the Suites supported by QuarkXPress: the Required, Standard, Miscellaneous, CMS, Custom Bleeds, Layers, OPI Setup Record, Text, Table, QuarkXPress, and Word Filter Suites.
STANDARD SUI TE
The Standard Suite consists of basic events most applications use to communicate.
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
34
|
DE FI NI TI ON S AN D EX AM PL ES — APPLE EVENTS TERMINOLOGY
CL OS E
Usage: to close a specified object and determine whether to save it.
Close
usually used for a window or layout.
close reference saving save options saving in alias
is
Possible values:
saving
: yes, no, ask
saving in
: alias
DU PL ICATE
Usage: to copy the data and properties of a specified object and create a new object with the same data and properties. You can specify an insertion point for the new object. (If you don’t specify a new insertion point, the new object is placed in the same container as the initial object, at the end of the container’s elements.)
Duplicate
is similar to
make
.
duplicate reference to insertion location
Possible values:to: location reference (See the “Apple Events Terminology”
section of this layout for insertion point information.)
Result: reference (to the duplicated object)
CO UN T
Usage: to determine how many elements of a particular class are contained in a specified object.
Count of object class in reference
Possible values:
each
: type class (any object class)
Result: integer
MA KE
Usage: to make a new element of an object. You can specify the type of object you want to make, set properties in the new object, and specify an insertion point.
make new object type at insertion location with data with properties {properties}
Possible values:
new
: type class (any object class)
at
: location reference (See the “Apple Events Terminology”
section of this layout for insertion point information.)
with data
: anything (the initial data for the element)
with properties
Results: Reference (to the new object)
: record
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 35
DEFINITIONS AN D EX AM PL ES — E VE NT S SUPPORTED BY QUARKXPRESS
DA TA SIZE
Usage: to obtain an object’s size in bytes.
data size reference as type
Possible values: as: type class
Result: integer
DE LE TE
Usage: to remove a specified element from an object or application.
delete reference
EX IS TS
Usage: to check for the existence of a specified object.
exists reference
Result: Boolean
GE T
Usage: to determine the data structure for an object. used to read and write an object’s internal data and properties, rather than the whole object.
get
and
set
are usually
Get reference
Result: the properties of the object you reference
GE T AS
Usage: to determine the data structure for an object in a specific data type.
Get property of reference as type
Possible values: as: data type (See the “Data Coercion Chart.”)
Result: the properties of the object you reference in the data type you specify
MO VE
Usage: to change an object’s position in an application’s container hierarchy. The specified object is moved from its current location to a specified insertion point. “Move” is not used to change the physical location of an object. To change the physical location, you would use
set
to change its properties.
Move reference to insertion location
Possible values:to: location reference (See the “Apple Events Terminology”
section of this layout for insertion point information.)
Result: reference (to the object in its new location)
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
36
|
DEFINI TI ON S AN D EX AM PL ES — EVENTS SUPPORTED BY QUARKXPRESS
OP EN
Usage: to open a specified object or file.
Open reference use doc prefs remap fonts do auto picture import with reflow
Possible values:
use doc prefs
remap fonts
:
yes, no, ask
:
no, ask
do auto picture import
reflow
:
with reflow, without reflow
:
yes, no, ask
PR IN T
Usage: to print a specified object.
print reference copies copies OPI OPI cover page cover page paper source paper source to alias plates list of plates print dialog
Possible values:
copies
: integer
cover page
OPI
paper source
plates
PostScript file
print dialog
: no, first page, last page
: omit TIFF, omit TIFF and EPS, include images
: paper cassette, manual feed
: a list of strings (names of process/spot color specs)
: alias (a file path)
: no, yes
QU IT
Usage: to quit QuarkXPress and close all open layout spaces.
quit reference saving
Possible values:
saving
: yes, no, ask
SA VE
Usage: to save a specified object to a specified file on disk.
save reference in alias as file type EPS format EPS format EPS data EPS data OPI OPI bleed bleed
Possible values: in: alias
as: type class
template
: Boolean
include preview
EPS Format
: Standard EPS, Multiple File DCS, Single File DCS
Output Setup
: Boolean
: string
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 37
DEFINITIONS AN D EX AM PL ES — E VE NT S SUPPORTED BY QUARKXPRESS
EPS data
transparent page
OPI
bleed
scale
version
: ASCII EPS, binary EPS, clean EPS
: Boolean
: omit TIFF, omit TIFF and EPS, include images
: vertical measurement
: percent
: vers 70, vers 80, vers current
vers 60 JAPANESE (East Asian only) vers 60 KOREAN (East Asian only)
SE T/ GET
Usage: to change an object’s data structure.
set
and
get
are usually used to write
and read an object’s internal data and properties, rather than the whole object.
Set data of reference to replace with
Possible values:
data
: object specific data
replacing*
:
ask/ignore/replace/rename
*Replacing is used for importing text with style sheets in
any text file format supported by QuarkXPress.
The
set
and
get
events are not explicitly specified in the QuarkXPress dictionary
with these parameters. Therefore, the basic
set
event of AppleScript is used to
set the properties of objects.
WORD FILTER SUITE
The Word filter Suite contains functions related to Microsoft
EX PO RT
Usage: to export selected text
export reference as filter type in alias
Possible values: as: string
IM PO RT
Usage: to import selected Microsoft Word document
import reference from alias as filter type
Possible values:
as: string
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
38
|
in
: alias
from
: alias
stylesheets
: Boolean
convert quotes
: Boolean
®
Word documents.
DEFINI TI ON S AN D EX AM PL ES — EVENTS SUPPORTED BY QUARKXPRESS
MISCELLANEOU S SUI TE
The Miscellaneous Suite consists of functions related to the clipboard and other menu-driven functions.
CO PY
Usage: to place a copy of the selected object on the clipboard.
copy
CU T
Usage: to place the selected object on the Clipboard.
cut
DO S CRIPT
Usage: to execute a script entirely before showing the results.
do script data script type type
Possible values:
script type
: type class
Result: anything (result of the script execution)
PA ST E
Usage: to place the data on the Clipboard into a designated/selected container.
paste
RE VE RT
Usage: to restore an object to its last saved state.
revert reference
SH OW
Usage: to bring an object into view; also changes the object’s index reference form.
show reference
QUARKXPRESS SUITE
The QuarkXPress Suite consists of two events: coerce and do updates.
CO ER CE
Usage: To change data from one type to another type.
coerce property of reference to type
Possible values: to: type class (see the “Data Coercion Chart” later in
this section)
Result: anything (result of script execution)
DO U PDATE S
Usage: To redraw the screen after the execution of a script.
do updates
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 39
DEFINITIONS AN D EX AM PL ES — E VE NT S SUPPORTED BY QUARKXPRESS
DATA COERCIO N CHA RT
The following table lists the possible data structure you can request with a get
s event. The indicates that both data types can be coerced into each other.
a The left-facing arrow ‹ indicates that the data types on the right can be coerced into the data types on the left.
text alias
integer Boolean
text
color spec string
integer list RGB Color
style spec string
integer
h and j spec string
integer
C o l o r M o d e l s
CMYK color HSB color list RGB color
N u m b e r s
agate units angle measurement centimeter units cicero units fixed font units horizontal measurement grid increment units inch units inset units integer leading units millimeter units percent pica units point units real text thick units trap units vertical measurement
Re c t a n g l e U n i t s
centimeters rectangle ciceros rectangle fixed rectangle inches rectangle list measurements rectangle millimeters rectangle picas rectangle points rectangle
Po i n t s U n i t s
centimeters point ciceros point fixed point inches point list measurements point millimeters point picas point points point
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
40
|

DA TA C OE RC ION CHART

Items can be represented as or coerced to any of the other items that are in the same section in the chart above. For example, if the horizontal measure is set to inches, you can coerce the returned value to points by using
get page width
as point units.
DATA COERCIO N USI NG THE APPLES CRIPT DICTIONARY
Every scriptable file has an internal dictionary that defines the Apple events it can respond to, as well as the acceptable options or required parameters for those commands. These dictionaries can be accessed by any script-editing application, including Apple’s Script Editor. Using Script Editor, choose Open Dictionary from the File menu and navigate to the intended application. If an application displays in the Open Dictionary dialog box, it has a scripting dictionary, and can be considered scriptable. When you open the diction­ary, a two-part window displays:
The AppleScript dictionary window
Although Apple events definitions are built into an application itself, the dictionary interface is provided by the specific script-editing application. Third-party script editors may have capabilities beyond those of Apple’s Script Editor program.
EVENTS, OBJE CTS, AND PARAMETERS
The left column of the dictionary displays a list of events and the objects on which those events can operate. Events display in Roman typeface, while objects appear in italics. (Bold typeface indicates words or phrases that have special meaning to the application.)
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 41
DATA COERCIO N CH AR T
When one or more items are selected in the left column, their definitions display in the right column. In the window shown above, the open event in the Standard Suite is selected. The right column displays the parts of the event as well as the types of information the event expects. An appropriate open event might be:
Open alias("Hard Drive:Desktop Folder: my Layout") use doc prefs yes remap fonts no
In this case, the script uses the parameters but does not use dictionary indicate that the
do auto picture import
do auto picture import
use doc prefs
and
remap fonts,
. The square brackets ([ ]) in the
parameter is optional.
ELEMENTS AND PROP ERTIES
When viewing an entry for objects, additional subheadings may display in the column called “Elements and Properties.”
In simple terms, elements can be thought of as objects that “belong” to the selected object in the hierarchy. For example, a page can hold generic, text, picture, and line boxes, as well as images, and horizontal and vertical guides, so you will see these listed as elements of the page. Properties, on the other hand, are characteristics of the object itself. Using page as an example, you will find properties such as page number, column count, and gutter width. These are not objects themselves, but do describe how a page appears and behaves.
INHERITED PR OPERT IES
You may notice an <inheritance> entry under properties. This indicates which other objects contribute to the appearance and behavior of the selected object. For example, select “text box” in your QuarkXPress dictionary. Under Properties, these entries display:
<inheritance> generic box —- All properties and elements of the given class are inherited by this class.
<inheritance> text path properties —- All properties and elements of the given class are inherited by this class.
<inheritance> text container properties —- All properties and elements of the given class are inherited by this class.
This means that a text box, while having certain specific properties of its own, also has all the properties shown in the dictionary entries for generic box, text path properties, text container properties, and for box properties and containing box properties that are inherited by generic box. In other words, all boxes have a certain set of common properties that define how they behave as boxes. Of those, some boxes have additional properties that enable them to contain other information; in turn, some of these boxes are even more specialized, holding only text and therefore have properties appropriate to perform that function.
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
42
|
DA TA C OE RC IO N US IN G THE APPLESCRIPT DICTIONARY
In practice, this means that if you want to change the color of a text box, you would write:
set color of text box 1 to "green"
Color is not a property of the text box class, but we can use it as such, because it has been inherited from box properties, which is inherited by generic box. Likewise, if you want to change the shape to rounded corner, you can write:
set corner radius of text box 1 to 20
Once again, skew is not defined in the text box entry, but is picked up through inheritance from containing box properties. Consequently, when using an Apple events dictionary, you may want to think of <inheritance> as a scripting equivalent of “see also” in an ordinary dictionary.
REFERENCE MA TERIA L FOR QUARKXP RESS OBJECTS
APPLICATION EVENT S AND EXAMPLES
VERB APPLESC RIPT EXAMPLE
count
count of every layout space of project 1 of application
“QuarkXPress”
data size
get
get auto save of application “QuarkXPress”
get as
set
set doc layout showing of application “QuarkXPress” to
data size of name of application “QuarkXPress” as integer
get name of application “QuarkXPress” as string
true
APPLICATION ELEME NTS AND REFERENCE FORMS
BEFORE/
BY AFTER ELEMENT NUMERIC BY BY SATISFYING ANOTHER CLASS INDEX BY ID NAME RANGE A TEST ELEMENT
color • • system
default • document
delimit • table
document • • •
file •
menu • • • • •
project • • • •
window • • • •
xtension • • • • •
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 43
DATA COERCIO N US IN G TH E AP PL ES CR IPT DICTIONARY
APPLICATION PROPE RTIES, DATA TYPES, AND DESCRIPTIONS
R/O PROPERTY NAME TYPE DES CRIPTION
auto backup
auto lib save
auto save
auto save interval
backup destination
best type
class
color TIFF resolution
colors showing
convert quotes
current box
default type
doc layout showing
drag and drop text
editing is allowed
font list
Boolean If
Boolean If
Boolean If
fixed Amount of time (in minutes)
between each auto save
alias Destination folder for
backup files
type class Best descriptor type
type class Class descriptor type
use 8 bit/ Resolution at which to use 32 bit display color TIFF images
Boolean If
palette is showing
Boolean If
quotation marks to typogra-
reference Selected box
type class Default descriptor type
Boolean If
palette is displayed
Boolean If
a list of List of fonts available
font record to application
frontmost
gray TIFF resolution
grid guide
Boolean Is this the frontmost
use 16 levels/ Resolution at which to
use 256 levels display grayscale TIFF images
RGB color Color of grid guides
color
import styles
Boolean If
true
, auto backup is on
true
, save changes to a library automatically whenever an entry is added
true
, auto save is on
true
, the Colors
true
, convert standard
pher’s quotation marks when importing text
true
, the Layout
true
, drag and drop
application?
true
, import style tags when importing text
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
44
|
RE FE RE NC E MA TE RI AL F OR QUARKXPRESS OBJECTS
R/O PROPERTY NAME TYPE DES CRIPTION
language
Simplified Chinese/ Program language
Traditional Chinese/Danish/ Dutch/ International English/ US English/ French/German/ Reformed German/ Swiss German/ Italian/ Japanese/Korean/ Norwegian/Polish/ Russian/Spanish/ Swedish/
live scroll
margin guide
Boolean If
true
, perform live scrolling
RGB color Color of margin guides
color
maximize document bounds
measurements showing
name
object reference
offscreen draw
opaque text box editing
Boolean If
true
, maximize layout
boundary when zooming
or tiling
Boolean If
true
, the Measurements
palette is displayed
String Name of this application
reference Object reference for
this object
Boolean If
true
, off-screen
drawing is on
Boolean If
true
, text boxes display
opaque when clicked for
editing
open document preference
keep document Settings to use when
settings/use opening a layout application preferences/ ask user
pasteboard width
picture import filters
percent Width of the pasteboard
(in percent)
list A list of the installed picture
import filters
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 45
REFERENCE MA TE RI AL F OR Q UA RK XP RE SS OBJECTS
R/O PROPERTY NAME TYPE DES CRIPTION
properties
quote types
ruler guide
record Property that allows getting
small integer Type of quotation marks
RGB color Color of ruler guides
color
save document position
Boolean If
remembered the next time
the layout is opened
speed scroll
selection
Boolean If
selection Selection visible to
object the user
show tool tips
smart quotes
style sheets showing
text export filters
text import filters
tile to multiple
Boolean If
when the mouse pointer is
Boolean If
Boolean If
palette is displayed
list Displays a list of installed
(string) text export filters
list Displays a list of installed
(string) text import filters
Boolean If
multiple monitors
monitors
tools showing
Boolean If
is displayed
total backups
small Total number of backups
integer to keep
trap
Boolean If true, the Trap
information showing
Information palette
is displayed
a list of all properties
to use for Smart Quotes. 1=“”; 2=""; 3=„”, 4=«»; 5=»«
true
, layout size is
true
, speed scroll is on
true
, tool names display
over a tool
true
, convert standard quotation marks to typogra­pher’s quotation marks
true
, the Style Sheets
true
, tiles layouts to
true
, the Tools palette
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
46
|
RE FE RE NC E MA TE RI AL F OR QUARKXPRESS OBJECTS
R/O PROPERTY NAME TYPE DES CRIPTION
version
show xt manager
version (integer) Version of the application
never/always/ Indicates when to show the
on folder XTensions Manager change/if error/ if error or change
PROJECT EVEN TS AN D EXAMPLES
VERB APPLESC RIPT EXAMPLE
close
close project “Newsletter”
count
count of every project of application “QuarkXPress”
data size
get
get name of project 1
get as
make
open
data size of name of project 1 as integer
get file path of project 2 as string
make new project at beginning
open project “AnnualReport” use prefs yes remap fonts ask
do auto picture import ask
print
print
save
save project 1 in “Hard Drive: Desktop Folder: Projects”
PROJECT ELEM ENTS AND REFERENCE FORM S
BEFORE/
BY AFTER ELEMENT NUMERIC BY BY BY SATISFYING ANOTHER CLASS INDEX ID NAME RANGE A TEST ELEMENT
layout space • • •
character spec • • • • •
color spec • • • • •
h and j spec • • • • •
style spec • • • • •
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 47
REFERENCE MA TE RI AL F OR Q UA RK XP RE SS OBJECTS
PROJECT PROP ERTIE S, DATA TYPES, AND DESCRIPTIONS
R/O PROPERTY NAME TYPE D ESCRIPTION
active layout space
best type
character spec class lock
class
color spec class lock
default type
doc format
file path
h and j spec class lock
lock
modified
name
object
reference
properties
style spec class lock
version
space for this project
type class Class descriptor type
Boolean If
string Name of this project
reference Object reference for
layout Active layout space
type class Best descriptor type
Boolean If
in this project are locked
Boolean If
project are locked
type class Default descriptor type
string Format of this project
alias File specification of
Boolean If
project are locked
Boolean If
this object
record Property that allows getting/
Boolean If
sheets in this project
small integer Version of this project
true
, all character specs
true
, all colors in this
the project
true
, all H&Js in the
true
, this project is locked
true
, this project has been modified since the last save operation
setting of a list of properties
true
, all paragraph style
are locked
QuarkXPress uses the layout space 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.
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
48
|
RE FE RE NC E MA TE RI AL F OR QUARKXPRESS OBJECTS
LAYOUT SPACE EVEN TS AND EXAMPLES
VERB APPLESC RIPT EXAMPLE
count
count of every story of layout space 1
data size
get
get name of layout space 1
get as
make
open
data size of name of layout space 1 as integer
get file path of layout space 2 as string
make layout space at beginning
open file “Hard Drive:Test” use doc prefs yes remap fonts ask
do auto picture import ask
print
print
set
set keep master page items of layout space 1 of project 1
to
true
show
show first layout space
LAYOUT SPACE ELEM ENTS AND REFERENCE FORMS
BEFORE/ BY AFTER ELEMENT NU MERIC BY B Y BY SATI SFYING ANOTH ER CLASS INDEX ID NAME RANGE A TEST ELEMEN T
fontset spec • • • • • (East Asian only)
generic box • • • • •
graphic box • • • • • •
image • • • •
layer • • •
line box • • • • • •
page • • • •
picture box • • • • • •
spread • • • •
story • • • • •
table box • • • • • •
text box • • • • • •
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 49
REFERENCE MA TE RI AL F OR Q UA RK XP RE SS OBJECTS
LAYOUT SPACE PROP ERTIES, DATA TYPES , AND DESCRIPTIONS
R/O PROPERTY NAME TYPE DES CRIPTION
active layer
reference Active layer of this
layout space
auto
Boolean If
constrain
auto kern
auto leading
auto page insertion location
constrain limits of items
Boolean If
percent Value to use for auto leading
no auto page Specifies where new pages
insertion/ are inserted
end of story/ end of section/ end of document
auto picture import
off/auto automatically update
auto import Specifies whether to
import on/ pictures that have been auto import modified since the layout verify was last opened
automatic text box
automatic trap amount
auxiliary dictionary path
baseline grid increment
baseline grid showing
baseline grid start
best type
bottom margin
ciceros per centimeter
class
Boolean If
text box for each new page
trap units/ Auto trap amount
overprint
alias Path of the auxiliary
dictionary file for this
document
grid Baseline grid interval
increment units
Boolean If
is showing
vertical Baseline grid start
measurement
type class Best descriptor type
vertical Height of the bottom margin measurement of a page in this layout
fixed Number of ciceros
per centimeter
type class Class descriptor type
true
, automatically
within boxes
true
, apply auto kerning
true
, create an automatic
true
, baseline grid
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
50
|
RE FE RE NC E MA TE RI AL F OR QUARKXPRESS OBJECTS
R/O PROPERTY NAME TYPE DESCRIPTION
column count
integer Number of columns in this
layout space
current box
current page
current spread
default
reference Selected box
page Page displayed to user
spread Spread displayed to user
small integer Default spread count
spread count
default type
facing pages
file path
flex space width
width space
flow version
font list
type class Default descriptor type
Boolean If
true
, creates facing pages
alias File path of this layout
percent Value for custom
fixed Layout flow version
list List of fonts used in this
(font record) layout
fractional character widths
Boolean If
true
, print characters
using fractional widths
(default); if false, print
characters using integral widths
frame inside
Boolean If
true
, place frames inside
text or picture boxes
greek below
font units Text size below which to
display text as gray lines
greek pictures
Boolean If
true
, display pictures as
gray boxes
guides in front
guides showing
gutter width
Boolean If
true
, place guides in
front of all boxes
Boolean If
true
, guides are
showing
horizontal Width of default text box’s
measurement gutter in this layout space
horizontal measure
inches/inches Horizontal measurement
decimal units
picas/points/ millimeters/ centimeters/ ciceros/agates/Qs (East Asian only)
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 51
REFERENCE MA TE RI AL F OR Q UA RK XP RE SS OBJECTS
R/O PROPERTY NAME TYPE DESCRIPTION
hyphenation method
standard Method to use
hyphenation/ for hyphenation
enhanced hyphenation/ expanded hyphenation
ignore white
indeterminate trap amount
index
integer Index of object
inside margin
Boolean If
trap units/ Value for trapping
overprint to indeterminate
horizontal Location of inside margin
measurement of a page in this layout
invisibles showing
item spread coords
keep master page items
kern above
knockout limit
left margin
Boolean If
characters
Boolean If
spread coordinates
Boolean If
page items when they are
font units Size of text above which
percent Point at which an object
color knocks out of the
horizontal Location of the left
measurement margin of a page in this
ligatures on
no ligatures/ Standard specifies ligatures; standard no ligatures specifies that ligatures/ the layout does not use
extra ligatures ligatures; extra ligatures
true
, specifies that an object color in front of multiple backgrounds that include white will not take white into account when trapping
background color
(with facing pages
true
, display invisible
true
, display items in
true
, keep modified
true
)
modified on the master page
auto kerning should apply
background color
layout space
turns ligatures on and checks Standard Em Space in the Preferences dialog box
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
52
|
RE FE RE NC E MA TE RI AL F OR QUARKXPRESS OBJECTS
R/O PROPERTY NAME TYPE DESCRIPTION
lock
Boolean If
lock guides
low quality blends
maintain leading
Boolean If
Boolean If
blends (faster)
Boolean If
line that falls immediately
true
, lock layout space
true
, lock guides
true
, display banded
true
, the baseline of a
below an obstruction is placed according to its applied leading value
maximum ligature track
fixed Maximum amount that
ligatures can be tracked
or kerned apart before they break into separate characters
maximum view scale
minimum view scale
modified
percent Largest layout view using
the Zoom tool
percent Smallest layout view using
the Zoom tool
Boolean If
true
, this layout has been
modified since the last save
name
string Name of this layout
object reference
outside margin
reference Object reference for
this object
horizontal Location of the outside mar-
measurement gin of a page in this layout
(with facing pages true)
overprint limit
page height
percent Shade of color below which
objects will not overprint
vertical Height of a page in this
measurement layout space
page rule origin
page width
measurements Location of the page’s ruler
point origin point
horizontal Width of a page in this
measurement layout space
points per inch
print setup
fixed Number of points
per inch
print setup Settings used when printing
record this layout
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 53
REFERENCE MA TE RI AL F OR Q UA RK XP RE SS OBJECTS
R/O PROPERTY NAME TYPE DESCRIPTION
process trap
properties
Q
Boolean If
measurement
right margin
Boolean If
record Property that allows getting/
for measurements
horizontal Location of the right margin
measurement of a page in this layout
Roman Extra
rulers showing
small caps horizontal
percent Percentage of space between
Boolean If
percent Horizontal scale for small cap characters
scale
small caps vertical scale
snap distance
spread height
percent Vertical scale for small
cap characters
small integer Distance within which
vertical Height of a spread
measurement (including pasteboard)
in this layout
spread rule origin
spread width
measure ments Location of the spread’s
point ruler origin
horizontal Width of a spread
measurement (including pasteboard)
subscript horizontal
percent Horizontal scale for subscript characters
scale
subscript offset
subscript vertical scale
superscript horizontal scale
superscript offset
percent Offset for subscript
characters
percent Vertical scale for
subscript characters
percent Horizontal scale for
superscript characters
percent Offset for
superscript characters
true
, process trapping is on
setting of a list of properties
true
, use Q
(East Asian only)
Roman and Japanese characters (East Asian only)
true
, show rulers
items snap to guides
in this layout
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
54
|
RE FE RE NC E MA TE RI AL F OR QUARKXPRESS OBJECTS
R/O PROPERTY NAME TYPE DESCRIPTION
superscript vertical scale
superior horizontal scale
superior vertical scale
tool mode
tool mode
percent Vertical scale for
superscript characters
percent Horizontal scale for
superior characters
percent Vertical scale for
superior characters
integer Index of the tool mode
drag mode/ Tool that is selected
contents mode
rect mode/ rotate mode/ view mode/ text mode/ rounded rect mode/ oval mode/ poly mode/ pic mode/ rounded rect pic mode/ oval pic mode/ poly pic mode/ orthogonal line mode/ line mode
top margin
vertical Location of the top margin
measurement of a page in this layout
trapping method
absolute trap/ Trapping method to
proportional be used trap/
knockout all
typesetting leading mode
Boolean If
true
, this layout space
uses the value of leading
upward from the baseline of one line of text to the baseline of the line above it; if false, this layout space uses Word Processing mode, which measures leading downward from the top of the ascent to the line below it
version
small integer Version of this layout space
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 55
REFERENCE MA TE RI AL F OR Q UA RK XP RE SS OBJECTS
R/O PROPERTY NAME TYPE DESCRIPTION
vertical measure
inches/inches Vertical measurement units
decimal/picas/
points/
millimeters/ centimeters/ ciceros/agates/ Qs (East Asian only)
view scale
fit page in Current view scale of
window/ fit this layout spread in window/ thumbnails, or percentage
view scale increment
percent Percentage of change in
view for each click using
WINDOW EVENT S AND EXAMPLES
VERB APPLESC RIPT EXAMPLE
close
close window 1
data size
exists
get
get name of window 1
get as
show
data size of name of window 1 as integer
exists window 3
get bounds of window 1 as list
show window 2
the Zoom tool
WINDOW ELEME NTS A ND REFERENCE FORMS
None
WINDOW PROPE RTIES , DATA TYPES, AND DESCRIPTIONS
R/O PROPERTY NAME TYPE DESCRIP TION
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
56
|
best type
bounds
class
closeable
default type
floating
type class Best descriptor type
rectangle Boundary rectangle for
this window
type class The class descriptor type
Boolean If
true
, this window has a
close box
type class Default descriptor type
Boolean If
true
, this window floats
RE FE RE NC E MA TE RI AL F OR QUARKXPRESS OBJECTS
R/O PROPERTY NAME TYPE DESCRIP TION
index
integer Numbered order of
this window
modal
Boolean If
true
, this window
is modal
name
plain text (string) Window name (title)
object reference
properties
reference Object reference for
this object
record Property that allows getting/
setting of a list of properties
resizable
Boolean If
true
, this window
is resizable
titled
Boolean If
true
, this window has a
title bar
visible
Boolean If
true
, this window
is visible
zoomable
Boolean If
true
, this window has a
zoom box
zoomed
Boolean If
true
, this window
is zoomed
SELECTION OB JECT PROPERTIES, DATA T YPES, AND DESCRIPT IONS
R/O PROPERTY NAME TYPE DESCRIP TION
contents
type class The contents of
the selection
CHARACTER EV ENTS AND EXAMPLES
VERB APPLESC RIPT EXAMPLE
count
count of every character of word 1
data size
delete
duplicate
exists
get
get base shift of character 4
get as
make
move
set
set language of character 1 to 2
select
show
data size of style of character 1
delete character 1
duplicate character 1 to after character 2
exists (character 1)
get name of color of character 4 as string
make character at end of word 1 with properties {contents:“s”}
move character 1 to after character 3
select character 1
show last character
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 57
REFERENCE MA TE RI AL F OR Q UA RK XP RE SS OBJECTS
CHARACTER PR OPERT IES, DATA TYPES, A ND DESCRIPTIONS
R/O PROPERTY N AME TYPE DESCRIPTION
ascent
base shift
baseline
font units Maximum ascent of any
base units Baseline shift of the first
vertical Vertical offset (from the top
measurement of the containing text box)
best type
character style
character type
type class Best descriptor type
character Character spec applied
spec to this text
no type/ Type of the character
one byte/ (East Asian only) two byte/ many types
class
type class Class descriptor type
color
color spec Color of the first character
contents
unicode text Contents of this text
(string)
default type
descent
font
plain text Name of the font of the
type class Default descriptor type
font units Maximum descent of any
(string) first character in this text
grouped character
height
horizontal offset
horizontal scale
kern
language
Boolean If
grouped (East Asian only)
font units Height of this text
horizontal Horizontal offset (from the
measurement left side of the containing
percent Horizontal scale of the first
character of this text
fixed Kerning of the first character
small integer Language of the first
character in this text
character of this text
of the baseline of the first character of this text
of this text
character in this text
true
, this text is
text box) of the first character of this text
of this text
character of this text
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
58
|
RE FE RE NC E MA TE RI AL F OR QUARKXPRESS OBJECTS
R/O PROPERTY N AME TYPE DESCRIPTION
object reference
offset
reference Object reference for
this object
integer Offset (character index) of
the first character of this text object within the containing story
opacity
percent Opacity of the first character
of this text
open type style
open type OpenType®style applied to
style record the first character of this text
properties
record Property that allows getting
a list of properties
rubi
plain text Rubi for this text
(string) (East Asian only)
sending
horizontal Sending of this text
measurement (East Asian only)
shade
percent Shade of the first character
of this text
size
fixed Size of the first character of
this text in points
style
text style Text styles applied to
info this text
track
fixed Tracking of the first
character of this text
trap text
default/ Trapping specification overprint/ for the first character of knockout/ this text
spread auto amount/choke auto amount
vertical scale
percent Vertical scale of the first
character of this text
width
horizontal Width of the first character
measurement of this text
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 59
REFERENCE MA TE RI AL F OR Q UA RK XP RE SS OBJECTS
LINE EVENTS AND E XAMPLES
VERB APPLESC RIPT EXAMPLE
count
count of every character of line 2
data size
delete
duplicate
get
get track of line 1
get as
make
move
save
select
data size of track of line 1 as integer
delete line 1
duplicate line 1 to after line 3
get justification of line 1 as string
make line at beginning with properties {contents:“Headline”}
move line 1 to after line 3
save line 1 as “TEXT” in file “Hard Disk:TextFile”
select line 1
LINE ELEMENT S AND REFERENCE FORMS
BEFOR E/
BY AFTER ELEMENT NUM ERIC BY BY BY SATISFYING A NOTHER CLASS INDEX ID NAME RANGE A TES T ELEMENT
character • • • •
text • • •
word • • • •
LINE PROPERT IES, DATA TYPES, AND DE SCRIPTIONS
R/O PROPERTY N AME TYPE DESCRIPTION
ascent
base shift
baseline
measurement of the containing text box)
best type
character style
character type
two byte/
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
60
|
font units Maximum ascent of any
character in this text
base units Baseline shift of the first
character in this text
vertical Vertical offset (from the top
of the baseline of the first character of this text
type class Best descriptor type
character Character spec
spec applied to this text
no type/ Type of character
one byte/ (East Asian only)
many types
RE FE RE NC E MA TE RI AL F OR QUARKXPRESS OBJECTS
R/O PROPERTY N AME TYPE DESCRIPTION
class
type class Class descriptor type
color
color spec Color of the first character
of this text
contents
unicode text Contents of this text
(string)
default type
descent
font units Maximum descent of any
type class Default descriptor type
character in this text
font
plain text Name of the font of the
(string) first character in this text
grouped character
height
horizontal offset
Boolean If
true
, this text is grouped
(East Asian only)
font units Height of this text
horizontal Horizontal offset (from the
measurement left side of the containing
text box) of the first character of this text
horizontal scale
justification
percent Horizontal scale of the first
character of this text
left justified/ Justification of this text right justified/ centered/ fully
justified/force
kern
fixed Kerning of the first character
of this text
language
small integer Language of the first
character of this text
length
integer Number of characters in
this text object
object
reference Object reference for
reference
offset
this text object
integer Index of the first character
of this text object within the containing story
opacity
percent Opacity of the first
character of this text
open type style
open type OpenType styles applied to
style record this text
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 61
REFERENCE MA TE RI AL F OR Q UA RK XP RE SS OBJECTS
R/O PROPERTY N AME TYPE DESCRIPTION
PinYin
plain text PinYin for this text
(string) (Simplified Chinese only)
properties
rubi
record Property that allows getting
plain text Rubi for this text
(string) (Japanese and Korean only)
sending
horizontal Sending for this text
measurement (East Asian only)
shade
percent Shade of the first character
size
fixed Size of the first character of
style
text style info Text styles applied to
track
fixed Tracking of the first character
trap text
default/ Trapping specification for
overprint/ the first character of this text knockout/ spread auto amount/choke auto amount
uniform styles
vertical scale
width
text style Text styles that are
info uniformly applied to
percent Vertical scale of the first
horizontal Width of the first character
measurement of this text
ZhuYin
plain text ZhuYin for this text
(string) (Traditional Chinese only)
a list of properties
of this text
this text in points
this text
of this text
this text
character of this text
PARAGRAPH EV ENTS AND EXAMPLES
VERB APPLESC RIPT EXAMPLE
count
count of every word of paragraph 1
data size
delete
duplicate
get
get height of paragraph 4
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
62
|
data size of leading of paragraph 3 as integer
delete paragraph 1
duplicate paragraph 4 to before paragraph 1
RE FE RE NC E MA TE RI AL F OR QUARKXPRESS OBJECTS
VERB APPLESC RIPT EXAMPLE
get as
make
move
save
select
set
show
get font of paragraph 1 as string
make paragraph at end
move paragraph 1 to after paragraph 3
save paragraph 3 as “TEXT” in “Hard Drive: Test.txt”
select paragraph 1
set justification of paragraph 1 to center
show paragraph 1
PARAGRAPH EL EMENT S AND REFERENCE FO RMS
BEFORE/
BY AFTER ELEMENT NUM ERIC BY BY BY SATISFYING A NOTHER CLASS INDEX ID NAME RANGE A TES T ELEMENT
character • • • •
line • • • •
text • • •
word • • • •
PARAGRAPH PR OPERT IES, DATA TYPES, A ND DESCRIPTIONS
R/O PROPERTY N AME TYPE D ESCRIPTION
ascent
font units Maximum ascent of any
character in this text
baseline
vertical Vertical offset (from the top
measurement of the containing text box)
of the baseline of the first character of this text
base shift
base units Baseline shift of the first
character of this text
best type
character alignment
type class Best descriptor type
top align/ Alignment for characters center align/ (East Asian only)
baseline align/ bottom align
character style
character type
character Character spec applied
spec to this text
no type/ Type of this character
one byte/ (East Asian only)
two byte/ many types
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 63
REFERENCE MA TE RI AL F OR Q UA RK XP RE SS OBJECTS
R/O PROPERTY N AME TYPE D ESCRIPTION
class
type class The class
color
color spec Color of the first character
contents
unicode text Contents of this text
(string)
default type
descent
drop cap characters
drop cap lines
enlarged character(s) drop
first indent
type class Default descriptor type
font units Maximum descent of any
small integer Number of
drop characters
small integer Number of lines the
horizontal First line indentation value
measurement
font
plain text Name of the font of the
(string) first character in this text
grid lock
grouped character
h and j set
height
horizontal offset
horizontal scale
justification
Boolean If
Boolean If
(East Asian only)
h and j spec H&J specification applied to
font units Height of this text
horizontal Horizontal offset (from the
measurement left side of the containing
percent Horizontal scale of the first
character of this text
left justified/ Justification of this text
right justified/ centered/fully justified/force
keep all
keep together
keep together end
Boolean If
Boolean If
small integer Number of lines to keep
together at end of this
of this text
character in this text
true
, lock paragraph to
baseline grid
true
, this text is grouped
this paragraph
text box) of the first character of this text
true
, and keep together is
on, keep all lines together
true
, keep together is on
paragraph
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
64
|
RE FE RE NC E MA TE RI AL F OR QUARKXPRESS OBJECTS
R/O PROPERTY N AME TYPE D ESCRIPTION
keep together start
together at the beginning
small integer Number of lines to keep
of this paragraph
keep with next
Boolean If
true
, will not separate
this paragraph from next
paragraph
kern
fixed Kerning of the first character
of this text
language
small integer Language of the first
character of this text
leading
leading units Vertical spacing
between lines of text
in this paragraph
left indent
horizontal Left Indent value
measurement
length
integer Number of characters in
this text object
object reference
offset
reference Object reference for
this object
integer Offset (character index) of
the first character of this text within the containing story
opacity
percent Opacity of the first character
of this text
open type style
PinYin
open type OpenType styles applied to
style record this text
plain text PinYin for this text
(string) (Simplified Chinese only)
properties
record Property that allows setting
of a list of properties
punct indent
horizontal Ten Maru gutter for this
measurement paragraph (East Asian only)
relative leading
right indent
Boolean If
true
, leading is relative
to largest font on each line
horizontal Right Indent value
measurement
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 65
REFERENCE MA TE RI AL F OR Q UA RK XP RE SS OBJECTS
R/O PROPERTY N AME TYPE D ESCRIPTION
rubi
plain text Rubi for this text
(string) (Japanese and Korean only)
rule above
rule below
sending
rule record Rule above properties
rule record Rule below properties
horizontal Sending of this text
measurement (East Asian only)
shade
percent Shade of the first character
size
fixed Size of the first character of
space after
vertical Space below the last line of
measurement this paragraph
space before
vertical Space above this paragraph
measurement
style
text style info Text styles applied to
style sheet
tab list
style spec Name or reference of the
list of tab A list of the tabs in
record the paragraph
track
fixed Tracking of the first
trap text
default/ Trapping specification for
overprint/ the first character of
knockout/ this text spread auto amount/choke auto amount
uniform styles
vertical scale
width
horizontal Width of the first character
text style info Text styles that are
percent Vertical scale of the first
measurement of this text
ZhuYin
plain text ZhuYin for this text
(string) (Traditional Chinese only)
of this text
this text in points
this text
style spec applied to this paragraph
character of this text
uniformly applied to this text
character of this text
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
66
|
RE FE RE NC E MA TE RI AL F OR QUARKXPRESS OBJECTS
STORY EVENTS AND EXAMPLES
VERB APPLESC RIPT EXAMPLE
count
count of every paragraph of story 1
data size
deletet
get
get contents of story1
get as
save
select
set
set font of story 1 to “Times”
show
data size of name of story 4 as integer
delete story 10
get color of story 1 as string
save story 1 as “TEXT” in “Hard Drive: Test.txt”
select story 1
show story 1
STORY ELEMEN TS AN D REFERENCE FORMS
BEFORE/
BY AFTER ELEMENT NUM ERIC BY BY BY SATISFYING A NOTHER CLASS INDEX ID NAME RANGE A TES T ELEMENT
character • • • •
line • • • •
paragraph • • • •
text • • •
text style • • • • range
word • • • •
STORY PROPER TIES, DATA TYPES, AND D ESCRIPTIONS
R/O PROPERTY N AME TYPE D ESCRIPTION
ascent
base shift
baseline
font units Maximum ascent of any
base units Baseline shift of the first
vertical Vertical offset (from the top
measurement of the containing text box)
best type
character style
type class Best descriptor type
character spec Character spec applied to
character in this text
character of this text
of the baseline of the first character of this text
this text
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 67
REFERENCE MA TE RI AL F OR Q UA RK XP RE SS OBJECTS
R/O PROPERTY N AME TYPE D ESCRIPTION
character type
no type/ Type of the character
one byte/ (East Asian only)
two byte/ many types
class
type class Class descriptor type
color
color spec Color of the first character
contents
unicode text Contents of this text
(string)
content lock
default type
descent
font
plain text Name of the font of the
Boolean If
type class Default descriptor type
font units Maximum descent of any
(string) first character in this text
format lock
grouped character
height
horizontal offset
horizontal scale
kern
fixed Kerning of the first character
language
length
name
plain text Name of this story
Boolean If
Boolean If
(East Asian only)
font units Height of this text
horizontal Horizontal offset (from the
measurement left side of the containing
percent Horizontal scale of the first
character of this text
small integer Language of the first
integer Number of characters in
(string)
of this text
true
, the content
of this story is locked
character in this text
true
, the format of the
story is locked
true
, this text is grouped
text box) of the first character of this text
of this text
character of this text
this text
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
68
|
RE FE RE NC E MA TE RI AL F OR QUARKXPRESS OBJECTS
R/O PROPERTY N AME TYPE D ESCRIPTION
object reference
offset
reference Object reference for
this object
integer Index of the first character
of this text object within the containing story
opacity
percent Opacity of the first
character of this text
open type style
PinYin
open type OpenType styles applied to
style record this text
plain text PinYin for this text
(string) (Simplified Chinese only)
properties
record Property that allows setting
of a list of properties
rubi
plain text Rubi for this text
(string) (Japanese and Korean only)
sending
horizontal Sending of this text
measurement (East Asian only)
shade
percent Shade of the first character
of this text
size
fixed Size of the first character of
this text in points
style
text style info Text styles applied to
this text
track
fixed Tracking of the first character
of this text
trap text
default/ Trapping specification
overprint/ for the first character of knockout/ this text spread/ auto amount/ choke auto amount
uniform styles
text style info Text styles that are
uniformly applied to this text
vertical scale
percent Vertical scale of the first
character of this text
vertical story
direction
Boolean If
true
, this story is
vertically oriented
(East Asian only)
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 69
REFERENCE MA TE RI AL F OR Q UA RK XP RE SS OBJECTS
R/O PROPERTY N AME TYPE D ESCRIPTION
width
horizontal Width of the first character
ZhuYin
plain text ZhuYin for this text
(string) (Traditional Chinese only)
TEXT EVENTS AND E XAMPLES
VERB APPLESC RIPT EXAMPLE
count
count of every word of text 1
data size
delete
duplicate
get
get leading of text of story 1
get as
make
save
select
set
set justification of text 1 to centered
show
data size of height of text of story 1 as integer
delete text of paragraph 1
duplicate text 1 where it is “Body Copy” to after paragraph 1
get height of text 1 as integer
make text at end with properties {contents: “Page 1”}
save text 1 as “TEXT” in “Hard Drive: Test.txt”
select text 1
show text where it is “Sidebar”
of this text
TEXT ELEMENT S AND REFERENCE FORMS
BEFORE/
BY AFTER ELEMENT NUM ERIC BY BY BY SATISFYING ANOTHE R CLASS INDEX ID NAME RANGE A T EST ELEMENT
character • • • •
line • • • •
paragraph • • • •
text • • •
text flow • • •
text style • • • • range
word • • • •
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
70
|
RE FE RE NC E MA TE RI AL F OR QUARKXPRESS OBJECTS
TEXT PROPERT IES, DATA TYPES, AND DE SCRIPTIONS
R/O PROPERTY N AME TYPE D ESCRIPTION
ascent
font units Maximum ascent of any
character in this text
base shift
base units Baseline shift of the first
character of this text
best type
character style
character type
type class Best descriptor type
character spec Character spec applied
to this text
no type/ Type of the character
one byte/ (East Asian only) two byte/ many types
class
type class The class
color
color spec Color of the first character
of this text
content
unicode text Contents of this text
(string)
default type
descent
type class Default descriptor type
font units Maximum descent of any
character in this text
font
plain text Name of the font of the
(string) first character in this text
grouped character
height
horizontal offset
Boolean If
true
, this text is
grouped (East Asian only)
font units Height of this text
horizontal Horizontal offset (from the
left side of the containing
text box) of the first character of this text
horizontal scale
kern
percent Horizontal scale of the first
character of this text
fixed Kerning of the first character
of this text
language
small integer Language of the first
character of this text
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 71
REFERENCE MA TE RI AL F OR Q UA RK XP RE SS OBJECTS
R/O PROPERTY N AME TYPE D ESCRIPTION
length
object reference
offset
opacity
integer Number of characters in
reference Object reference for
this object
integer Offset (character index)
percent Opacity of the first
character of this text
open type style
PinYin
open type OpenType styles applied to
style record this text
plain text PinYin for this text
(string) (Simplified Chinese only)
properties
rubi
record Property that allows setting
plain text Rubi for this text
(string) (Japanese and Korean only)
sending
horizontal Sending of this text
measurement (East Asian only)
shade
percent Shade of the first character
size
fixed Size of the first character of
style
text style info Text styles applied to
track
fixed Tracking of the first
trap text
default/ the Trapping specification for
overprint/ first character of this text knockout/ spread auto amount/ choke auto amount
uniform styles
vertical scale
text style Text styles that are
info uniformly applied to
percent Vertical scale of the first
this text
of the first character of this text within the containing story
of a list of properties
of this text
this text in points
this text
character of this text
this text
character of this text
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
72
|
RE FE RE NC E MA TE RI AL F OR QUARKXPRESS OBJECTS
R/O P ROPERTY NAME TYPE DESCRIP TION
width
horizontal Width of the first character
measurement of this text
ZhuYin
plain text ZhuYin for this text
(string) (Traditional Chinese only)
WORD EVENTS AND E XAMPLES
VERB APPLESC RIPT EXAMPLE
count
count of every character of word 1
duplicate
data size
delete
get
get base shift of word 4
get as
make
move
save
select
set
set horizontal scale of word 1 to 30
show
duplicate word 1 to after word 2
data size of font of word 1 as integer
delete character 1
get base shift of word “QuarkXPress” as integer
make word at beginning with data “Blue”
move word 1 to after word 3
save word 1 as “TEXT” in “Hard Drive:Color.txt”
select word 1
show word 5
WORD ELEMENT S AND REFERENCE FORMS
BEFORE/
BY AFTER ELEMENT NUM ERIC BY BY BY SATISFYING A NOTHER CLASS INDEX ID NAME RANGE A TES T ELEMENT
character • • • •
line • • • •
paragraph • • • •
story • • • • •
text • • •
text style • • • • range
word • • • •
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 73
REFERENCE MA TE RI AL F OR Q UA RK XP RE SS OBJECTS
WORD PROPERT IES, DATA TYPES, AND DE SCRIPTIONS
R/O PROPERTY N AME TYPE D ESCRIPTION
ascent
base shift
baseline
font units Maximum ascent of any
base units Baseline shift of the first
vertical Vertical offset (from the top
measurement of the containing text box)
best type
character style
class
color
contents
type class Best descriptor type
character spec Character spec applied
to this text
type class Class descriptor type
color spec Color of the first character
unicode text Contents of this text
(string)
default type
descent
font
plain text Name of the font of the
type class Default descriptor type
font units Maximum descent of any
(string) first character in this text
grouped character
height
horizontal offset
horizontal scale
kern
language
length
object reference
Boolean If
(East Asian only)
font units Height of this text
horizontal Horizontal offset (from the
left measurement side of the
percent Horizontal scale of the first
character of this text
fixed Kerning of the first character
small integer Language of the first
integer Number of characters in this
reference Object reference for
this object
character in this text
character of this text
of the baseline of the first character of this text
of this text
character in this text
true
, this text is grouped
containing text box) of the first character of this text
of this text
character of this text
text object
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
74
|
RE FE RE NC E MA TE RI AL F OR QUARKXPRESS OBJECTS
R/O PROPERTY N AME TYPE D ESCRIPTION
offset
integer Offset (character index) of
the index of the first charac­ter of this text object within the containing story
opacity
percent Opacity of the first
character of this text
open type style
properties
open type OpenType styles applied to
style record this text
record Property that allows getting
a list of properties
rubi
plain text Rubi for this text
(string)
sending
horizontal Sending of this text
measurement (East Asian only)
shade
percent Shade of the first character
of this text
size
fixed Size of the first character of
this text in points
style
text style info Text styles applied to this text
track
fixed Tracking of the first character
of this text
trap text
default/ Trapping specification for
overprint/ for the first character of knockout/ this text spread auto amount/ choke auto amount
uniform styles
text style Text styles that are uniformly
info applied to this text
vertical scale
percent Vertical scale of the first
character of this text
width
horizontal Width of the first character
measurement of this text
ZhuYin
plain text ZhuYin for this text
(string) (Traditional Chinese only)
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 75
REFERENCE MA TE RI AL F OR Q UA RK XP RE SS OBJECTS
OPEN TYPE ST YLE R ECORD PROPERTIES, DATA TYPES, AND DESCRIPTIONS
R/O PROPERTY N AME TYPE D ESCRIPTION
OT all small caps
in small caps
OT contextual alternates
OT
Boolean If
discretionary ligatures
OT figure
Boolean If
Boolean If
alternates feature is
discretionary ligatures
feature is turned on
tabular lining/ Specifies the type of figure
proportional used to display numerals old style/ proportional lining/tabular old style
OT fractions
OT ordinals
OT position
Boolean If
Boolean If
none/ Position of ordinal and
superscript/ fraction sequences subscript/ numerator/ denominator
OT small caps
OT standard ligatures
OT swashes
OT titling alternates
Boolean If
Boolean If
ligatures are applied
Boolean If
Boolean If are applied
true
, all characters are
true
, the contextual
turned on
true
, the optional/
true
, real fractions are substituted for fraction sequences
true
, superscripted or subscripted forms are substituted for ordinal sequences
true
, all characters are replaced by small caps characters
true
, standard
true
, swashes are applied
true
, titling alternates
MENU EVENTS AND E XAMPLES
VERB APPLESC RIPT EXAMPLE
select
get
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
76
|
select menu item “Append” of menu “File”
get name of menu 1
RE FE RE NC E MA TE RI AL F OR QUARKXPRESS OBJECTS
MENU ELEMENT S AND REFERENCE FORMS
BEFORE/
BY AFTER ELEMENT NUM ERIC BY BY BY SATISFYING A NOTHER CLASS INDEX ID NAME RANGE A TES T ELEMENT
menu item • •
MENU PROPERT IES, DATA TYPES, AND DE SCRIPTIONS
R/O P ROPERTY NAME TYPE DESCRIP TION
• ID small integer ID of this menu
index
integer Index of this menu
name
international Name of this menu
text
CHARACTER SP EC EV ENTS AND EXAMPLES
VERB APPLESC RIPT EXAMPLE
count
count every character spec
data size
delete
duplicate
get
get name of color of character spec 1
get as
make
move
set
set name of character spec 1 to “Header”
data size of name of character spec “Enhanced” as integer
delete character spec “BodyCopy”
duplicate character spec “Enhanced” to after character spec 3
get key character of character spec “Enhanced” as string
make character spec at beginning
move character spec “Enhanced” to before character spec 1
CHARACTER SP EC EL EMENTS AND REFEREN CE FORMS
None
CHARACTER SP EC PR OPERTIES, DATA TYP ES, AND DESCRIPTIO NS
R/O P ROPERTY NAME TYPE DESCRIP TION
base shift
base style
best type
class
color
base units Baseline shift of this
character spec Character spec (reference)
type class Best descriptor type
type class Class descriptor type
color spec Text color of this charac-
character spec
that this character spec is based on
ter spec
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 77
REFERENCE MA TE RI AL F OR Q UA RK XP RE SS OBJECTS
R/O PROPERTY N AME TYPE D ESCRIPTION
default type
font
plain text Name of the font of this
type class Default descriptor type
(string) character spec
horizontal scale
index
key character
integer Index of this object
percent Hhorizontal scale of this
plain text Keyboard command
(string) used to invoke this
key modifier
a list of Modifier keys, to use in
command/ conjunction with the shift/option/ key character control control (may use more than one)
language
lock
name
small integer Language of this
Boolean If
plain text Name of this character spec
(string)
object reference
opacity
open type style
properties
shade
size
style
track
uniqueID
vertical scale
reference Object reference for
this object
percent Opacity of this character spec
open type OpenType styles applied to
style record this character spec
record Property that allows getting
percent Shade of this character spec
fixed Text size for this
text style info Text styles for this
fixed Track amount for this
small integer A unique ID good for the
percent Vertical scale of this
character spec
character spec
character spec
true
, the character spec
is locked
a list of properties
in points
character spec
character spec
character spec
life of this character spec
character spec
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
78
|
RE FE RE NC E MA TE RI AL F OR QUARKXPRESS OBJECTS
COLOR SPEC E VENTS AND EXAMPLES
VERB APPLESC RIPT EXAMPLE
data size
delete
duplicate
get
get separation of color spec “NewCMYK”
get as
make
move
set
set name of color spec “Elizabeth” to“Mountain Purple”
data size of color spec “Mountain Purple” as integer
delete color spec “New Color”
duplicate color spec “Red” to after color spec “Blue”
get name of color spec 2 as string
make color spec at beginning
move color spec “Red” to after color spec “Blue”
COLOR SPEC E LEMEN TS AND REFERENCE F ORMS
None
COLOR SPEC P ROPER TIES, DATA TYPES, AND DESCRIPTIONS
R/O P ROPERTY NAME TYPE DESCRIP TION
CMYK color value
HSB color value
RGB color value
angle
best type
class
color type
CMYK color Representation of color in
CMYK space
HSB color Representation of color in
HSB space
RGB color Representation of color in
RGB space
fixed Screen angle
type class Best descriptor type
type class Class descriptor type
plain text Name of the color system
(string) associated with this color
default type
index
integer Index of the object
lock
Boolean If
locked
type class Default descriptor type
true
Boolean If
true
, this color is locked
, this color cannot
be modified
long name
plain text Long-form name,
(string) if applicable
name
plain text Name of the color
(string)
object reference
reference Object reference for
this object
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 79
REFERENCE MA TE RI AL F OR Q UA RK XP RE SS OBJECTS
R/O P ROPERTY NAME TYPE DESCRIP TION
properties
registration color
separation
short name
record Property that allows setting
Boolean If
registration color
Boolean If
plain text Short-form name,
(string) if applicable
UniqueID
small integer A unique ID good for the
COLOR SYSTEM EVEN TS AND EXAMPLES
VERB APPLESC RIPT EXAMPLE
data size
get
get name of color spec 1 of color system 1
get as
data size of color system “Pantone Coated” as integer
get name of color system 3 as string
of a list of properties
true
, this color is the
true
, separate into process
color components
life of the color
COLOR SYSTEM ELEM ENTS AND REFERENCE FORMS
BEFORE/
BY AFTER ELEMENT NUM ERIC BY BY BY SATISFYING A NOTHER CLASS INDEX ID NAME RANGE A TES T ELEMENT
color spec • • • • • •
COLOR SYSTEM PROP ERTIES, DATA TYPES , AND DESCRIPTIONS
R/O P ROPERTY NAME TYPE DESCRIP TION
best type
class
copyright
type class Best descriptor type
type class Class descriptor type
plain text Copyright notice, if any
(string)
default type
name
plain text Name of this color system
type class Default descriptor type
(string)
object reference
properties
reference Object reference for this
color system
record Property that allows getting
a list of properties
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
80
|
RE FE RE NC E MA TE RI AL F OR QUARKXPRESS OBJECTS
TABLE COLUMN EVEN TS AND EXAMPLES
VERB APPLESC RIPT EXAMPLE
count
count every generic cell of table column 1
delete
make
delete table column 1
make new table column at beginning
TABLE COLUMN ELEM ENTS AND REFERENCE FORMS
BEFORE/
BY AFTER ELEMENT NUM ERIC BY BY BY SATISFYING A NOTHER CLASS INDEX ID NAME RANGE A TES T ELEMENT
generic cell • • •
graphic cell • • •
picture cell • • •
text cell • • •
TABLE COLUMN PROP ERTIES, DATA TYPES , AND DESCRIPTIONS
R/O PROPERTY N AME TYPE D ESCRIPTION
width
horizontal Column width
measurement
maximum width
auto fit
horizontal Maximum width of
measurement the column
Boolean If
true
, the auto fit property
is applied to this column
TABLE ROW EV ENTS AND EXAMPLES
VERB APPLESC RIPT EXAMPLE
count count every table row of table box 1
TABLE ROW EL EMENT S AND REFERENCE FO RMS
BEFORE/
BY AFTER ELEMENT NUM ERIC BY BY BY SATISFYING A NOTHER CLASS INDEX ID NAME RANGE A TES T ELEMENT
generic cell • • •
graphic cell • • •
picture cell • • •
text cell • • •
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 81
REFERENCE MA TE RI AL F OR Q UA RK XP RE SS OBJECTS
TABLE ROW PR OPERT IES, DATA TYPES, A ND DESCRIPTIONS
R/O P ROPERTY NAME TYPE DESCRIP TION
auto fit
footer
header
height
Boolean If
Boolean If
Boolean If
vertical Row height
measurement
maximum height
vertical Maximum height of
measurement the row
HORIZONTAL G RIDLI NE EVENTS AND EXAM PLES
VERB APPLESC RIPT EXAMPLE
count count every horizontal gridline of table box 1
HORIZONTAL G RIDLI NE PROPERTIES, DAT A TYPES, AND DESCRIPTIONS
R/O PROPERTY NAME TYPE DESCRIPTION
color
color spec Color of this horizontal gridline
gap color
gap opacity
gap shade
opacity
shade
style
color spec Gap color of this horizontal gridline
perccent Gap opacity of this
perccent Gap shade of this horizonta gridline
percent Opacity of this horizontal gridline
percent Shade of this horizontal gridline
solid line/ Style of this horizontal gridline
sparsely dashed line/densely dashed line/ dashed line/ dotted line/ double line/ thin thick line/ thick thin line/ thin thick thin line/thick thin thick line/thin thin thin line
width
thick units Width of this horizontal gridline
true
, the auto fit property
is applied to this row
true
, this is a footer row
true
, this is a header row
horizontal gridline
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
82
|
RE FE RE NC E MA TE RI AL F OR QUARKXPRESS OBJECTS
VERTICAL GRI DLINE EVENTS AND EXAMPL ES
VERB APPLESC RIPT EXAMPLE
count count every vertical gridline of table box 1
VERTICAL GRI DLINE PROPERTIES, DATA TYPES, AND DESCRIP TIONS
R/O PROPERTY N AME TYPE D ESCRIPTION
color
color spec Color of this
horizontal gridline
gap color
color spec Gap color of this
horizontal gridline
gap opacity
perccent Gap opacity of this
horizontal gridline
gap shade
perccent Gap shade of this
horizontal gridline
opacity
percent Opacity of this
horizontal gridline
shade
percent Shade of this
horizontal gridline
style
solid line/ Style of this horizontal
sparsely gridline dashed line/ densely dashed line/ dashed line/ dotted line/ double line/ thin thick line/ thick thin line/ thin thick thin line/thick thin thick line/ thin thin thin line
width
thick units Width of this
horizontal gridline
CONTOUR EVEN TS AN D EXAMPLES
VERB APPLESC RIPT EXAMPLE
count
count every contour of shape path 1
data size
get
get inverted of contour 1
data size of bounds of contour as integer
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 83
REFERENCE MA TE RI AL F OR Q UA RK XP RE SS OBJECTS
CONTOUR ELEM ENTS AND REFERENCE FORM S
BEFORE/
BY AFTER ELEMENT NUM ERIC BY BY BY SATISFYING A NOTHER CLASS INDEX ID NAME RANGE A TES T ELEMENT
vertex • •
CONTOUR PROP ERTIE S, DATA TYPES, AND DESCRIPTIONS
R/O P ROPERTY NAME TYPE DESCRIP TION
bounds
measurements Bounds of this contour
rectangle
inverted
Boolean If
SHAPE PATH E VENTS AND EXAMPLES
VERB APPLESC RIPT EXAMPLE
get get bounds of shape path 1
true
, the contour moves counter clockwise, usually indicating a hole in a shape
SHAPE PATH E LEMEN TS AND REFERENCE F ORMS
BEFORE/
BY AFTER ELEMENT NUM ERIC BY BY BY SATISFYING A NOTHER CLASS INDEX ID NAME RANGE A TES T ELEMENT
contour • •
SHAPE PATH P ROPER TIES, DATA TYPES, AND DESCRIPTIONS
R/O P ROPERTY NAME TYPE DESCRIP TION
bounds
measurements Bounds of this shape path
rectangle
DEFAULT DOCU MENT EVENTS AND EXAMPLE S
VERB APPLESC RIPT EXAMPLE
count
count of every color spec of default document 1
data size
get
get page width of default document 1
get as
set
set auto constrain of default document 1 to true
data size of view scale of default document 1 as integer
get lock guides of default document 1 as string
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
84
|
RE FE RE NC E MA TE RI AL F OR QUARKXPRESS OBJECTS
DEFAULT DOCU MENT ELEMENTS AND REFER ENCE FORMS
BEFORE/ BY AFTER ELEMENT NUMERIC BY BY BY SATISFYING AN OTHER CLASS INDEX I D NAME RANGE A TEST ELEMENT
character spec • • • • •
color spec • • • • •
fontset spec • • • • • (East Asian only)
h and j spec • • • • •
style spec • • • • •
DEFAULT DOCU MENT PROPERTIES, DATA T YPES, AND DESCRIPTIONS
R/O PROPERTY N AME TYPE DESCRIPTION
auto constrain
Boolean If
true
, automatically constrain limits of items within boxes
auto kern
auto leading
auto page insertion location
Boolean If
true
, use auto kerning
percent Value for auto leading
no auto page Automatic page insertion
insertion/ location
end of story/
end of section/ end of document
auto picture import
off/auto pictures since last auto
auto import Automatically updates
import on/ import, depending on auto import the selection verify
automatic text box
Boolean If
true
, an automatic text
box is created for each
new page
automatic trap amount
auxiliary dictionary path
baseline grid increment
baseline grid showing
trap units/ Auto trap amount
overprint
alias Path of auxiliary dictionary
file for this layout
grid increments Baseline grid interval
unit
Boolean If
true
, baseline grid
is showing
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 85
REFERENCE MA TE RI AL F OR Q UA RK XP RE SS OBJECTS
R/O PROPERTY N AME TYPE DESCRIPTION
baseline grid start
measurement
best type
bottom margin
vertical Baseline grid start
type class Best descriptor type
vertical Height of the bottom
measurement margin of a page in
ciceros per centimeter
class
type class The class descriptor type
column count
default
fixed Number of ciceros
per centimeter
integer Number of columns in
small integer Default spread count
spread count
default type
facing pages
flex space width
fractional character widths
frame inside
greek below
greek pictures
guides in front
guides showing
gutter width
front of all boxes
type class Default descriptor type
Boolean If
percent Custom width space
Boolean If
using fractional widths
(default); if false, print
Boolean If
font units Text size below which to
Boolean If
Boolean If
Boolean If
horizontal Width of default text box’s
measurement gutter in this layout
horizontal measure
inches/inches Horizontal measurement
decimal/picas/ units
points/ millimeters/ centimeters/ ciceros/agates/Qs (East Asian only)
this layout
this layout
true
, create facing pages
true
, print characters
character widths using integral widths
true
, place frames inside
text or picture boxes
display text as gray lines
true
, display pictures as gray boxes
true
, place guides in
true
, guides are showing
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
86
|
RE FE RE NC E MA TE RI AL F OR QUARKXPRESS OBJECTS
R/O PROPERTY N AME TYPE DESCRIPTION
hyphenation method
standard Method of hyphenation
hyphenation/
enhanced hyphenation/ expanded hyphenation
ignore white
Boolean If
true
, specifies that an object color in front of multiple backgrounds that include white will not take white into account when trapping
indeterminate trap amount
trap units/ Value for trapping
overprint to indeterminate
background color
index
integer Index of object
inside margin
horizontal Location of the inside mar-
measurement gin of a page in this layout
(with facing pages true)
invisibles showing
item spread coords
keep master page items
Boolean If
true
, invisible
characters are showing
Boolean If
true
, display items
in spread coordinates
Boolean If
true
, modified master
items are kept or removed
when they are modified on the master page
kern above
font units Size of text above which
auto kerning should apply
knockout limit
percent Point at which an object
color knocks out of a background color
left margin
horizontal Width of the left margin
measurement of a page in this layout
ligatures on
standard/
no ligatures/ ligatures;
Standard
specifies
no ligatures
extra ligatures specifies that the document
does not use ligatures; extra
ligatures turns ligatures on and checks Standard Em Space in the Preferences dialog box
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 87
REFERENCE MA TE RI AL F OR Q UA RK XP RE SS OBJECTS
R/O PROPERTY N AME TYPE DESCRIPTION
lock guides
low quality blends
maintain leading
maximum ligature track
maximum view scale
minimum view scale
object reference
outside margin
Boolean If
Boolean If
blends (faster)
Boolean If
line that falls immediately
fixed Maximum amount that
that ligatures can be
percent Largest layout view using
the Zoom tool
percent Smallest layout view using
the Zoom tool
reference Object reference for
this object
horizontal Location of the outside
measurement margin of a page in this
layout (with facing
overprint limit
page height
percent Shade of color below which
overprinting will not occur
vertical Height of a page in
measurement this layout
page width
horizontal Width of a page in
measurement this layout
points per inch
process trap
properties
Q measurement
right margin
fixed Number of points per inch
Boolean If
record Property that allows getting
Boolean If
horizontal Width of the right margin
measurement of a page in this layout
true
, lock guides
true
, display banded
true
, the baseline of a
below an obstruction is placed according to its applied leading value
tracked or kerned apart before they break into separate characters
pages true)
true
, process trapping is on
a list of properties
true
, use Q for measurements (East Asian only)
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
88
|
RE FE RE NC E MA TE RI AL F OR QUARKXPRESS OBJECTS
R/O PROPERTY N AME TYPE DESCRIPTION
Roman Extra
percent Percent of the space
between Roman and Japanese characters (East Asian only)
rulers showing
small caps horizontal scale
small caps vertical scale
snap distance
Boolean If
true
, rulers
are showing
percent Horizontal scale value for
small cap characters
percent Vertical scale value for
small cap characters
small integer Distance within which
items snap to guides
spread height
vertical Height of a spread
measurement (including pasteboard)
in this layout
spread width
horizontal Width of a spread
measurement (including pasteboard)
in this layout
subscript horizontal scale
subscript offset
subscript vertical scale
superscript horizontal scale
superscript offset
superscript vertical scale
superior horizontal scale
superior vertical scale
top margin
percent Horizontal scale for
subscript characters
percent Offset for subscript
characters
percent Vertical scale for
subscript characters
percent Horizontal scale for
superscript characters
percent Offset for superscript
characters
percent Vertical scale for
superscript characters
percent Horizontal scale for
superior characters
percent Vertical scale for
superior characters
vertical Height of top margin of
measurement a page in this layout
trapping method
absolute trap/ Default trapping method
proportional trap/ knockout all
A GUIDE TO A PP LE E VE NT S SC RI PT IN G | 89
REFERENCE MA TE RI AL F OR Q UA RK XP RE SS OBJECTS
R/O PROPERTY N AME TYPE DESCRIPTION
typesetting leading mode
vertical measure
Boolean If
upward from the baseline
inches/ Vertical measurement units
inches decimal/
picas/points/
millimeters/ centimeters/ ciceros/agates/Qs (East Asian only)
view scale
fit page in Current view scale of window/ this layout fit spread in
window/ thumbnails, or percentage
view scale increment
story direction
percent Percent of change in view
for each mouse click using
Boolean If
direction is vertical (East
true
, leading is calculated
of one line of text to the baseline of the line above it; if false, specifies Word Proces sing mode, which measures leading downward from the top of the ascent to the line below it
the Zoom tool
true
, the default story
Asian only)
DELIMIT ITEM EVEN TS AND EXAMPLES
VERB APPLESC RIPT EXAMPLE
set
set delimit item “:” of delimit table 1 to can start or end word
get
get delimit item “:” of delimit table 1
DELIMIT ITEM ELEM ENTS AND REFERENCE FORMS
None
A GUIDE TO A PP LE E VE NT S SC RI PT IN G
90
|
Loading...