0% found this document useful (0 votes)
16 views

Illustrator AppleScript Scripting Reference

Uploaded by

hxert
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Illustrator AppleScript Scripting Reference

Uploaded by

hxert
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 347

ADOBE® ILLUSTRATOR®

ADOBE ILLUSTRATOR 2025


SCRIPTING REFERENCE:
APPLE SCRIPT
 2024 Adobe Incorporated. All rights reserved.

Adobe Illustrator 2025 Scripting Reference: AppleScript

If this guide is distributed with software that includes an end user agreement, this guide, as well as the software
described in it, is furnished under license and may be used or copied only in accordance with the terms of such license.
Except as permitted by any such license, no part of this guide may be reproduced, stored in a retrieval system, or
transmitted, in any form or by any means, electronic, mechanical, recording, or otherwise, without the prior written
permission of Adobe Incorporated. Please note that the content in this guide is protected under copyright law even if it
is not distributed with software that includes an end user license agreement.

The content of this guide is furnished for informational use only, is subject to change without notice, and should not be
construed as a commitment by Adobe Incorporated. Adobe Incorporated assumes no responsibility or liability for any
errors or inaccuracies that may appear in the informational content contained in this guide.

Please remember that existing artwork or images that you may want to include in your project may be protected under
copyright law. The unauthorized incorporation of such material into your new work could be a violation of the rights of
the copyright owner. Please be sure to obtain any permission required from the copyright owner.

Any references to company names in sample templates are for demonstration purposes only and are not intended to
refer to any actual organization.

Adobe, the Adobe logo, Acrobat, Illustrator, and Photoshop are either registered trademarks or trademarks of Adobe
Incorporated in the United States and/or other countries.

Microsoft and Windows are either registered trademarks or trademarks of Microsoft Corporation in the United States
and/or other countries. Apple, Mac, Macintosh, and Mac OS are trademarks of Apple Computer, Incorporated, registered
in the United States and other countries. JavaScript and all Java-related marks are trademarks or registered trademarks of
Sun Microsystems, Inc. in the United States and other countries. UNIX is a registered trademark of The Open Group.

All other trademarks are the property of their respective owners.

Adobe Incorporated, 345 Park Avenue, San Jose, California 95110, USA. Notice to U.S. Government End Users. The
Software and Documentation are “Commercial Items,” as that term is defined at 48 C.F.R. §2.101, consisting of
“Commercial Computer Software” and “Commercial Computer Software Documentation,” as such terms are used in 48
C.F.R. §12.212 or 48 C.F.R. §227.7202, as applicable. Consistent with 48 C.F.R. §12.212 or 48 C.F.R. §§227.7202-1 through
227.7202-4, as applicable, the Commercial Computer Software and Commercial Computer Software Documentation are
being licensed to U.S. Government end users (a) only as Commercial Items and (b) with only those rights as are granted
to all other end users pursuant to the terms and conditions herein. Unpublished-rights reserved under the copyright
laws of the United States. Adobe Incorporated, 345 Park Avenue, San Jose, CA 95110-2704, USA. For U.S. Government End
Users, Adobe agrees to comply with all applicable equal opportunity laws including, if appropriate, the provisions of
Executive Order 11246, as amended, Section 402 of the Vietnam Era Veterans Readjustment Assistance Act of 1974 (38
USC 4212), and Section 503 of the Rehabilitation Act of 1973, as amended, and the regulations at 41 CFR Parts 60-1
through 60-60, 60-250, and 60-741. The affirmative action clause and regulations contained in the preceding sentence
shall be incorporated by reference.
Contents

1 AppleScript Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
artboard, artboards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
AutoCAD export options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
AutoCAD options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
brush, brushes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
character . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
character style, character styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
CMYK color info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
color info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
color management options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
color separation options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
compound path item, compound path items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
coordinate options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
dataset, datasets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
document, documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
document preset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
ellipse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
EPS save options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
ExportForScreens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
flattening options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
font options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
FreeHand options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
FXG save options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
GIF export options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
gradient, gradients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
gradient color info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
gradient stop, gradient stops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
gradient stop info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
graph item, graph items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
graphic style, graphic styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
gray color info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
grid repeat config . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
grid repeat item, grid repeat items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

3
Contents 4

grid repeat, aeadd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74


group item, group items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Illustrator preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Illustrator save options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
image capture options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
ink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
ink properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
insertion point . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
job options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
JPEG export options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Lab color info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
layer, layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
legacy text item, legacy text items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
mesh item, mesh items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
no color info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
non native item, non native items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
open options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
page item, page items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
page marks options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
paper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
paper options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
paper properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
paragraph, paragraphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
paragraph style, paragraph styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
path item, path items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
path point, path points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
path point info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
pattern, patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
pattern color info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
PDF options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
PDF save options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
Photoshop export options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
Photoshop options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
placed item, placed items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
plugin item, plugin items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
PNG8 export options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Contents 5

PNG24 export options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155


polygon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
postscript options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
PPD file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
PPD properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
print options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
printer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
printer properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
radial repeat config . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
radial repeat item, radial repeat items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
radial repeat, aeadd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
raster effect options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
raster item, raster items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
rasterize options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
rectangle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
RGB color info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
rounded rectangle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
screen properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
screen spot function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
separation screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
spot, spots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
spot color info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
star . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
story, stories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
SVG export options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
swatch, swatches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
swatchgroup, swatchgroups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
symbol, symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
symbol item, symbol items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
symmetry repeat config . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
symmetry repeat item, symmetry repeat items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
symmetry repeat, aeadd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
tab stop info, tab stops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
tag, tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
text font, text fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
text frame, text frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
text path item, text path items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
Contents 6

TIFF export options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210


tracingobject, tracings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
tracing options, multiple tracing options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
variable, variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
view, views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
WebP export options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
word . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219

2 AppleScript Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227


Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
activate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
add document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
add spot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
add swatch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
apply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
apply character style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
apply paragraph style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
arrange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
bring in perspective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
capture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
change case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
close . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
colorize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
concatenate matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
concatenate rotation matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
concatenate scale matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
concatenate translation matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
convert . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
convert area object to point object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
convert coordinate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
convert point object to area object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
convert sample color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
convert to paths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
copy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
count . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
cut . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
delete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
delete preference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
Contents 7

delete workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256


deselect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
do javascript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
do script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
duplicate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
equal matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
embed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
exists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
expand tracing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
export . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
export PDF preset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
export perspective grid preset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
export print preset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
export variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
fit artboard to selected art . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
get . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
get all swatches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
get boolean preference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
get identity matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
get internal color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
get integer preference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
get perspective active plane . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
get PPD info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
get preset file of . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
get preset settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
get real preference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
get rotation matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
get scale matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
get screen mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
get scriptable help group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
get selected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
get string preference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
get translation matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
get view mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
hide perspective grid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
image capture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
import character styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
Contents 8

import paragraph styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294


import PDF preset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
import perspective grid preset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
import print preset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
import variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
invert matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
is ruler visible . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
is transparency grid visible . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
launch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
load color settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
load preset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
make . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
merge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
move . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
open . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
paste . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
print . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
quit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
rasterize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
rearrange artboards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
redo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
redraw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
release tracing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
relink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
reset workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
rotate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
save . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320
save workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
scale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
select . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
select objects on active artboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
select perspective preset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
set boolean preference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
set integer preference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328
set perspective active plane . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
set real preference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
set string preference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
Contents 9

set grid configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332


write as library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
set radial configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334
set symmetry configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
show perspective grid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
show presets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337
singular matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338
store preset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
switch workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
trace placed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
trace raster . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
translate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344
translate placeholder text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
undo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
update . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
1 AppleScript Objects

This chapter provides a complete, alphaetical reference for the objects and commands in the Adobe®
Illustrator® AppleScript dictionary. For each object, the following information is provided:

 Elements that can be contained within the object.

 Properties of the object, with read-only status, value type, and a description.

 Valid commands, with links to sections in Chapter 2, “AppleScript Commands, which describes all
commands in the Illustrator dictionary.

 Notes to explain special issues.

 Script examples. These example are intended to illustrate concepts; they do not necessarily represent
the best or most efficient way to construct an AppleScript script. Little error checking was done on
them. They assume that the proper context exists for the scripts to execute in; for instance, that there
is a document open or items selected.

For an overview of the Illustrator object model, see Adobe Illustrator 2025 Scripting Guide.

10
CHAPTER 1: AppleScript Objects application 11

application
The Adobe Illustrator application object, which contains all other Illustrator objects.

application elements

Elements Refer to by
document name, numeric index, range of elements, before/after another element, satisfying a test
text fonts numeric index, range of elements, before/after another element, satisfying a test

application object properties

Property Value type What it is


best type type class Read-only. The best type for the
application object’s value. Always
returns reference.
browser available boolean Read-only. If true, a web browser is
available.
build number string Read-only. The application’s build
number.
class type class Read-only. The object’s class, which is
application.

color settings list of Unicode text Read-only. The list of color-settings files
currently available for use.
coordinate system Valid values: Coordinate system currently in use.
document coordinate system
artboard coordinate system

current document document The active (frontmost) document in


Illustrator.
default color file specification Read-only. The default color-settings file
settings for the current application locale.
default type type class Read-only. The default type for the
application object’s value. Always
returns reference.
flattener presets list of Unicode text Read-only. The list of flattener style
names currently available for use.
free memory integer Read-only. The amount of unused
memory (in bytes) within the Illustrator
partition.
CHAPTER 1: AppleScript Objects application 12

Property Value type What it is


frontmost boolean Read-only. If true, this is the frontmost
(active) application.
locale string Read-only. The application’s locale.
name Unicode text Read-only. The application’s name (not
related to the filename of the
application file). Always returns "Adobe
Illustrator 2025".

paste remembers boolean When true, paste operations maintain


layers layer structure.
PDF presets list of Unicode text Read-only. The list of preset PDF-options
names available for use.
PPDs list of PPD files Read-only. The list of PPD files currently
available for use. (A document must be
open or an error is returned).
print presets list of Unicode text Read-only. The list of preset
printing-options names available for
use.
printers list of printers Read-only. The list of installed printers
currently available for use. (A document
must be open or an error is returned).
properties record All the application’s properties returned
in a single record. Properties that are
individually read-only remain so in this
record.
scripting version Unicode text Read-only. The version of the Scripting
plug-in.
CHAPTER 1: AppleScript Objects application 13

Property Value type What it is


selection anything All currently selected objects in the
active (frontmost) document.

Illustrator does not support the select


command to change the application’s
current selection. Use set the
selection to in place of select. See
the examples below.

The application’s selection can be


accessed and modified. When there are
no selected objects, selection contains
an empty list, {}. To deselect all objects
in the current document, set selection
to an empty list.

When there is an active insertion point


in the contents of a text frame,
selection returns a reference to the
insertion point. When characters are
selected in the contents of a text frame,
selection returns a reference to the
range of text.
settings Illustrator preferences Read-only. Preferences for the Illustrator
application.

startup presets list of Unicode text Read-only. The list of preset


printing-options names available for
use.
tracing presets list of Unicode text Read-only. The list of preset
tracing-options names available for use.
user interaction Valid values: The level of interaction with the user
level interact with all that is allowed when handling script
interact with local commands. Default: interact with all
interact with self
never interact

version Unicode text Read-only. The version of the Adobe


Illustrator application.

application commands
activate
convert sample color
copy
cut
do script
delete workspace
get preset file of
get screen mode
is ruler visible
CHAPTER 1: AppleScript Objects application 14

paste
quit
redraw
reset workspace
save workspace
switch workspace

Select an object
-- Select the first object in the document
tell application "Adobe Illustrator"
-- Make sure there is a page item to select
if (document 1 exists) and (page item 1 of document 1 exists) then
set the selection to page item 1 of document 1
end if
end tell

Copy and paste a selection

You do not need to make objects part of the selection to act on them. Selection is useful for moving
objects to and from the clipboard using the cut, copy and paste commands, which act on the current
selection.

Note that Illustrator must be the front-most application when executing commands that involve the
clipboard. This example brings Illustrator to the front using AppleScript’s activate command.
-- Copy current selection to clipboard then paste into a new doc
tell application "Adobe Illustrator"
-- If Illustrator is not the frontmost application, activate it.
if not frontmost then activate
-- Make sure there is a document to copy from
if (count documents) > 0 then
set selectedItems to selection of current document
if selectedItems is not {} then
copy
set colorSpace to color space of current document
make new document with properties {color space:colorSpace}
paste
end if
end if
end tell
CHAPTER 1: AppleScript Objects artboard, artboards 15

artboard, artboards
An artboard object or list of artboard objects. An artboard object represents a single artboard in a
document. There can be between 1 to 100 artboards in one document. You cannot delete the last artboard
in a document.

artboard object properties

Property Value type What it is


artboard rectangle rect Size and position of the artboard.
best type type class Read-only. The best type for the artboard object’s
value. Always returns reference.
class type class Read-only. The object’s class, which is artboard.
container object reference Read-only. A reference to the document that contains
this artboard.
default type type class Read-only. The default type for the artboard object’s
value. Always returns reference.
index integer Read-only. The index of this artboard.
name text The unique identifying name of this artboard.
properties record The properties of this object, returned as a record.
ruler origin point Ruler origin of the artboard, relative to the top left
corner of the artboard.
ruler PAR number (double) Pixel aspect ratio, used in ruler visualization if the units
are pixels. Range: 0.1 to 10.0
show center boolean Show center mark.
show cross hairs boolean Show cross hairs.
show safe areas boolean Show title and action safe areas (for video).
CHAPTER 1: AppleScript Objects AutoCAD export options 16

AutoCAD export options


Options for exporting to an AutoCAD drawing, used with the save command.

AutoCAD export options object properties

Property Value type What it is


alter paths for boolean If true, alter paths if needed to maintain
appearance appearance. Default: false
colors Valid values: Number of colors to export into AutoCAD file.
max 8 colors
max 16 colors
max 256 colors
true colors

convert text to boolean If true, convert text to outlines. Default: false


outlines

export file format Valid values: The format to export to. Default: DWG
dxf
DWG

export option Valid values: Whether to preserve appearance or editability


maintain appearance during export. Default: maximize editability
maximize editability

export selected art boolean If true, export only selected artwork.


only Default: false
raster format Valid values: Format in which to export raster art.
PNG raster
JPEG raster

scale lineweights boolean If true, scale line weights by the same scaling
factor as the rest of the drawing. Default: false
scale unit Valid values: Measurement units from which to map.
autocad points
autocad picas
autocad inches
autocad millimeters
autocad centimeters
autocad pixels

scale ratio number (double) Ratio by which to scale output.


AutoCAD version Valid values: The release of AutoCAD to export to.
AutoCAD release 13 Default: AutoCAD release 24
AutoCAD release 14
AutoCAD release 15
AutoCAD release 18
AutoCAD release 21
AutoCAD release 24
CHAPTER 1: AppleScript Objects AutoCAD options 17

AutoCAD options
Options for opening an AutoCAD drawing, used with the open command.

AutoCAD options object properties

Property Value type What it is


center artwork boolean If true, center the artwork that is created on the
artboard. Default: true
container object reference Read-only. A reference to the document that
contains this object.
global scale option Valid values: How to scale the drawing on import. Default: fit
original size artboard
fit artboard
scale by value

global scale integer The value when global scale option is scale by
percent value, expressed as a percentage. Range: 0.0 to
100.0 Default: 100.0
merge layers boolean If true, the layers of the artwork are merged.
Default: false
scale lineweights boolean If true, scale line weights by the same factor as the
rest of the drawing. Default: false
scale ratio integer The ratio by which to scale while mapping units.
Default: 1.0
scale unit Valid values: The unit to map to. Default: autocad millimeters
autocad points
autocad picas
autocad inches
autocad millimeters
autocad centimeters
autocad pixels

selected layout Unicode text Name of the layout in the drawing to import.
name
CHAPTER 1: AppleScript Objects brush, brushes 18

brush, brushes
A brush or list of brushes. Brushes are contained in document objects. Scripts cannot create new brushes.

brush object properties

Property Value type What it is


best type type class Read-only. The best type for the brush object’s value. Always
returns reference.
class type class Read-only. The object’s class, which is brush.
container object reference Read-only. A reference to the document that contains this brush.
default type type class Read-only. The default type for the brush object, which is
reference.

index integer Read-only. The index of this brush.


name Unicode text The name of this brush.
properties record All properties of this object returned as a record.

brush object commands


apply
count
exists

Apply brushes
-- Duplicate the current selection (if it is a single item)
-- and apply each available brush to the new object
tell application "Adobe Illustrator" to ¬
set selectedItems to selection

-- Check for selection of single non-text object


if class of selectedItems is text or (count items of selectedItems) is not 1 then
display dialog "Select a single path item before running this script"
else
tell application "Adobe Illustrator"
set pathItem to item 1 of selectedItems
-- Get the item's position and use it to tile the new items below
set {itemX, itemY} to position of pathItem
-- Get a list of all brushes and apply each brush to the selectec item
set brushList to every brush of current document
-- Get coordinates of upper-left of document
set docLeft to 0
set docTop to height of current document
set brushCount to count items of brushList
repeat with i from 1 to brushCount
set aBrush to item i of brushList
set itemOffset to i * 20 -- use to tile the duplicated items
-- Duplicate the selected path item, tiling them from the
CHAPTER 1: AppleScript Objects brush, brushes 19

-- upper-left of the document


set pathRef to duplicate pathItem to beginning of current document ¬
with properties {position:{docLeft + itemOffset, docTop - itemOffset}}
-- Must clear the document's selection before applying a brush
-- since the duplicate above seems to add to it each time through
set selection of current document to {}
apply aBrush to pathRef
end repeat
end tell
end if
CHAPTER 1: AppleScript Objects character 20

character
Specifies the properties of a character. The text contained within text frames in Illustrator can be accessed
using the character, insertion point, word, line, paragraph, and text classes. The properties and
valid commands for all these classes are similar, but not identical. For example, while character has a
kerning property, the other text classes do not.

character object elements

Elements Refer to by
character style name, numeric index, range of elements, before/after another element, satisfying
a test
character numeric index, range of elements, before/after another element, satisfying a test
insertion point numeric index, range of elements, before/after another element, satisfying a test
line numeric index, range of elements, before/after another element, satisfying a test
paragraph style name, numeric index, range of elements, before/after another element, satisfying
a test
paragraph numeric index, range of elements, before/after another element, satisfying a test
text numeric index, range of elements, before/after another element, satisfying a test
word numeric index, range of elements, before/after another element, satisfying a test

character object properties

Property Value type What it is


aki left real The amount of inter-glyph space added
to the left side of the glyph in Japanese
text (in thousandths of an em).
aki right real The amount of inter-glyph spacing
added to the right side of the glyph in
Japanese text (in thousandths of an
em).
alignment Valid values: The character alignment type.
bottom
center
icf bottom
icf top
roman baseline
top
CHAPTER 1: AppleScript Objects character 21

Property Value type What it is


alternate glyphs Valid values: Specifies which kind of alternate glyphs
default to use.
expert
full width
half width
jis78
jis83
proportional width
quarter width
third width
traditional
jis90
jis04

auto leading boolean If true, use automatic leading.


baseline direction Valid values: The Japanese text baseline direction.
standard
Tate Chu Yoko
vertical rotated

baseline position Valid values: The baseline position of text.


normal
subscript
superscript

baseline shift real The amount of shift (in points) of the


text baseline.
best type type class Read-only. The best type for the
object’s value.
capitalization Valid values: Specifies whether the text is normal, all
all caps uppercase, all small caps, or a mix of
all small caps small caps and lowercase.
normal
small caps

character offset integer Offset of the first character.


class type class Read-only. The object’s class.
connection forms boolean If true, use the OpenType® connection
forms.
container reference Read-only. The object’ s container.
contents Unicode text The text content.
contextual boolean If true, use the contextual ligature.
ligature

default type type class Read-only. The default type for the
object’s value.
discretionary boolean If true, use the discretionary ligature.
ligature
CHAPTER 1: AppleScript Objects character 22

Property Value type What it is


figure style Valid values: Specifies the figure style to use in an
default OpenType font.
proportional
proportional oldstyle
tabular
tabular oldstyle

fill color color info The color of the text fill.


fractions boolean If true, use OpenType fractions.
horizontal scale real The horizontal scaling factor for the
character.
index integer Read-only. The index of this instance of
the object.
italics boolean If true, the Japanese OpenType
supports italics.
kerning integer Controls the spacing between two
characters, in thousandths of an em
space.
kerning method Valid values: The type of automatic kerning method
none to use.
Auto
Optical
metricsromanonly
CHAPTER 1: AppleScript Objects character 23

Property Value type What it is


language Valid values: The language.
Bokmal Norwegian
Brazillian Portuguese
Bulgarian
Canadian French
Catalan
Chinese
Czech
Danish
Dutch
Dutch 2005 Reform
English
Finnish
German 2006 Reform
Greek
Hungarian
Icelandic
Italian
Japanese
Nynorsk Norwegian
old German
Polish
Romanian
Russian
Spanish
Serbian
standard French
standard German
standard Portuguese
Swedish
Swiss German
Swiss German 2006 Reform
Turkish
UK English
Ukranian

leading real The amount of space between two


lines of text, in points.
length integer The length (in characters). Minimum: 0
ligature boolean If true, use the ligature.
no break boolean If true, no break is allowed.
ordinals boolean If true, use the OpenType ordinals.
ornaments boolean If true, use the OpenType ornaments.
overprint fill boolean If true, overprint the fill of the text.
overprint stroke boolean If true, overprinting of the stroke of the
text is allowed.
properties record All properties of this object returned as
a record.
CHAPTER 1: AppleScript Objects character 24

Property Value type What it is


proportional boolean If true, Japanese OpenType supports
metrics proportional fonts.
rotation real The character rotation angle in
degrees.
selection text or list of text Read-only. The selected text.
size real The font size in points.
story story Read-only. The story that contains the
object.
strike through boolean If true, characters use strike-through
style.
stroke color color info The color of the text stroke.
stroke weight real Line width of stroke.
stylistic boolean If true, use OpenType stylistic
alternates alternates.
swash boolean If true, use the OpenType swash
character.
TCY horizontal integer The Tate-Chu-Yoko horizontal
adjustment in points.
TCY vertical integer The Tate-Chu-Yoko vertical adjustment
in points.
text font text font The text font.
titling boolean If true, use the OpenType titling
alternates.
tracking integer The tracking or range kerning amount
in thousandths of an em.
Tsume real The percentage of space reduction
around a Japanese character.
underline boolean If true, characters use underline style.
vertical scale real Character vertical scaling factor,
expressed as a percentage (100 is
100%).
warichu characters long How the characters in Wari-Chu text (an
after break inset note in Japanese text) are divided
into two or more lines.
warichu characters long How the characters in Wari-Chu text (an
before break inset note in Japanese text) are divided
into two or more lines.
CHAPTER 1: AppleScript Objects character 25

Property Value type What it is


warichu enabled boolean If true, Wari-Chu is enabled.
warichu gap integer The Wari-Chu line gap in points.
warichu Valid values: The Wari-Chu justification.
justification auto justify
center
full justify last line center
full justify
full justify last line left
full justify last line right
left
right

warichu lines integer The number of Wari-Chu (multiple text


lines fit into a space meant for one)
lines.
warichu scale real The Wari-Chu scale.

character object commands


apply character style
change case
count
delete
deselect
duplicate
exists
make
move
select

Make selected text superscript


-- Make the currently selected text superscript
tell application "Adobe Illustrator"
-- Make sure one or more characters of text are selected
set selectedText to selection of current document
if class of selectedText is text or ¬
class of selectedText is character then
-- Adjust the properties of the selected text to superscript it
set fontSize to size of selectedText
set fontBaseline to baseline shift of selectedText
set properties of selectedText to ¬
{size:fontSize / 2, baseline shift:fontBaseline + (fontSize / 2)}
end if
end tell
CHAPTER 1: AppleScript Objects character 26

Stretch characters

This example demonstrates how to use character properties to create unique effects from a script.
--Distort every character in the first text frame of a document
--by decreasing the horizontal scaling of each character to the midpoint
--then increasing from the mid point to the end (a smaller value here
--means more difference between largest and smallest horizontal
--scaling of the characters)
tell application "Adobe Illustrator"
-- Is there is a document and a text frame to work with
if (exists text frame 1 of current document) then
-- Make sure the text frame contains some text
set textframe to first text frame of current document
if textframe is not "" then -- contains some text
-- Gather info needed to calculate the scale factor
set characterCount to count characters in textframe
set factor to (characterCount + 1) / 2
-- Iterate over each character, changing its horizontal scale
repeat with i from 1 to characterCount
set hScaling to (factor - i) / factor
if hScaling < 0 then set hScaling to -hScaling
set widthScale to 100 + 100 * hScaling
set horizontal scale of character i of text frame 1 of document 1 to
widthScale
end repeat
end if
end if
end tell
CHAPTER 1: AppleScript Objects character style, character styles 27

character style, character styles


A named style that specifies character attributes.

NOTE: Character attributes do not have default values, and are undefined until explicitly set.

character style object properties

Property Value type What it is


aki left real The left aki (in thousandths of an em).
aki right real The right aki (in thousandths of an em).
alignment Valid values: The character alignment type.
bottom
center
icf bottom
icf top
roman baseline
top

alternate glyphs Valid values: The alternate glyphs form.


default
Traditional
Expert
jis78
jis83
half width
third width
quarter width
full width
proportional width
jis90
jis04

alternate boolean If true, use the alternate ligature.


ligature

auto leading boolean If true, use automatic leading.


baseline Valid values: The Japanese text baseline direction.
direction standard
Tate Chu Yoko
vertical rotated

baseline position Valid values: The baseline position of text.


normal
subscript
superscript

baseline shift real The amount of shift (in points) of the text
baseline.
best type type class Read-only. The best type for the object’s
value.
CHAPTER 1: AppleScript Objects character style, character styles 28

Property Value type What it is


capitalization Valid values: The case of the text.
all caps
all small caps
normal
small caps

class type class Read-only. The object’s class.


connection forms boolean If true, use the OpenType connection
forms.
contextual boolean If true, use the contextual ligature.
ligature

container reference Read-only. The object’s container.


default type type class Read-only. The default type for the
object’s value.
discretionary boolean If true, use the discretionary ligature.
ligature

figure style Valid values: Specifies which figure style to use in the
default OpenType font.
proportional
proportional oldstyle
tabular
tabular oldstyle

fill color color info The color of the text fill.


fractions boolean If true, use the OpenType fractions.
horizontal scale real Character horizontal scaling factor
expressed as a percentage (100 = 100%).
index integer Read-only. The index of this instance of
the object.
italics boolean If true, the Japanese OpenType supports
italics.
kerning method Valid values: The automatic kerning method to use.
auto
none
optical
metricsromanonly
CHAPTER 1: AppleScript Objects character style, character styles 29

Property Value type What it is


language Valid values: The language.
Bokmal Norwegian
Brazillian Portuguese
Bulgarian
Canadian French
Catalan
Chinese
Czech
Danish
Dutch
Dutch 2005 Reform
English
Finnish
German 2006 Reform
Greek
Hungarian
Icelandic
Italian
Japanese
Nynorsk Norwegian
old German
Polish
Romanian
Russian
Spanish
Serbian
standard French
standard German
standard Portuguese
Swedish
Swiss German
Swiss German 2006 Reform
Turkish
UK English
Ukranian

leading real The amount of space between two lines


of text, in points.
ligature boolean If true, use the ligature.
name Unicode text The character style’s name.
OpenType position Valid values: The OpenType font baseline position.
default
denominator
numerator
subscript
superscript

ordinals boolean If true, use the OpenType ordinals.


ornaments boolean If true, use the OpenType ornaments.
overprint fill boolean If true, the fill of the text should be
overprinted.
CHAPTER 1: AppleScript Objects character style, character styles 30

Property Value type What it is


overprint stroke boolean If true, the stroke of the text should be
overprinted.
properties record All properties of this object returned as a
record.
proportional boolean If true, the Japanese OpenType font
metrics supports proportional glyphs.
rotation real The character rotation angle in degrees.
size real The font size in points.
strike through boolean If true, characters use strike-through
style.
stroke color color info The color of the text stroke.
stroke weight real The line width of the stroke.
stylistic boolean If true, use the OpenType stylistic
alternates alternates.
swash boolean If true, use the OpenType swash glyph.
TCY horizontal integer The Tate-Chu-Yoko horizontal
adjustment in points.
TCY vertical integer The Tate-Chu-Yoko vertical adjustment in
points.
text font text The text font.
titling boolean If true, use the OpenType titling
alternates.
tracking integer The tracking or range kerning amount in
thousands of an em.
Tsume real The percentage of space reduction
around a Japanese character (100 =
100%).
underline boolean If true, characters use underline style.
vertical scale real The character vertical scaling factor
expressed as a percentage (100 = 100%).
warichu integer How the characters in Wari-Chu text (an
characters after inset note in Japanese text) are divided
break into two or more lines.
warichu integer How the characters in Wari-Chu text (an
characters before inset note in Japanese text) are divided
break into two or more lines.
warichu enabled boolean If true, Wari-Chu is enabled.
CHAPTER 1: AppleScript Objects character style, character styles 31

Property Value type What it is


warichu gap integer The Wari-Chu line gap.
warichu Valid values: The Wari-Chu justification.
justification auto justify
center
full justify last line center
full justify
full justify last line left
full justify last line right
left
right

warichu lines integer The number of Wari-Chu (multiple text


lines fit into a space meant for one) lines.
warichu scale real The Wari-Chu scale.

Character styles
-- Create a document with text frames containing text, then create and apply the same
character style to all
tell application "Adobe Illustrator"
activate
make new document
make new text frame in document 1 with properties {name:"text 1",
contents:"Scripting is fun!", position:{50, 100}}
make new text frame in document 1 with properties {name:"text 2",
contents:"Scripting is easy!", position:{100, 200}}
make new text frame in document 1 with properties {name:"text 3", contents:"Everyone
should script!", position:{150, 300}}
make new character style in document 1 with properties {name:"Big Red"}
set the size of character style "Big Red" of document 1 to 40
set the tracking of character style "Big Red" of document 1 to -50
set the capitalization of character style "Big Red" of document 1 to all caps
set the fill color of character style "Big Red" of document 1 to {class:RGB color
info, red:255, green:0, blue:0}
-- 'apply character style' is the event.
-- 'character style "Big Red" of document 1' is the style applied.
-- note that character styles must be applied to text ranges.
apply character style character style "Big Red" of document 1 to the text range of
text frame "text 1" of document 1
apply character style character style "Big Red" of document 1 to the text range of
text frame "text 2" of document 1
apply character style character style "Big Red" of document 1 to the text range of
text frame "text 3" of document 1
end tell
CHAPTER 1: AppleScript Objects CMYK color info 32

CMYK color info


A CMYK color specification, used to specify a CMYK color where a color info object is required. This class
contains the color component values of a CMYK color. Use it to specify and get color information from an
Illustrator document or page items.

If the color space of a document is RGB and you specify the color value for a page item in that document
using CMYK color info, Illustrator translates the CMYK color specification into an RGB color specification.
The same thing happens if the document’s color space is CMYK and you specify colors using
RGB color info. Since this translation can cause information loss you should specify colors using the color
info class that matches the document’s color space.

CMYK color info object properties


This class inherits all properties from the color info class.

Property Value type What it is


cyan real The cyan color value. Range: 0.0 to 100.0. Default: 0.0.
magenta real The magenta color value. Range: 0.0 to 100.0. Default: 0.0.
yellow real The yellow color value. Range: 0.0 to 100.0. Default: 0.0.
black real The black color value. Range: 0.0 to 100.0. Default: 0.0.

Create a color swatch


-- Make a new CYMK color swatch in the current document
tell application "Adobe Illustrator"
if not (exists swatch "Our CMYK Swatch" in current document) then
set swatchColor to {cyan:50.0, magenta:20.0, yellow:20.0, black:0.0}
make new swatch at end of current document with properties ¬
{name:"Our CMYK Swatch", color:swatchColor}
end if
end tell
CHAPTER 1: AppleScript Objects color info 33

color info
An abstract parent class for all color classes used in Illustrator. Subclasses are:
CMYK color info
gradient color info
gray color info
Lab color info
no color info
pattern color info
RGB color info
spot color info
CHAPTER 1: AppleScript Objects color management options 34

color management options


Specifies the color management options when printing a document with the print command.

color management options object properties

Property Value type What it is


intent Valid values: The color management intent type.
absolute colorimetric Default: relative colorimetric
perceptual
relative colorimetric
saturation

name Unicode text The color management profile name.


profile kind Valid values: The color management profile mode.
custom profile Default: source profile
oldstyle profile
printer profile
source profile
CHAPTER 1: AppleScript Objects color separation options 35

color separation options


Print color separation options when printing a document with the print command.

color separation options object properties

Property Value type What it is


convert spot colors boolean If true, all spot colors are converted to process
colors. Default: false
inks list of ink The list of inks for color separation.
over print black boolean If true, black is overprinted. Default: false
separation mode Valid values: The color separation type. Default: composite
composite
InRIP separation
host based separation
CHAPTER 1: AppleScript Objects compound path item, compound path items 36

compound path item, compound path items


A compound path or list of compound paths. Compound paths are objects that contain two or more paths
that are painted so that holes appear where paths overlap.

All paths in a compound path share property values. Therefore, if you set the value of a property of any one
of the paths in the compound path, all other path’s matching property will be updated to the new value.

Paths contained within a compound path or group in a document are returned as individual paths when a
script asks for the paths contained in the document. However, paths contained in a compound path or
group are not returned when a script asks for the paths in a layer which contains the compound path or
group.

compound path item object elements

Element Refer to by
path item name, numeric index, range of elements, before/after another element, satisfying a test

compound path item object properties


This object class inherits all properties from the page item class.

Property Value type What it is


properties record All properties of this object returned as a record.

compound path item object commands


count
delete
duplicate
exists
make
move
rotate
scale
transform
translate
CHAPTER 1: AppleScript Objects compound path item, compound path items 37

Get paths
-- get paths in a document that are not part of a compound path or group
tell application "Adobe Illustrator"
set docRef to current document
set pathItemList to {}
set layerCount to count layers of docRef

repeat with i from 1 to layerCount


set pathItemList to pathItemList & every path item of layer i of docRef
end repeat
set selection to pathItemList
end tell
get pathItemList

Duplicate and group paths from a compound path


-- Create a group containing a set of paths duplicated from the
-- first compound path item of the document
tell application "Adobe Illustrator"
set pathItemList to every path item of compound path item 1 of current document
set groupRef to make new group item at beginning of layer 1 of document 1
duplicate pathItemList to beginning of groupRef
end tell
CHAPTER 1: AppleScript Objects coordinate options 38

coordinate options
The print coordinate options when printing a document with the print command.

coordinate options object properties

Property Value type What it is


emulsion boolean If true, flip the artwork horizontally. Default: false
fit to page boolean If true, proportionally scale the artwork to fit on media.
Default: false
horizontal scale real The horizontal scaling factor. 100.0 = 100%.
Range: 1.0 to 10000.0. Default: 100.0.
orientation Valid values: The artwork orientation. Default: portrait
landscape
portrait
reverse landscape
reverse portrait
auto rotate

position Valid values: The artwork position on media. Default: center


bottom
bottom left
bottom right
center
left
right
top
top left
top right

tiling Valid values: The page tiling mode. Default: single full page
full pages
imageable areas
single full page

vertical scale real The vertical scaling factor. 100.0 = 100%.


Range: 1.0 to 10000.0. Default: 100.0.
CHAPTER 1: AppleScript Objects dataset, datasets 39

dataset, datasets
An object, or list of objects, that contains variables and their dynamic data.

dataset object properties

Property Value type What it is


best type type class Read-only. The best type for the dataset’s value. Always returns
reference.

class type class Read-only. The object’s class, which is dataset.


container object Read-only. A reference to the art item that contains this data set.
reference
default type type class Read-only. The default type for the data set. Always returns
reference.

index integer Read-only. The index of this data set in the art item.
name Unicode text The name of the dataset.
properties record All properties of this object returned as a record.

dataset object commands


count
delete
display
exists
make
update

Datasets and variables


-- Activate Illustrator
-- Make a new document
-- Make two variables, one of kind visibility and the other textual
-- Make a rectangle and a text frame, and attach the respective variables
-- Set the color of the rectangle and the contents of the text frame
-- Make the first dataset
-- Change the contents of the text and the visibility of the rectangle
-- Make the second dataset
-- display the two datasets
tell application "Adobe Illustrator"
activate
make new document
make new variable in document 1 with properties {name:"RecVariable",
kind:visibility}
make new variable in document 1 with properties {name:"TextVariable", kind:textual}
make new rectangle in document 1 with properties {name:"Rec1", position:{100, 500},
visibility variable:variable "RecVariable" of document 1}
make new text frame in document 1 with properties {name:"Text1", position:{100,
550}, content variable:variable "TextVariable" of document 1}
CHAPTER 1: AppleScript Objects dataset, datasets 40

set the fill color of page item "Rec1" of document 1 to {class:RGB color info,
red:150, green:255, blue:255}
set the contents of text frame "Text1" of document 1 to "Now you see me..."
make new dataset in document 1 with properties {name:"My First Dataset"}
set hidden of page item "Rec1" of document 1 to true
set the contents of text frame "Text1" of document 1 to "Now you don't!"
make new dataset in document 1 with properties {name:"My Second Dataset"}
repeat 3 times
delay 1
display dataset "My First Dataset" of document 1
delay 1
display dataset "My Second Dataset" of document 1
end repeat
end tell
CHAPTER 1: AppleScript Objects document, documents 41

document, documents
An Illustrator document or a list of documents. Documents are contained in the application object.

The default document settings—those properties starting with the word "default"—are global settings
that affect the current document. Be sure to modify these default properties only when a document is
open. Note that if you set default properties to desired values before creating new objects, you can
streamline your scripts, eliminating the need to specify properties such as fill color and stroked that
have analogous default properties.

A document’s color space, height, and width can only be set when the document is created. Once a
document is created, these properties cannot be changed.

The frontmost document can be referred to as either current document or document 1.

document object elements

Element Refer to by
artboard name, index, before/after, range, test
brush name, index, before/after, range, test
character style name, index, before/after, range, test
compound path item name, index, before/after, range, test
dataset name, index, before/after, range, test
gradient name, index, before/after, range, test
graph item name, index, before/after, range, test
graphic style name, index, before/after, range, test
group item name, index, before/after, range, test
layer name, index, before/after, range, test
legacy text item name, index, before/after, range, test
mesh item name, index, before/after, range, test
non native item name, index, before/after, range, test
page item name, index, before/after, range, test
paragraph style name, index, before/after, range, test
path item name, index, before/after, range, test
pattern name, index, before/after, range, test
placed item name, index, before/after, range, test
plugin item name, index, before/after, range, test
raster item name, index, before/after, range, test
CHAPTER 1: AppleScript Objects document, documents 42

Element Refer to by
spot name, index, before/after, range, test
story index, before/after, range, test
swatch name, index, before/after, range, test
swatch group name, index, before/after, range, test
symbol name, index, before/after, range, test
symbol item name, index, before/after, range, test
tag name, index, before/after, range, test
text frame name, index, before/after, range, test
variable name, index, before/after, range, test
view index, before/after, range, test

document object properties

Property Value type What it is


best type type class Read-only. The best type for the document object’s
value. Always returns reference.
class type class Read-only. The object’s class, which is document.
color space Valid values: Read-only. The color specification system to use for
RGB this document’s color space.
CMYK

crop marks rectangle The boundary of the document’s cropping box for
output.
crop style Valid values: The style of the document’s cropping box.
standard
Japanese style

current dataset dataset The currently active dataset.


current layer layer The active layer in the document.
current view view Read-only. The document’s current view.
default fill color color info The color to fill new paths if default filled is true.
default fill boolean If true, the art beneath a filled object should be
overprint overprinted by default.
default filled boolean If true, a new path should be filled.
default stroke cap Valid values: Default type of line capping for paths created.
butted
rounded
projecting
CHAPTER 1: AppleScript Objects document, documents 43

Property Value type What it is


default stroke color color info The stroke color for new paths if default stroked is
true.

default stroke dash real The default distance into the dash pattern at which
offset the pattern should be started for new paths.
default stroke dashes list of real Default lengths for dashes and gaps in dashed lines,
numbers starting with the first dash length, followed by the
first gap length, and so on. Set to an empty list, {}, for
a solid line.
default stroke join Valid values: Default type of joints in new paths.
mitered
rounded
beveled

default stroke miter real When default stroke join is set to mitered, this
limit property specifies when the join will be converted to
beveled (squared-off ) by default. The default miter
limit of 4 means that when the length of the point
reaches four times the stroke weight, the join
switches from a miter join to a bevel join. Values: 1 to
500. 1 specifies a bevel join.
default stroke boolean If true, the art beneath a stroked object should be
overprint overprinted by default.
default stroke width real Default width of stroke for new paths.
default stroked boolean If true, new paths should be stroked.
default type type class Read-only. The default type for the document object’s
value. Always returns reference.
file path file specification Read-only. The file associated with the document,
which includes the complete path to the file.
getScreenMode NormalScreenMode Read-only. The mode of display for this view.
FullScreenWithMe
nuMode

FullScreenNoMenu
Mode

PresentationMode

getViewMode OverprintPreview Read-only. The view mode for this view.


PixelPreview

DefaultPreview

geometric bounds rectangle Read-only. The object’s bounds excluding the stroke
width.
CHAPTER 1: AppleScript Objects document, documents 44

Property Value type What it is


height real Read-only. The height of the document, calculated
from the geometric bounds.
index integer Read-only. The position of this document in the
stacking order of all open documents. The current
(frontmost) document is always document 1.
inks list of ink Read-only. The list of inks in this document.
isTransparencyGridVis boolean Read-only. If true, the transparency grid is visible.
ible

isRulerVisible boolean Read-only. If true, the ruler is visible.


Kinsoku set list of Unicode text Read-only. The Kinsoku set of characters that cannot
begin or end a line of Japanese text.
modified boolean If true, the document has been modified since the
last save.
Mojikumi set list of Unicode text Read-only. A list of names of predefined Mojikumi
sets which specify the spacing for the layout and
composition of Japanese text.
name Unicode text Read-only. The document’s name (not the complete
file path to the document).
output resolution real Read-only. The current output resolution for the
document in dots per inch (dpi).
page origin list The zero-point of the page in the document without
margins, relative to the overall height and width.
print tiles boolean Read-only. If true, this document should print as tiled
output.
properties record All document’s properties returned in a single record.
Properties that are individually read-only remain so in
this record.
raster effect raster effect The document’s raster effect settings.
settings options

ruler origin list The zero-point of the rulers in the document relative
to the bottom left of the document.
ruler units Valid values: Read-only. The default units for the rulers in the
unknown document.
inches
centimeters
points
picas
millimeters
qs
pixels
CHAPTER 1: AppleScript Objects document, documents 45

Property Value type What it is


selection list of object The list of references to the objects in this document’s
references current selection.
show placed images boolean Read-only. If true, the placed images should be
displayed in the document.
split long paths boolean Read-only. If true, long paths should be split when
printing.
stationery boolean Read-only. If true, the document should be saved as
a stationery file.
tile full pages boolean Read-only. If true, full pages should be tiled when
printing this document.
use default screen boolean Read-only. If true, use the printer’s default screen
when printing this document.
variables locked boolean If true, the variables are locked.
visible bounds rectangle Read-only. The object’s visible bounds, including
stroke width of any objects in the illustration.
width real Read-only. The width of this document, calculated
from the geometric bounds.
XMP string Unicode text The XMP metadata packet associated with this
document.

document object commands


arrange
capture
close
convert coordinate
count
delete
duplicate
exists
export
export PDF preset
export perspective grid preset
export print preset
export variables
fit artboard to selected art
get
get perspective active plane
get screen mode
get view mode
import character styles
import paragraph styles
import PDF preset
import perspective grid preset
import print preset
import variables
is ruler visible
CHAPTER 1: AppleScript Objects document, documents 46

is transparency grid visible


make
open
print
rasterize
save
select objects on active artboard
select perspective preset
set perspective active plane
set grid configuration
write as library

Make sure a document is open


-- Check to make sure a document is open in Illustrator
-- before setting the application's default stroke width to 8 points
tell application "Adobe Illustrator"
if not (document 1 exists) then
make new document with properties {color space:CMYK, width:100.0, height:50.0}
end if
set the default stroke width of document 1 to 8.0
end tell
CHAPTER 1: AppleScript Objects document, documents 47

Make a new document


-- Creates 2 new documents with different default settings
-- the RGB document has the default fill and a 4.0 pt stroke
-- the CMYK document has no fill and a dashed stroke width of 8.0 pt
tell application "Adobe Illustrator"
set rgbDocRef to make new document with properties {color space:RGB}
set properties of rgbDocRef to {default filled:true ¬
, default stroked:true ¬
, default stroke width:4.0}
set rgbPropertyRef to properties of current document
set cmykDocRef to make new document with properties {color space:CMYK}
set properties of cmykDocRef to {default filled:false ¬
, default stroked:true ¬
, default stroke width:8.0 ¬
, default stroke dashes:{2.5, 1, 2.5, 1, 2.5, 1}}
set cmykPropertyRef to properties of current document
end tell

Get the file path of a document

This example demonstrates how to use document properties in other applications. In this case, the script
uses the file path property of the active document to open the folder containing the Illustrator
document in the Finder.
-- Reveal and select a document’s file icon in the Finder
tell application "Adobe Illustrator"
set filepath to file path of current document
end tell
tell application "Finder"
activate
reveal filepath
end tell
CHAPTER 1: AppleScript Objects document preset 48

document preset
A preset document template to use when creating a new document. See the add document command.

document preset properties

Property Value type What it is


artboardLayout Valid values: The layout of artboards in the new
grid by row document. Default: grid by row
grid by column
row
column
rl grid by row
rl grid by col
rl row

artboardRowsOrCols long The number of rows (for rows


layout) or columns (for column
layout) of artboards. Range: 1 to
(numArtboards - 1) or 1 for single
row or column layouts. Default: 1
artboardSpacing double The spacing between artboards in
the new document. Default: 20.0
color mode Valid values: The color space for the new
CMYK document. Default: CMYK
RGB

document units Valid values: The ruler units for the new
centimeters document. Default: points
inches
millimeters
picas
points
qs
pixels
unknown

height real The height in document points.


Default: 792.0
numArtboards long The number of artboards for the
new document. Range: 1 to 100.
Default: 1
preview mode Valid values: The preview mode for the new
default preview document.
pixel preview Default: default preview
overprint preview

raster resolution Valid values: The raster resolution for the new
screen resolution document.
medium resolution Default: screen resolution
high resolution
CHAPTER 1: AppleScript Objects document preset 49

Property Value type What it is


title Unicode text The document title. Default:
Untitled

transparency grid Valid values: The transparency grid color for


hide transparency grids the new document.
light color transparency grids Default: hide transparency
medium color transparency grids grids
dark color transparency grids
red color transparency grids
orange transparency grids
green transparency grids
blue transparency grids
purple transparency grids

width real The width in document points.


Default: 612.0
CHAPTER 1: AppleScript Objects ellipse 50

ellipse
Used to create an elliptical path in an Illustrator document. This object is available only in the context of a
make command, which creates an instance of the path item class. This special class allows you to quickly
create complex path items. Properties associated with path items, such as fill color and note, can also
be specified at the time of creation.

ellipse object properties

Property Value type What it is


bounds list of points Write-once. The bounds of the ellipse.
inscribed boolean Write-once. If true, the ellipse path should be inscribed (drawn
inside the rectangle described by the bounds).
reversed boolean Write-once. If true, the ellipse path is reversed. Default: false

ellipse object commands


make

Create ellipses
-- Embellish a single selected path item by adding a bright red
-- ellipse to each point on the path

set pEllipseScale to 0.1

tell application "Adobe Illustrator"


activate
set selectedItems to selection

-- A bit of sanity checking


if (count selectedItems) is not 1 ¬
or class of selectedItems is text ¬
or class of item 1 of selectedItems is not path item then

display dialog "Please select a single path item before running this script"
else
set pathItem to item 1 of selectedItems

-- Set ellipse color based on document color space


set docColorSpace to color space of current document
if docColorSpace is RGB then
set ellipseColor to {red:255.0, green:0.0, blue:0.0}
else
set ellipseColor to {cyan:0.0, magenta:100.0, yellow:100.0, black:0.0}
end if

-- Gather needed info about the path item to be embellished


set itemWidth to width of pathItem
set itemHeight to height of pathItem
set pathPointList to anchor of every path point of pathItem
CHAPTER 1: AppleScript Objects ellipse 51

-- Calculate the position and bounds for each ellipse


repeat with aPoint in pathPointList
set {x, y} to aPoint

set rectLeft to x - (itemWidth * pEllipseScale)


set rectRight to x + (itemWidth * pEllipseScale)
set rectTop to y + (itemHeight * pEllipseScale)
set rectBottom to y - (itemHeight * pEllipseScale)

set ellipseRect to {rectLeft, rectTop, rectRight, rectBottom}

make new ellipse at beginning of current document with properties


{bounds:ellipseRect, inscribed:true, reversed:false, stroke color:ellipseColor, fill
color:ellipseColor}
end repeat
end if
end tell
CHAPTER 1: AppleScript Objects EPS save options 52

EPS save options


Options that can be supplied when saving a document as an Illustrator EPS file. See the save command for
additional details.

This class is used to define a record containing properties that specify options when saving a document as
an EPS file. EPS save options can only be used in conjunction with the save command. It is not possible
to get or create an EPS save options object.

EPS save options object properties

Property Value type What it is


artboard range string Optional. If save multiple artboards is
true, this is considered for multi-asset
extraction, which specifies the artboard
range. An empty string extracts all the
artboards. Default: empty string
CMYK PostScript boolean Optional. If true, the file should be saved as
CMYK PostScript. Default: false
compatibility Valid values: Optional. The Illustrator file format version to
Illustrator 3 create. Default: Illustrator 19
Illustrator 8
Illustrator 9
Illustrator 10
Illustrator 11
Illustrator 12
Illustrator 13
Illustrator 14
Illustrator15
Illustrator16
Illustrator17
Illustrator19
Japanese 3
Illustrator24

compatible gradient boolean Optional. If true, create a raster item of the


printing gradient or gradient mesh so that PostScript
Level 2 printers can print the object.
embed all fonts boolean Optional. If true, fonts used in the EPS file
should be embedded in the file (version 7 or
later). Default: false
embed linked files boolean Optional. If true, linked image files are to be
included in the saved document. Default:
false

flatten output Valid values: Optional. How transparency should be


preserve paths flattened for file formats before Illustrator 9.
preserve appearance Default: preserve appearance
CHAPTER 1: AppleScript Objects EPS save options 53

Property Value type What it is


included document boolean Optional. If true, the thumbnail image of the
thumbnails EPS artwork should be included. Default:
true

overprint Valid values: Optional. The overprint style. Default:


discarded preserved
preserved

PostScript Valid values: Optional. Specifies the PostScript level to use


level 2 when saving the file (level 1 is valid for file
level 3 format version 8 or older). Default: level 3
preview Valid values: Specifies the format for the EPS preview
none image. Default: color TIFF
BW TIFF
color TIFF
transparent color TIFF

save multiple boolean Optional. If true, all artboards or range of


artboards artboards are saved. Default: false

Save EPS files

This handler processes a folder of Illustrator files, saving each as an EPS file with level 2 PostScript and
Illustrator 2025 compatibility. The files are save to the folder specified in the destinationFolder
parameter. Note that the class property is specified in the record to ensure that Illustrator can determine
the save option class.
-- Opens files from a predefined source folder in Illustrator
-- then exports them to a predefined destination folder in the chosen format
-- fileList is a list of file names in the source folder
-- filePath is the full path to the source folder
-- destinationFolder is an alias to a folder where the files are to be saved

on ExportFilesAsEPS(fileList, filePath, destinationFolder)


set destinationPath to destinationFolder as string
set fileCount to count of fileList
if fileCount > 0 then
repeat with i from 1 to fileCount
set fileName to item i of fileList
set fullPath to filePath & fileName
set newFilePath to destinationPath & fileName & ".EPS"
tell application "Adobe Illustrator"
open POSIX file fullPath as alias without dialogs
save current document in file newFilePath as eps ¬
with options {class:EPS save options ¬
, compatibility:Illustrator 9 ¬
, preview:color TIFF ¬
, embed linked files:true ¬
, include document thumbnails:true ¬
, embed all fonts:true ¬
, CMYK PostScript:true ¬
, PostScript:level 2}
close current document saving no
end tell
end repeat
CHAPTER 1: AppleScript Objects EPS save options 54

end if
end ExportFilesAsEPS
CHAPTER 1: AppleScript Objects ExportForScreens 55

ExportForScreens
Options that may be supplied when exporting a document/asset(s)/artboard(s).

Property Value type What it is


toFolder File path The folder where the exported documents/assets/artboards
are saved.
se_jpeg100/se_jpeg2 File type The file type in which the document is exported. For example,
0/se_jpeg50/se_jpeg8 ExportForScreensType.se_jpeg100.
0/se_pdf/se_png24/s
e_png8/se_svg

withOptions Any Options for the file type specified. For further information,
please refer to JPEG export options, PNG24 export options,
PNG8 export options, SVG export options.
itemtoexport Item to An item that needs to be exported. For example, a document,
export artboard, or asset.
filenameprefix String String prepended to each file name.
CHAPTER 1: AppleScript Objects flattening options 56

flattening options
Specifies transparency flattening options when printing a document with the print command. These
options are used to output artwork that contains transparency into a non-native format.

flattening options object properties

Property Value type What it is


clip complex regions boolean If true, complex regions are clipped. Default: false
convert strokes to outlines boolean If true, all strokes are converted to outlines. Default:
false

convert text to outlines boolean If true, all text items are converted to outlines.
Default: false
flattening balance integer The flattening balance. Range: 0 to 100; Default: 100
gradient resolution real The gradient resolution in dots per inch. Range: 1.0
to 9600.0; Default: 300.0
overprint Valid values: Overprint choice. Default: preserve
discard
preserve

rasterization resolution real The rasterization resolution in dots per inch.


Range: 1.0 to 9600.0. Default: 300.0

Flattening options
-- Activate Illustrator
-- Create a variable that holds the flattening options
-- Create a variable that holds the print options
-- Print the document
tell application "Adobe Illustrator"
activate
set flatOpts to {class:flattening options, clip complex regions:true, gradient
resolution:360, rasterization resolution:360}
set printOpts to {class:print options, flattener settings:flatOpts}
if not (exists document 1) then error "There is no document available to print."
print document 1 options printOpts
end tell
CHAPTER 1: AppleScript Objects font options 57

font options
Font options when printing a document with the print command.

font options object properties

Property Value type What it is


download fonts Valid values: The font download mode. Default: subset
complete
none
subset

font substitution kind Valid values: The font substitution policy.


device substitution Default: oblique substitution
oblique substitution
tint substitution

Set font options


-- Set the font options to a desired value
-- Print the current document, if available
tell application "Adobe Illustrator"
activate
set fontOptions to {class:font options, download fonts:complete, font substitution
kind:device substitution}
set printOpts to {class:print options, font settings:fontOptions}
if not (exists document 1) then error "There is no document available to print."
print document 1 options printOpts
end tell
CHAPTER 1: AppleScript Objects FreeHand options 58

FreeHand options
Options for opening a FreeHand file.

FreeHandFileOptions properties

Property Value type What it is


best type type class Read-only. The best type for the object’s value.
class type class Read-only. The object’s class.
container object Read-only. A reference to the document that
reference contains this object.
convert text to outlines boolean If true, converts all text to outlines.
Default: false
default type type class Read-only. The default type for the object’s value.
import single page boolean If true, imports only the page specified in the page
property. Default: true
page long The number of the page to import when opening a
multipage document.

NOTE: Valid only when import single page is true.


properties record All properties of this object returned as a record.
CHAPTER 1: AppleScript Objects FXG save options 59

FXG save options


Specifies options which may be supplied when saving a document as an FXG file. All properties are
optional.

FXG save options object properties

Property Value type What it is


artboard range string If save multiple artboards is true, this is
considered for multi-asset extraction, which
specifies the artboard range. An empty string
extracts all the artboards. Default: empty string
blends policy Valid values: The policy used by FXG to expand blends.
autoConvert blends Default: autoConvert blends
rasterize blends

downsample boolean If true, linked images are downsampled (at 72


linked images dpi). Default: false
filters policy Valid values: The policy used by FXG to preserve filters.
expand filters Default: keep filters editable
keep filters editable
rasterize filters

fxg version Valid values: The version of the FXG file format to create.
version 1.0 Default: version 2.0
version 2.0

gradients Valid values: The policy used by FXG to preserve gradients.


policy autoConvert gradients Default: autoConvert gradients
keep gradients editable

include unused boolean If true, unused symbols are included.


symbols Default: false
preserve boolean If true, the editing capabilities of FXG are
editing preserved. Default: true
capabilities

save multiple boolean If true, all artboards or range of artboards are


artboards saved. Default: false
text policy Valid values: The policy used by FXG to preserve text.
outline text Default: autoConvert text
keep text editable
rasterize text
autoConvert text
CHAPTER 1: AppleScript Objects GIF export options 60

GIF export options


Options that can be supplied when exporting a document as a GIF file. See the export command in the
command reference for additional details.

This class is used to define a record containing properties that specify options when exporting a document
as a GIF file. GIF export options can only be supplied in conjunction with the export command. It is not
possible to get or create a GIF export options object.

GIF export options object properties

Property Value type What it is


antialiasing boolean If true, the resulting image should be anti-aliased.
Default: true
artboard clipping boolean If true, the resulting image should be clipped to the
artboard. Default: false
color count integer The number of colors in the exported color table.
Range: 2 to 256. Default: 128
color dither Valid values: The method used to dither colors. Default: diffusion
none
diffusion
pattern dither
noise

color reduction Valid values: The method used to reduce the number of colors in
selective the document. Default: selective
adaptive
perceptual
web

dither percent integer How much the colors should be dithered. Range: 0 to
100. Default: 88
horizontal scaling real The horizontal scaling factor to apply to the resulting
image. Range: 0.0 to 100.0. Default: 100.0
information loss integer The level of information loss during compression (as a
percentage). Range: 0 to 100. Default: 0
interlaced boolean If true, the resulting image should be interlaced.
Default: false
matte boolean If true, the artboard should be matted with a color.
Default: true
matte color RGB color info The color to use when matting the artboard.

Default: white
saving as HTML boolean If true, the resulting image is saved with an
accompanying HTML file. Default: false
CHAPTER 1: AppleScript Objects GIF export options 61

Property Value type What it is


transparency boolean If true, the resulting image uses transparency.
Default: true
vertical scaling real The vertical scaling factor to apply to the resulting
image. Range: 0.0 to 100.0. Default: 100.0
web snap integer How much the color table should be changed to
match the Web pallet. Range: 0 to 100, where 100 is
the maximum change. Default: 0

Export to GIF

This handler processes all Illustrator files in a specific folder, exporting each as a scaled GIF image. Note
that the class property is specified in the record to ensure that Illustrator can determine the export
option class.
-- Opens files from a predefined source folder in Illustrator
-- then exports them to a predefined destination folder in the chosen format
-- fileList is a list of file names in the source folder
-- filePath is the full path to the source folder
-- destinationFolder is an alias to a folder where the files are to be saved

on ExportFilesAsGIF(fileList, filePath, destinationFolder)


set destinationPath to destinationFolder as string
set fileCount to count of fileList
if fileCount > 0 then
repeat with i from 1 to fileCount
set fileName to item i of fileList
set fullPath to filePath & fileName
set newFilePath to destinationPath & fileName & ".gif"
tell application "Adobe Illustrator"
open POSIX file fullPath as alias without dialogs
export current document to file newFilePath as GIF with options ¬
{class:GIF export options ¬
, color count:256 ¬
, color reduction:adaptive ¬
, information loss:0 ¬
, color dither:none ¬
, dither percent:100 ¬
, web snap:0 ¬
, transparency:false ¬
, interlaced:false ¬
, matte:true ¬
, matte color:{red:128, green:0, blue:60} ¬
, horizontal scaling:50.0 ¬
, vertical scaling:50.0 ¬
, antialiasing:true ¬
, artboard clipping:false ¬
, saving as HTML:false}
close current document saving no
end tell
end repeat
end if
end ExportFilesAsGIF
CHAPTER 1: AppleScript Objects gradient, gradients 62

gradient, gradients
A gradient definition or gradient definitions. Gradients are contained in documents. Scripts can create new
gradients.

gradient object elements

Element Refer to by
gradient stop index, before/after, range, test

gradient object properties

Property Value type What it is


best type type class Read-only. The best type for the gradient object’s value.
Always returns reference.
class type class Read-only. The object’s class, which is gradient.
container object reference Read-only. A reference to the document that contains this
gradient.
default type type class Read-only. The default type for the gradient object’s
value. Always returns reference.
entire gradient list of gradient All gradient stops in the gradient.
stop info

gradient type Valid values: The type of the gradient.


linear
radial

index integer Read-only. The position of this gradient in the application.


name Unicode text The gradient’s name.
properties record All properties of this object returned as a record.

gradient object commands


count
delete
duplicate
exists
make
CHAPTER 1: AppleScript Objects gradient, gradients 63

Create a gradient
-- Create a new RGB gradient with three gradient stops
set pGradientName to "RGB Hot Streak"

tell application "Adobe Illustrator"


if not (exists gradient pGradientName in current document) then
set newgradient to make new gradient at beginning of current document Â
with properties {name:pGradientName, gradient type:linear}
-- Since all new gradients are created with 2 gradient stops,
-- create another stop for the 3 stop gradient
make new gradient stop at beginning of newgradient
set properties of gradient stop 1 of newgradient to Â
{midpoint:50.0, ramp point:0.0, color:{red:255.0, green:255.0, blue:0.0}}
set properties of gradient stop 2 of newgradient to Â
{midpoint:50.0, ramp point:50.0, color:{red:255.0, green:127.0, blue:127.0}}
set properties of gradient stop 3 of newgradient to Â
{midpoint:50.0, ramp point:100.0, color:{red:255.0, green:0.0, blue:0.0}}
end if
end tell
CHAPTER 1: AppleScript Objects gradient color info 64

gradient color info


A gradient color specification, used to specify the color component values of a gradient color swatch. It is
used for specifying and retrieving color information from an Illustrator document or from page items in a
document.

gradient color info object properties


This class inherits all properties from the color info class.

Property Value type What it is


angle real The gradient vector angle (in degrees). Default: 0.0
gradient object reference A reference to the gradient object that defines the gradient to
use in this color definition.
hilite angle real The gradient highlight vector angle in degrees. Default: 0.0
hilite length real The gradient highlight vector length. Default: 0.0
length real The gradient vector length.
matrix matrix An additional transformation matrix to manipulate the gradient
path.
origin fixed point The gradient vector origin.

Gradient information
-- Set fill color of the first path in the current document
-- to the first gradient in the document
tell application "Adobe Illustrator"
set the fill color of path item 1 of document 1 to ¬
{gradient:gradient 1 of document 1}
end tell
CHAPTER 1: AppleScript Objects gradient stop, gradient stops 65

gradient stop, gradient stops


A gradient stop definition or definitions contained in a specific gradient. A gradient stop is a point on a
specific gradient that specifies a color change in the containing gradient.

gradient stop object properties

Property Value type What it is


best type type class Read-only. The best type for the gradient stop object’s value.
Always returns reference.
class type class Read-only. The object’s class, which is gradient stop.
color color info The color linked to this gradient stop.
container object reference Read-only. A reference to the gradient that contains this gradient
stop.
default type type class Read-only. The default type for the gradient stop object’s value.
Always returns reference.
index integer Read-only. The position of this gradient stop in the gradient.
midpoint real The midpoint of the blend between this stop’s and the next stop’s
colors. Range: 13.0 to 87.0
properties record All properties of this object returned as a record.
ramp point real The location of the color in the gradient. Range: 0.0 to 100.0
stop opacity double The opacity value for the gradient stop. Range: 0.0 to 100.0

gradient stop object commands


count
delete
duplicate
exists
make

Reverse colors in a gradient


-- This script reverses the colors in the first gradient of the current document
tell application "Adobe Illustrator"
set gradientRef to gradient 1 of document 1
-- Get a list of the gradient's colors
set colorList to color of every gradient stop of gradientRef
-- Tell AppleScript to reverse the order of the list
set colorList to reverse of colorList
-- Iterate over the gradient resetting its colors
set colorCount to count items in colorList
repeat with i from 1 to colorCount
set color of gradient stop i of gradientRef to (item i of colorList)
end repeat
CHAPTER 1: AppleScript Objects gradient stop, gradient stops 66

end tell
CHAPTER 1: AppleScript Objects gradient stop info 67

gradient stop info


Gradient stop information of a specific gradient, returned by the entire gradient property of a gradient.

The gradient stops for a new gradient can be specified by providing a list of gradient stop info records
in the entire gradient property. The following applies when creating a gradient from a list of gradient
stop info records:

 A gradient stop’s location in the gradient is determined by its ramp point value, not the
gradient stop info record’s order in the entire gradient list.

 The midpoint value of the last gradient stop info record in the entire gradient list is not used for the
newly created gradient and need not be provided. If it is present, its value must be in the valid range.

gradient stop info object properties

Property Value type What it is


color color info The color linked to this gradient stop.
midpoint real The midpoint of the blend between this stop’s and the next stop’s colors.
Range: 13.0 to 87.0. Default: 50.0
ramp point real The location of the color in the gradient as a percentage.
Range: 0.0 to 100.0. Default: 0.0
stop opacity Double The opacity value for the gradient stop. Range: 0.0 to 100.0.
Default: 100.0

Gradient stop information


-- Create a new CMYK gradient with 4 gradient stops
set pGradientName to "CMYK Circle"
tell application "Adobe Illustrator"
if not (exists gradient pGradientName in current document) then
set entireGradient to {{midpoint:50.0, ramp point:0.0 ¬
, color:{cyan:0.0, magenta:0.0, yellow:0.0, black:100.0}} ¬
, {midpoint:50.0, ramp point:33.3 ¬
, color:{cyan:0.0, magenta:0.0, yellow:100.0, black:0.0}} ¬
, {midpoint:50.0, ramp point:66.7 ¬
, color:{cyan:0.0, magenta:100.0, yellow:0.0, black:0.0}} ¬
, {midpoint:50.0, ramp point:100.0 ¬
, color:{cyan:100.0, magenta:0.0, yellow:0.0, black:0.0}}}
set gradientRef to make new gradient in current document with properties ¬
{name:pGradientName, gradient type:radial, entire gradient:entireGradient}
end if
end tell
CHAPTER 1: AppleScript Objects graph item, graph items 68

graph item, graph items


A graph or a list of graphs.

graph item object properties


This object class inherits all properties from the page item class.

Property Value type What it is


content variable anything The content variable to which this graph item is bound

It is not necessary to set the type of the content variable before


binding. Illustrator automatically sets the type to graph.
properties record All properties of this object returned as a record.

graph item object commands


count
delete
duplicate
exists
move
rotate
scale
transform
translate

Rotating graph items


-- Get every page item whose class is graph item
-- For each graph item, rotate it 90 degrees counter clockwise
tell application "Adobe Illustrator"
activate
if not (exists document 1) then error "There is no available document."
set graphItems to every page item of document 1 whose class is graph item
if graphItems is {} then error "The document does not contain any graph items."
repeat with currentGraphItem in graphItems
rotate currentGraphItem angle 90
end repeat
end tell
CHAPTER 1: AppleScript Objects graphic style, graphic styles 69

graphic style, graphic styles


Defines a set of appearance attributes that you can apply non-destructively to page items. Graphic styles
are contained in documents. The graphic styles can be accessed from a script, but cannot be created from
a script. You cannot delete default graphic styles.

graphic style object properties

Property Value type What it is


best type type class Read-only. The best type for the graphic style object’s value.
Always returns reference.
class type class Read-only. The object’s class, which is graphic style.
container object reference Read-only. A reference to the document that contains this
graphic style.

default type type class Read-only. The default type for the graphic style object, which is
reference.

index integer Read-only. The index of this graphic style.


name Unicode text The name of this graphic style.
properties record All properties of this object returned as a record.

graphic style object commands


apply
count
delete
exists

Applying a graphic style


-- Duplicate and group the selected path items, then apply
-- a random graphic style to the items in the new group
tell application "Adobe Illustrator"
set selectedItems to selection of document 1

-- Check for empty selection


if selectedItems is not {} then
-- Create the new group to contain the duplicated items
set groupRef to make new group item at document 1
-- Duplicate the selected items to the new group
set newItemList to duplicate selectedItems to beginning of groupRef
-- Get graphic style names for display in the choice list
set styleIndex to index of every graphic style of document 1
if (count styleIndex) > 0 then
-- select a random graphic style
set chosenStyle to (random number from 1 to (count styleIndex))
-- The randomly chosen graphic style is applied to the list
-- of items returned by the duplicate command,
CHAPTER 1: AppleScript Objects graphic style, graphic styles 70

-- rather than to the new group itself, because the


-- apply command works on individual path items,
-- not groups of items
apply graphic style chosenStyle of current document to newItemList
end if
end if
end tell
CHAPTER 1: AppleScript Objects gray color info 71

gray color info


A grayscale color specification, used to specify a gray color where a color info object is required.

This class is used to define a record which contains the tint value of a gray color. It is used for specifying
and retrieving color information from an Illustrator document or from page items in a document.

gray color info object properties


This class inherits all properties from the color info class.

Property Value type What it is


gray value real The tint of the gray. Range: 0.0 (white) to 100.0 (black). Default: 0.0

Creating a gray color swatch


-- Create a new gray color swatch (35% black) in the current document
set pSwatchName to "35% Gray Swatch"
tell application "Adobe Illustrator"
if not (exists swatch pSwatchName in current document) then
make new swatch at beginning of current document with properties ¬
{name:pSwatchName, color:{gray value:35.0}}
end if
end tell
CHAPTER 1: AppleScript Objects grid repeat config 72

grid repeat config


Specifies grid repeat art configuration options

grid repeat object properties

Property Value type What it is


column flip horizontal and Column flip type of grid repeat art.
type vertical Default value: no shift or flip
sf/
horizontalsf/
no
shift or flip/
verticalsf

horizontal real Spacing between each rows.


spacing Default value: 10
pattern type horizontal and Shifts type of grid repeat art.
vertical Default value: no shift or flip
sf/
horizontalsf/
no
shift or flip/
verticalsf

row flip type horizontal and Row flip type of grid repeat art.
vertical Default value: no shift or flipcolumn
sf/
horizontalsf/
no
shift or flip/
verticalsf

vertical real Spacing between each columns.


spacing
Default value: 10
CHAPTER 1: AppleScript Objects grid repeat item, grid repeat items 73

grid repeat item, grid repeat items


Specifies grid repeat item options.

grid repeat item object properties

Property Value type What it is


properties record All of this object's properties returned in a single
record.
grid config grid repeat Read-only. Grid repeat configuration for repeat
config
art.

grid repeat object commands


set grid configuration
CHAPTER 1: AppleScript Objects grid repeat, aeadd 74

grid repeat, aeadd


Creates a grid repeat art.

grid repeat item object properties

Property Value type What it is


source art any The page item(s) to apply to
config (grid repeat the grid repeat configuration.
config)
CHAPTER 1: AppleScript Objects group item, group items 75

group item, group items


A grouped set of art items. Group items can contain all the same page items that a layer can contain,
including other nested groups.

Paths contained within a group or compound path in a document are returned as individual paths when a
script asks for the paths contained in the document. However, paths contained in a group or compound
path are not returned when a script asks for the paths in a layer which contains the group or compound
path.

A new group can be created that contains the contents of a vector art file if you provide a file specification
to the vector file (EPS or PDF) in the with data parameter of the make command. The resulting group will
be the same object as if the user had placed the file from the user interface using the File > Place
command with the embed checkbox checked.

group item object elements

Element Refer to by
compound path item name, index, before/after, range, test
graph item name, index, before/after, range, test
group item name, index, before/after, range, test
legacy text item name, index, before/after, range, test
mesh item name, index, before/after, range, test
non native item name, index, before/after, range, test
page item name, index, before/after, range, test
path item name, index, before/after, range, test
placed item name, index, before/after, range, test
plugin item name, index, before/after, range, test
raster item name, index, before/after, range, test
symbol item name, index, before/after, range, test
text frame name, index, before/after, range, test

group item object properties


This class inherits all properties from the page item class.

Property Value type What it is


clipped boolean If true, the group item is clipped to the clipping mask.
properties record All properties of this object returned as a record.
CHAPTER 1: AppleScript Objects group item, group items 76

group item object commands


count
delete
duplicate
exists
make
move
rotate
scale
transform
translate

Group contents of a vector art file


-- Create a new group whose contents will be the contents of a vector art file
-- fileRef is an alias or file reference to the vector file to be placed
on EmbedVectorFile(fileRef)
tell application "Adobe Illustrator"
set groupRef to make new group item in document 1 with data fileRef ¬
with properties {position:{0, 600}}
end tell
return groupRef
end EmbedVectorFile

-- Call handler
set fileRef to choose file with prompt "Select vector file to place"
set groupRef to EmbedVectorFile(fileRef)

Create path items from a group

This script demonstrates how easily new groups can be created and populated with objects.
-- Create a new group, then add rectangles to it using
-- the available placement options
tell application "Adobe Illustrator"
set groupRef to make new group item in document 1
set rectRef to make new rectangle at beginning of groupRef with properties Â
{bounds:{150, 550, 350, 350}, fill color:{blue:255}}
make new rectangle after rectRef with properties Â
{bounds:{100, 600, 300, 400}, fill color:{red:255}}
set rectRef to make new rectangle at end of groupRef with properties Â
{bounds:{0, 700, 200, 500}, fill color:{green:255}}
make new rectangle before rectRef with properties Â
{bounds:{50, 650, 250, 450}, fill color:{black:100}}
end tell
CHAPTER 1: AppleScript Objects group item, group items 77

Select items not in a group


-- Select only the page items in a document that are not part of
-- a group and that are not themselves groups
tell application "Adobe Illustrator"
-- First deselect everything in the document
set selection of current document to {}
if (count page items of current document) > 0 then
set layerCount to count layers in current document
repeat with i from 1 to layerCount
set layerRef to layer i of current document
if (count page items of layer i of current document) > 0 then
set selected of (every page item of current document ¬
whose container is layerRef ¬
and class is not group item) to true
end if
end repeat
end if
end tell

Making a clipping mask

This example shows how to create a clipping mask using the first path item in a group item. This is the
same effect as you get when you use the Object > Clipping Mask > Make command in the user interface.
-- Create a group of paths, then clip the group to the first path in the group
tell application "Adobe Illustrator"

-- Create a group to contain the paths to be clipped


set groupRef to make new group item in document 1

-- Add some path items to the group


make new rectangle at end of groupRef with properties ¬
{bounds:{200, 350, 300, 250}, fill color:{cyan:100}, stroked:false}
make new rectangle at end of groupRef with properties ¬
{bounds:{300, 250, 400, 150}, fill color:{magenta:100}, stroked:false}
make new rectangle at end of groupRef with properties ¬
{bounds:{300, 350, 400, 250}, fill color:{yellow:100}, stroked:false}
make new rectangle at end of groupRef with properties ¬
{bounds:{200, 250, 300, 150}, fill color:{green:255}, stroked:false}

-- Get a little fancy and create a rotated star at the center of the group
set pathRef to make new star at beginning of groupRef with properties ¬
{center point:{300, 250}, radius:25, inner radius:4, point count:4 ¬
, fill color:{black:100}, opacity:40, stroked:false}
set rotationMatrix to get rotation matrix angle 45
transform pathRef using rotationMatrix about center

-- Create the path that the group will be clipped with


-- The clipping path must be the first (frontmost) path in the group
make new star at beginning of groupRef with properties ¬
{center point:{300, 250}, radius:80, inner radius:25, point count:4 ¬
, stroked:false, filled:false}

-- Now clip the group to the top path


set clipped of groupRef to true
end tell
CHAPTER 1: AppleScript Objects Illustrator preferences 78

Illustrator preferences
Specifies the preferred options for AutoCAD, FreeHand, PDF, and Photoshop files.

Preference accessor guidelines


Preference accessor commands, such as get boolean preference, should be used only as a solution of
last resort. For information on preference keys that can be accessed, see the AIPreferenceKeys.h header
file in the Adobe Illustrator SDK.

NOTE: Preference keys other than those documented in AIPreferenceKeys.h are subject to change
without notice and should not be used.

Illustrator preferences object properties

Property Value type What it is


AutoCAD file options AutoCAD options Read-only. Options to use when opening or
placing an AutoCAD file.
best type type class Read-only. The best type for the object’s value.
class type type class Read-only. The object’s class.
default type type class Read-only. The default type for the object
FreeHand file options FreeHand options Read-only. Options to use when opening or
placing a FreeHand file.
properties record All properties of this object returned as a record.
PDF file options PDF options Read-only. Options to use when opening or
placing a PDF file.
Photoshop file options Photoshop Read-only. Options to use when opening or
options placing a Photoshop file.
CHAPTER 1: AppleScript Objects Illustrator save options 79

Illustrator save options


Options that may be supplied when saving a document as an Illustrator file. All properties are optional.

See the save command for additional details.

This class is used to define a record containing properties used to specify options when saving a document
as an Illustrator file. Illustrator save options can only be supplied in conjunction with the save
command. It is not possible to get or create an Illustrator save options object.

Illustrator save options object properties

Property Value type What it is


artboard range string If save multiple artboards is true (which is
valid only for Illustrator 13 or earlier), the
document is considered for multi-asset
extraction, which specifies an artboard range. An
empty string extracts all artboards.
Default: empty string
compatibility Valid values: Specifies the version of the Illustrator file format
Illustrator 8 to create. Default: Illustrator 19
Illustrator 9
Illustrator 10
Illustrator 11
Illustrator 12
Illustrator 13
Illustrator 14
Illustrator 15
Illustrator 16
Illustrator17
Illustrator18
Japanese version 3

compressed boolean If true, the saved file should be compressed.


Only for Illustrator 10 or later. Default: true
embed ICC profile boolean If true, the document’s ICC profile should be
embedded in the saved file. Only for Illustrator 9
or later. Default: false.
embed linked files boolean If true, include linked image files in the saved
document. Only for Illustrator 7 or later.
Default: false.
flatten output Valid values: How should transparency be flattened for file
preserve paths formats before Illustrator 9 or later.
preserve appearance Default: preserve appearance.
font subset real Include a subset of fonts when less than this
threshold percentage of characters are used. Only for
Illustrator 9 or later. Range: 0.0 to 100.0.
Default: 100.0.
CHAPTER 1: AppleScript Objects Illustrator save options 80

Property Value type What it is


PDF compatible boolean If true, the file should be saved as a PDF
compatible file. Only for Illustrator 10 or later.
save multiple boolean If true, all artboards or range of the artboards
artboards are saved. Valid for Illustrator 13 or earlier.
CHAPTER 1: AppleScript Objects Illustrator save options 81

Valid commands
save

Save files in a folder

This handler processes a folder of Illustrator files, saving each with Illustrator 7 compatibility. Note that the
class property is specified in the record to ensure that Illustrator can determine the save option class.

-- Opens files from a predefined source folder in Illustrator


-- then exports them to a predefined destination folder in the chosen format
-- fileList is a list of file names in the source folder
-- filePath is the full path to the source folder
-- destinationFolder is an alias to a folder where the files are to be saved

on SaveFilesAsIllustrator(fileList, filePath, destinationFolder)


set destinationPath to destinationFolder as string
set fileCount to count of fileList
if fileCount > 0 then
repeat with i from 1 to fileCount
set fileName to item i of fileList
set fullPath to filePath & fileName
set newFilePath to destinationPath & fileName & ".ai"
tell application "Adobe Illustrator"
open POSIX file fullPath as alias without dialogs
save current document in file newFilePath as Illustrator with options
{flatten output:preserve appearance, compressed:true}
close current document saving no
end tell
end repeat
end if
end SaveFilesAsIllustrator
CHAPTER 1: AppleScript Objects image capture options 82

image capture options


Options for image capture, used with the get view mode command. All properties are optional.

ImageCaptureOptions properties

Property Value type What it is


antialiasing boolean If true, the image result is anti-aliased. Default: false
matte boolean If true, the artboard is matted with a color. Default: false
matte color RGB color info The color to use for the artboard matte. Default: white
resolution real The resolution of the captured image file in points-per-inch (PPI),
in the range [72.0 ... 2400.0]. Default: 150
transparency boolean If true, the image result is transparent. Default: false
CHAPTER 1: AppleScript Objects ink 83

ink
Specifies the properties of the inks to be used in printing the document.

ink object properties

Property Value type What it is


name Unicode text The ink’s name.
properties ink properties The ink information.

List inks in a document


-- Create a new CMYK document
-- Get the name of every ink in document 1
-- Display the list of ink names in a text frame
tell application "Adobe Illustrator"
set inkNames to ""
set theText to ""
if not (exists document 1) then error "There is no available document."
get the name of every item of inks of document 1
repeat with theName in the result
set inkNames to inkNames & theName & return
end repeat
set theText to inkNames
set textRef to make new text frame in current document with properties
{position:{100, 500}}
set contents of textRef to theText
end tell
CHAPTER 1: AppleScript Objects ink properties 84

ink properties
Information about ink use when printing a document with the print command.

ink properties object properties

Property Value type What it is


angle real The ink’s screen angle in degrees. Range: -360 to 360
custom color list of real The custom color.
numbers
density real The neutral density. Minimum: 0.0
dot shape Unicode text The dot shape name.
frequency real The ink’s frequency. Range: 0.0 to 1000.0
kind Valid values: The ink type.
black ink
custom ink
cyan ink
magenta ink
yellow ink

printing status Valid values: The ink printing status.


convert ink
disable ink
enable ink

trapping Valid values: The trapping type.


ignore opaque
normal
opaque
transparent

trapping order integer The order of trapping for the ink. Range: 1 to 4 for CMYK
CHAPTER 1: AppleScript Objects insertion point 85

insertion point
A location between characters, used to insert new text objects.

An insertion point is logically located between two characters in a text frame. Each insertion point is
before the corresponding character in a text frame. Insertion point 1 is before character 1, etc.

The properties of an insertion point are the same as the character at the same position in the text frame.
For example, the font for insertion point 2 of text frame 1 will be the same as the font for character 2 of text
frame 1.

You can set the properties for an insertion point, but setting only the contents property has no affect on
the text frame. The result of setting the contents of an insertion point to a string value is to insert the string
in the text frame at the insertion point’s location. Setting the contents to an empty string has no affect.

An insertion point is contained in an InsertionPoints collection. This is a text object in which


character offset indicates the location of the insertion point and length is 0. This subclass does not
define any additional properties.

insertion point object elements

Elements Refer to by
character style name, numeric index, range of elements, before/after another element, satisfying
a test
character numeric index, range of elements, before/after another element, satisfying a test
insertion point numeric index, range of elements, before/after another element, satisfying a test
line numeric index, range of elements, before/after another element, satisfying a test
paragraph style name, numeric index, range of elements, before/after another element, satisfying
a test
paragraph numeric index, range of elements, before/after another element, satisfying a test
text numeric index, range of elements, before/after another element, satisfying a test
word numeric index, range of elements, before/after another element, satisfying a test

insertion point object properties

Property Value type What it is


best type type class Read-only. The best type for the object’s value.
class type class Read-only.The object’s class.
container reference Read-only.The object’s container.
default type type class Read-only.The default type for the object’s value.
index integer Read-only.The index of this instance of the object.
CHAPTER 1: AppleScript Objects insertion point 86

Property Value type What it is


properties record All properties of this object returned as a record.
story story Read-only.The story that contains the insertion point.

insertion point object commands


count
exists

Working with insertion points

This example shows several ways of working with insertion points.


tell application "Adobe Illustrator"
-- Set insertion point karat to beginning of a text frame
set selection to insertion point 1 of text frame 1 of document 1
-- Add a string to end of a text frame
get insertion point -1 of text frame 1 of document 1
make new word at (item 1 of the result) with properties {contents:"Some new text."}
-- Since the default type of an insertion point is string, asking for
-- a particular insertion point returns its contents. To get a reference
-- to an insertion point you need to ask for a reference
set insertionRef to ¬
insertion point after word 3 of text frame 1 of document 1 as reference
make new word at insertionRef with properties {contents:"more words"}
end tell

Add a word at the insertion point


-- Make a new document
--- Make a new text frame with contents "Wouldn't you rather be scripting?"
-- Change the size of the text frame
-- Get the insertion points of the last word of the text frame
-- Add a new word at the first insertion point of the result

tell application "Adobe Illustrator"


activate
make new document
make new text frame in document 1 with properties {contents:"Wouldn't you rather be
scripting?", position:{100, 400}}
set the size of the text of the result to 20
delay 1
get insertion points of the last word of text frame 1 of document 1
make new word at (item 1 of the result) with properties {contents:"AppleScript"}
end tell
CHAPTER 1: AppleScript Objects job options 87

job options
The print job options when printing a document with the print command.

job options object properties

Property Value type What it is


artboard range string The artboard range to be printed if print all
artboards is false. Default: 1-

bitmap resolution real The bitmap resolution. Minimum: 0.0.


Default: 0.0
collate boolean If true, collate print pages are collated.
Default: false
copies integer The number of copies to print. Minimum: 1.
Default: 1
designation Valid values: The layers/objects to be printed.
all layers Default: visible printable layers
visible layers
visible printable layers

file path file specification The file to which to print.


name Unicode text The print job name.
print all boolean Indicates whether to print all artboards.
artboards Default: true
print area Valid values: The printing bounds.
artboard bounds Default: artboard bounds
artwork bounds

print as bitmap boolean If true, the job is printed as a bitmap image.


Default: false
reverse pages boolean If true, the pages are printed in reverse order.
Default: false
CHAPTER 1: AppleScript Objects job options 88

Print job options


-- Makes new document containing 3 layers - 1
-- non printable, 1 non visible and 1 visible and printable
-- a text frame is added to each layer
-- Print all layers
-- Print only visible layers
-- Print only visible and printable layer
tell application "Adobe Illustrator"
activate
make new document
set the name of current layer of document 1 to "VPL"
make new text frame in document 1 with properties {contents:"Visible and Printable",
position:{200, 600}}
make new layer in document 1 with properties {name:"VnPL", printable:false}
make new text frame in layer "VnPL" of document 1 with properties {contents:"Visible
and Non-Printable", position:{200, 500}}
make new layer in document 1 with properties {name:"nVPL"}
make new text frame in layer "nVPL" of document 1 with properties
{contents:"Non-Visible", position:{200, 400}}
set visible of layer "nVPL" of document 1 to false
set printOptions to {class:print options, job settings:{class:job options,
designation:all layers, reverse pages:true}}
print document 1 options printOptions
set printOptions to {class:print options, job settings:{class:job options,
designation:visible layers, reverse pages:true}}
print document 1 options printOptions
set jobOptions to {class:job options, designation:visible printable layers, reverse
pages:true}
set printOptions to {class:print options, job settings:jobOptions}
print document 1 options printOptions
end tell
CHAPTER 1: AppleScript Objects JPEG export options 89

JPEG export options


Options that can be supplied when exporting a document as a JPEG file. See the export command in the
command reference for additional details.

This class is used to define a record containing properties that specify options when exporting a document
as a JPEG file. JPEG export options can only be supplied in conjunction with the export command. It is
not possible to get or create a JPEG export options object.

JPEG export options object properties

Property Value type What it is


antialiasing boolean If true, the resulting image should be anti-aliased.
Default: true
artboard clipping boolean If true, the resulting image should be clipped to the
artboard. Default: false
blur real The amount of blurring to apply to the resulting image.
Range: 0.0 to 2.0. Default: 0.0
horizontal scaling real The percent horizontal scaling factor to apply to the
resulting image. Range: 0.0 to 100.0. Default: 100.0
matte boolean If true, the artboard should be matted with a color.
Default: true
matte color RGB color info The color to use when matting the artboard.
Default: white
optimization boolean If true, the resulting image should be optimized for web
viewing. Default: true
quality integer The quality of the resulting image. Range: 0 to 100.
Default: 30
saving as HTML boolean If true, the resulting image should be saved with an
accompanying HTML file. Default: false
vertical scaling real The percent vertical scaling factor to apply to the
resulting image. Range: 0.0 to 776.19. Default: 100.0
CHAPTER 1: AppleScript Objects JPEG export options 90

Export to JPEG

This handler processes all Illustrator files in a specific folder, exporting each file as a medium-quality JPEG
image. Note that the class property is specified in the record to ensure that Illustrator can determine the
export option class.
-- Opens files from a predefined source folder in Illustrator
-- then exports them to a predefined destination folder in the chosen format
-- fileList is a list of file names in the source folder
-- filePath is the full path to the source folder
-- destinationFolder is an alias to a folder where the files are to be saved

on ExportFilesAsJPEGMedium(fileList, filePath, destinationFolder)


set destinationPath to destinationFolder as string
set fileCount to count of fileList
if fileCount > 0 then
repeat with i from 1 to fileCount
set fileName to item i of fileList
set fullPath to filePath & fileName
set newFilePath to destinationPath & fileName & ".jpg"
tell application "Adobe Illustrator"
open POSIX file fullPath as alias without dialogs
export current document to file newFilePath as JPEG with options ¬
{class:JPEG export options ¬
, quality:60 ¬
, blur:0.5 ¬
, horizontal scaling:50.0 ¬
, vertical scaling:50 ¬
, matte:false}
close current document saving no
end tell
end repeat
end if
end ExportFilesAsJPEGMedium
CHAPTER 1: AppleScript Objects Lab color info 91

Lab color info


A color specification in the CIE Lab color space, used where a color info object is required.

Lab color info properties


This class inherits all properties from the color info class.

Property Value type What it is


a real The a (red-green) color value. Range -128.0–128.0. Default: 0.0
b real The b (yellow-blue) color value. Range -128.0–128.0. Default: 0.0
l real The l (lightness) color value. Range -128.0–128.0. Default: 0.0
CHAPTER 1: AppleScript Objects layer, layers 92

layer, layers
A layer or list of layers. Layers may contain nested layers, which are called sublayers in the user interface.

The layer object contains all the page items in the specific layer as elements. Your script can access page
items as elements of either the layer object or as elements of the document object. When accessing page
items as elements of a layer, only objects in that layer can be accessed. To access page items throughout
the entire document, be sure to refer to them as elements of the document.

layer object elements

Element Refer to by
compound path item name, index, before/after, range, test
graph item name, index, before/after, range, test
group item name, index, before/after, range, test
layer name, index, before/after, range, test
legacy text item name, index, before/after, range, test
mesh item name, index, before/after, range, test
non native item name, index, before/after, range, test
page item name, index, before/after, range, test
path item name, index, before/after, range, test
placed item name, index, before/after, range, test
plugin item name, index, before/after, range, test
raster item name, index, before/after, range, test
symbol item name, index, before/after, range, test
text frame name, index, before/after, range, test
CHAPTER 1: AppleScript Objects layer, layers 93

layer object properties

Property Value type What it is


best type type class Read-only. The best type for the layer object’s value. Always
returns reference.
blend mode Valid values: The mode used when compositing an object. An object is
color blend considered composited when its opacity is set to less than
color burn 100.0 (100%).
color dodge
darken
difference
exclusion
hard light
hue
lighten
luminosity
multiply
normal
overlay
saturation blend
screen
soft light

class type class Read-only. The layer object’s class, which is layer.
color RGB color info The layer’s selection mark color.
container object reference Read-only. A reference to the document that contains this
layer.
default type type class Read-only. The default type for the layer object’s value.
Always returns reference.
dim placed boolean If true, placed images are to be rendered as dimmed in this
images layer.
has selected boolean If true, one or more objects in this layer selected are
artwork selected; setting this property to false deselects all
objects in the layer.
index integer Read-only. The position of this layer in the current stacking
order of layers in this document, where layer 1 is always
the topmost layer in the stacking order.
isolated boolean If true, this object is isolated
knockout Valid values: Is this object used to create a knockout.
unknown
disabled
enabled
inherited

locked boolean If true, the layer is editable.


name Unicode text The name of this layer.
CHAPTER 1: AppleScript Objects layer, layers 94

Property Value type What it is


opacity real The opacity of this layer, where 100.0 is completely opaque
and 0.0 is completely transparent.
preview boolean If true, this layer should be displayed using preview mode.
printable boolean If true, this layer should be printed when printing the
document.
properties record All properties of this object returned as a record.
sliced boolean If true, slices should be preserved. Default: false
visible boolean If true, this layer is visible.

layer object commands


count
delete
duplicate
exists
make
move

Move layers
-- Move the 2nd layer to the top of the stacking order
tell application "Adobe Illustrator"
if (count layers of current document) > 1 then
move layer 2 of document 1 to before layer 1 of document 1
end if
end tell

Create a layer

Commands that deal with changes to an object’s reference, including the creation of new objects with the
make command, return a reference to the new or modified object in their result. This example stores the
reference returned for a newly created layer and then creates a new path item in the layer using the
reference.
-- Make a new layer at the top of the layer stack
-- then create a new path in the layer
tell application "Adobe Illustrator"
set layerRef to make layer at document 1 with properties {name:"Our Layer"}
make new rectangle at beginning of layerRef
end tell
CHAPTER 1: AppleScript Objects layer, layers 95

Delete layers

This example demonstrates the power of constructing simple tests (with the whose clause) to selectively
delete layers in a document based on their names. In this case, the script deletes all layers in the current
document that have names starting with the word “Temporary.”
-- Delete layers that have a name which begin with a particular string
set partialName to "Temp"
tell application "Adobe Illustrator"
delete (every layer of document 1 whose name starts with partialName)
end tell
CHAPTER 1: AppleScript Objects legacy text item, legacy text items 96

legacy text item, legacy text items


A text item from a document in a pre-CS version of Illustrator (version 10 or earlier), or a list of such items.,
which are uneditable until converted. To convert legacy text, see convert.

You can view, move, and print legacy text, but you cannot edit it. Legacy text has an "x" through its
bounding box when selected.

legacy text item object properties


This class inherits all properties from the page item class.

Property Value type What it is


converted boolean When true, the item has been updated to the current text
format (a text frame). Read-only.
properties record All properties of this object returned as a record.

legacy text item object commands


convert
CHAPTER 1: AppleScript Objects line 97

line
A line or lines of text in a text frame. A document’s text can be accessed using the character, insertion
point, word, line, paragraph, and text classes.

Lines of text cannot be created. When the contents property of a text frame is modified, Illustrator will
create text lines as it reflows the text within the text frame.

line object elements

Elements Refer to by
character style name, numeric index, range of elements, before/after another element, satisfying
a test
character numeric index, range of elements, before/after another element, satisfying a test
insertion point numeric index, range of elements, before/after another element, satisfying a test
line numeric index, range of elements, before/after another element, satisfying a test
paragraph style name, numeric index, range of elements, before/after another element, satisfying
a test
paragraph numeric index, range of elements, before/after another element, satisfying a test
text numeric index, range of elements, before/after another element, satisfying a test
word numeric index, range of elements, before/after another element, satisfying a test

line object properties

Property Value type What it is


aki left real The amount of inter-glyph space added
to the left side of each glyph in
Japanese text (in thousandths of an
em).
aki right real The amount of inter-glyph spacing
added to the right side of each glyph in
Japanese text (in thousandths of an
em).
alignment Valid values: The character alignment type.
bottom
center
icf bottom
icf top
roman baseline
top
CHAPTER 1: AppleScript Objects line 98

Property Value type What it is


alternate glyphs Valid values: Specifies the type of alternate glyphs.
default
expert
full width
half width
jis78
jis83
proportional width
quarter width
third width
traditional
jis90
jis04

alternate ligature boolean If true, use the alternate ligature.


auto leading boolean If true, use automatic leading.
baseline direction Valid values: The Japanese text baseline direction.
standard
Tate Chu Yoko
vertical rotated

baseline position Valid values: The baseline position of text.


normal
subscript
superscript

baseline shift real The amount of shift (in points) of the


text baseline.
best type type class Read-only. The best type for the object’s
value.
capitalization Valid values: The case of the text.
all caps
all small caps
normal
small caps

character offset integer Offset of the first character.


class type class Read-only. The object’s class.
connection forms boolean If true, use the OpenType connection
forms.
container reference Read-only. The object’s container.
contents Unicode text The text content.
contextual boolean If true, use the contextual ligature.
ligature

default type type class Read-only. The default type for the
object’s value.
discretionary boolean If true, use the discretionary ligature.
ligature
CHAPTER 1: AppleScript Objects line 99

Property Value type What it is


figure style Valid values: Specifies which figure style to use in an
default OpenType font.
proportional
proportional oldstyle
tabular
tabular oldstyle

fill color color info The color of the text fill.


fractions boolean If true, use the OpenType fractions.
horizontal scale real The character horizontal scaling factor
expressed as a percentage (100 =
100%).
index integer Read-only. The index of this instance of
the object
italics boolean If true, the Japanese OpenType support
supports the italic style.
kerning integer Controls the spacing between two
characters, in thousandths of an em.
kerning method Valid values: The automatic kerning method to use.
auto
none
optical
CHAPTER 1: AppleScript Objects line 100

Property Value type What it is


language Valid values: The language.
Bokmal Norwegian
Brazillian Portuguese
Bulgarian
Canadian French
Catalan
Chinese
Czech
Danish
Dutch
Dutch 2005 Reform
English
Finnish
German 2006 Reform
Greek
Hungarian
Icelandic
Italian
Japanese
Nynorsk Norwegian
old German
Polish
Romanian
Russian
Spanish
Serbian
standard French
standard German
standard Portuguese
Swedish
Swiss German
Swiss German 2006 Reform
Turkish
UK English
Ukranian

leading real The amount of space between two lines


of text, in points.
length integer The length in characters. Minimum: 0
ligature boolean If true, use the ligature.
no break boolean Whether break is allowed.
OpenType position Valid values: The OpenType baseline position.
default
denominator
numerator
subscript
superscript

ordinals boolean If true, use the OpenType ordinals.


ornaments boolean If true, use the OpenType ornaments.
overprint fill boolean If true, overprint the fill of the text.
CHAPTER 1: AppleScript Objects line 101

Property Value type What it is


overprint stroke boolean If true, the stroke of the text may be
overprinted.
properties record All properties of this object returned as
a record.
proportional boolean If true, the proportional metrics in
metrics Japanese OpenType may be used.
rotation real The character rotation angle.
selection list of text Read-only. The selected text.
size real Font size in points.
story story Read-only. The story that contains the
line.
strike through boolean If true, characters use strike-through
style.
stroke color color info The color of the text stroke.
stroke weight real line width of stroke.
stylistic boolean If true, use the OpenType stylistic
alternates alternates.
swash boolean If true, use the OpenType swash.
TCY horizontal integer The Tate-Chu-Yoko horizontal
adjustment in points.
TCY vertical integer The Tate-Chu-Yoko vertical adjustment
in points.
text font text The text font.
titling boolean If true, use the OpenType titling
alternates.
tracking integer The tracking or range kerning amount
in thousandths of an em.
Tsume real The percentage of space reduction
around a Japanese character.
underline boolean If true, characters use underline style.
vertical scale real Character vertical scaling factor.
warichu characters integer How the characters in Wari-Chu text (an
after break inset note in Japanese text) are divided
into two or more lines.
warichu characters integer How the characters in Wari-Chu text (an
before break inset note in Japanese text) are divided
into two or more lines.
CHAPTER 1: AppleScript Objects line 102

Property Value type What it is


warichu enabled boolean If true, Wari-Chu is enabled.
warichu gap integer The Wari-Chu line gap.
warichu Valid values: The Wari-Chu justification.
justification auto justify
center
full justify last line center
full justify
full justify last line left
full justify last line right
left
right

warichu lines integer The number of Wari-Chu (multiple text


lines fit into a space meant for one)
lines.
warichu scale real The Wari-Chu scale.

line object commands


apply character style
apply paragraph style
change case
count
delete
deselect
duplicate
exists
make
move
select

Finding lines of text

Lines of text can be located with matching characteristics using the whose clause, as this script
demonstrates.
-- Color red all lines of text containing more than 10 characters
tell application "Adobe Illustrator"
if (count text frames in document 1) > 0 then
set textItemCount to count text frames in document 1
repeat with i from 1 to textItemCount
set (fill color of every line of text frame i of document 1 ¬
whose length > 10) to {red:255.0}
end repeat
end if
end tell
CHAPTER 1: AppleScript Objects matrix 103

matrix
A transformation matrix specification, used to transform the geometry of objects.

Matrices are used in conjunction with the transform command and as a property of a number of objects.
You can generate an original matrix using the get identity matrix, get translation matrix,
get scale matrix, or get rotation matrix commands.

A matrix is a record containing the matrix values, not a reference to a matrix object. The matrix
commands listed above operate on the values of a matrix record. If a command modifies a matrix, a
modified matrix record is returned as the result of the command. The original matrix record passed to the
command is not modified.

matrix object properties

Property Value type What it is


mvalue_a real Matrix property a.
mvalue_b real Matrix property b.
mvalue_c real Matrix property c.
mvalue_d real Matrix property d.
mvalue_tx real Matrix property tx.
mvalue_ty real Matrix property ty.

matrix object commands


concatenate matrix
concatenate rotation matrix
concatenate scale matrix
concatenate translation matrix
equal matrices
get identity matrix
get rotation matrix
get scale matrix
get translation matrix
invert matrix
singular matrix

Getting a matrix for scale transformation

A matrix can be generated to effect a scale transformation using the get scale matrix command.
-- Scale all art in a document to 50% vertical size
tell application "Adobe Illustrator"
if (count page items in document 1) > 0 then
set scaleMatrix to get scale matrix horizontal scale 100.0 vertical scale 50.0
transform every page item in document 1 using scaleMatrix
end if
end tell
CHAPTER 1: AppleScript Objects matrix 104

Applying multiple transformations

To apply multiple transformations to objects, it is more efficient to use the matrix suite than to apply the
transformations one at a time. The following script demonstrates how to combine multiple matrices.
-- Scale, rotate, and translate all art in a document
tell application "Adobe Illustrator"
if (count page items in document 1) > 0 then
set matrixDef to ¬
get scale matrix horizontal scale 100.0 vertical scale 50.0
set matrixDef to ¬
concatenate rotation matrix matrixDef angle -45.0
set matrixDef to ¬
concatenate translation matrix matrixDef delta x 50.0 delta y -50.0
transform every page item in document 1 using matrixDef
end if
end tell
CHAPTER 1: AppleScript Objects mesh item, mesh items 105

mesh item, mesh items


A gradient mesh art item or list of gradient mesh art items. Scripts cannot create new mesh items, but can
be duplicate, copy and paste them.

mesh item object properties


This class inherits all properties from the page item class.

Property Value type What it is


properties record All properties of this object returned as a record.

mesh item object commands


count
delete
duplicate
exists
move
rotate
scale
transform
translate
CHAPTER 1: AppleScript Objects no color info 106

no color info
Represents the “none” color. Assigning a reference to a no color object to a document’s default fill or
stroke color, or those of an art item, is equivalent to setting their filled or stroked property to false.

This class inherits all properties from the color info class.

Setting color to none


-- Make a new document
-- Make two overlapping rectangles with different fill colors
-- Set the fill color of the top rectangle to no color
tell application "Adobe Illustrator"
activate
make new document with properties {color space:RGB}
make new rectangle in document 1 with properties {position:{200, 500}, width:300,
height:100}
set the fill color of the result to {class:RGB color info, red:255, green:0, blue:0}
make new rectangle in document 1 with properties {position:{150, 550}, width:200,
height:100}
set the fill color of the result to {class:RGB color info, red:0, green:255, blue:0}
delay 1
set the fill color of path item 1 of document 1 to {class:no color info}
end tell
CHAPTER 1: AppleScript Objects non native item, non native items 107

non native item, non native items


A non-native artwork item or a list of those items.

non native item object properties


These classes inherit all properties from the page item class.

Property Value type What it is


properties record All properties of this object returned as a record.

non native item object commands


count
delete
duplicate
exists
move
rotate
scale
transform
translate
CHAPTER 1: AppleScript Objects open options 108

open options
Specifies options that can be supplied when opening a file.

open options object properties

Property Value type What it is


as Valid values: Open as an Illustrator library of the given
Illustrator artwork type. Default: Illustrator artwork
swatches library
brushes library
graphic styles library
symbols library

convert crop area to boolean If true, converts crop areas to artboards


artboard when opening a legacy document in
Illustrator CS4 or later. When false, crop areas
are discarded. Default: true.
convert tiles to boolean If true, converts print tiles to artboards when
artboard opening a legacy document in Illustrator CS4
or later. Default: false.
create artboard with boolean If true, creates an artboard with the
artwork bounding box dimensions of the bounding box of the
artwork when opening a legacy document in
Illustrator CS4 or later. Default: false.
preserve legacy boolean If true, preserves legacy artboards when
artboard opening a legacy document in Illustrator CS4
or later. Default: true.
update legacy boolean If true, preserves the spot colors in the
gradient mesh gradient mesh objects for legacy documents
(pre-Illustrator CS4). Default: true
update legacy text boolean Read-only. If true, update all legacy text
objects for documents saved with Illustrator
version 10 or earlier. Default: false

Open a file with automatic update of legacy text


-- This function opens a file passed to it, any
-- legacy text is automatically updated, fileToOpen
-- is set by the framework this fragment is tested in
on openLegacyFile(fileToOpen)
tell application "Adobe Illustrator"
activate
open POSIX file fileToOpen as alias with options {update legacy text:true}
end tell
end openLegacyFile
CHAPTER 1: AppleScript Objects page item, page items 109

page item, page items


Any art item or list of art items. Every art item and group in a document is a page item. You may refer to a
page item as an element of a document, layer, or group item.

The page item class gives you complete access to every art item contained in an Illustrator document. The
page item class is the superclass of all artwork objects in a document. The compound path item,
group item, mesh item, non native item, path item, placed item, plugin item, raster item, and
text frame classes each inherit a set of properties from the page item class.

You cannot create a page item directly, you must create one of the specific page item subclasses, such as
path item.

page item object elements

Element Refer to by
tag name, index, before/after, range, test

page item object properties

Property Value type What it is


best type type class Read-only. The best type for the page item object’s value.
Always returns reference.
blend mode Valid values: The mode to use when compositing this object. An object is
color blend considered composited when its opacity is set to less than
color burn 100.0 (100%).
color dodge
darken
difference
exclusion
hard light
hue
lighten
luminosity
multiply
normal
overlay
saturation blend
screen
soft light

class type class Read-only. The page item object’s class, which can be any
one of the specific classes that are children of the page item
class, including compound path item, group item, mesh
item, non native item, path item, placed item, plugin
item, raster item, and text frame.

container object reference Read-only. A reference to the layer that contains this page
item.
CHAPTER 1: AppleScript Objects page item, page items 110

Property Value type What it is


control bounds list Read-only. The bounds of the object including stroke width
and controls.
default type type class Read-only. The default type for the page item object’s
value. Always returns reference.
editable boolean Read-only. If true, this page item is editable.
geometric list Read-only. The object’s bounds excluding the stroke width.
bounds

height real The height of the page item, calculated from the geometric
bounds.
hidden boolean If true, this page item is hidden.
index integer Read-only. The position of this page item in the current
stacking order of the containing layer, where page item 1 is
always topmost.
isolated boolean If true, this object is isolated.
knockout Valid values: Is this object used to create a knockout.
unknown
disabled
enabled
inherited

layer object reference Read-only. The layer to which this page item belongs.
locked boolean If true, this page item is locked.
name Unicode text The name of this page item.
note Unicode text The note assigned to this item.
opacity real The opacity of this object, where 100.0 is completely
opaque and 0.0 is completely transparent.
pixel aligned boolean True if the item is aligned to the pixel grid.
position fixed point The position (in points) of the top left corner of the item in
the format {x, y}. Does not include stroke weight.
properties record All properties of this object returned as a record.
selected boolean If true, this object is selected.
sliced boolean If true, preserve slices.
URL Unicode text The value of the Adobe URL tag assigned to this page item.
visibility anything The visibility variable to which this page item path is
variable bound.
visible bounds rectangle Read-only. The object’s visible bounds, including stroke
width of any objects in the illustration.
CHAPTER 1: AppleScript Objects page item, page items 111

Property Value type What it is


width real The width of the page item, calculated from the geometric
bounds.
wrap inside boolean If true, the text frame object should be wrapped inside this
object.
wrap offset number (double) The offset to use when wrapping text around this object.
wrapped boolean If true, wrap text frame objects around this object (text
frame must be above the object).

page item object commands


bring in perspective
count
delete
duplicate
exists
move
rotate
scale
transform
translate

Move a page item

The stacking order of existing page items in a layer can be manipulated using the move command. This
example demonstrates how to move a page item to the top of the stacking order (index position 1) in a
layer.
-- This script moves all objects in a document to the first layer
tell application "Adobe Illustrator"
set allPageItems to every page item of document 1
move allPageItems to beginning of layer 1 of document 1
end tell
CHAPTER 1: AppleScript Objects page marks options 112

page marks options


Specifies the page marks options when printing a document with the print command.

page marks options object properties

Property Value type What it is


bleed offset list The bleed offset rectangle.
color bars boolean If true, color bar printing is enabled. Default: false
marks offset list The page marks offset rectangle.
page info marks boolean If true, page info marks printing is enabled. Default: false
page marks style Valid values: The page marks style. Default: Roman
Japanese
Roman

registration marks boolean If true, the registration marks are printed. Default: false
trim marks boolean If true, printing of trim marks is enabled. Default: false
trim marks weight real Stroke weight of trim marks. Minimum: 0.0. Default: 0.125

Print page marks


-- Make sure a document is available
-- Create a page mark options object
-- Print the document with the page mark options
tell application "Adobe Illustrator"
activate
if not (exists document 1) then error "There is no available document."
set pageMarkOptions to {class:page marks options, color bars:true, page info
marks:true, registration marks:true, trim marks:true}
set printOptions to {class:print options, page marks settings:pageMarkOptions}
print document 1 options printOptions
end tell
CHAPTER 1: AppleScript Objects paper 113

paper
This class contains information about the paper to be used when printing a document with the print
command.

paper object properties

Property Value type What it is


name Unicode text The paper name.
properties paper properties The paper information.
CHAPTER 1: AppleScript Objects paper options 114

paper options
Information about the paper options when printing a document with the print command.

paper options object properties

Property Value type What it is


height real Custom paper’s height in points. Minimum 0.0. Default: 0.0
name Unicode text The paper’s name.
offset real Custom paper’s offset in points. Minimum 0.0. Default: 0.0
transverse boolean If true, transverse the artwork (rotate 90 degrees) on the custom
paper. Default: false
width real Custom paper’s width. Minimum 0.0. Default: 0.0
CHAPTER 1: AppleScript Objects paper properties 115

paper properties
Information about the paper.

paper properties object properties

Property Value type What it is


custom paper boolean If true, it is a custom paper.
height real The paper’s height in points.
imageable area list The imageable area, a rectangle.
width real The paper’s width in points.

Paper size
-- Make new document
-- Make a rectangle and apply a graphic style
-- Get the printer name of the first printer
-- Get the paper name of the first paper of the first printer
-- Print the document to the printer using the paper name as its paper option
tell application "Adobe Illustrator"
activate
make new document
make new rectangle in document 1 with properties {position:{200, 600}, height:400,
width:100}
apply graphic style 2 of document 1 to path item 1 of document 1
if printers is not {} then
set printerName to (name of item 1 of printers) as string
set printerRef to item 1 of printers
if paper sizes of properties of printerRef is not {} then
set paperName to name of item 1 of paper sizes of properties of (get
properties of item 1 of printers)
set paperOptions to {class:paper options, name:paperName}
set printOptions to {class:print options, printer name:printerName, paper
settings:paperOptions}
print document 1 options printOptions
end if
end if
end tell
CHAPTER 1: AppleScript Objects paragraph, paragraphs 116

paragraph, paragraphs
A paragraph or list of paragraphs of text in the contents of a text art item. A document’s text can be
accessed using the character, insertion point, word, line, paragraph and text classes. All text is
contained within text frames.

The paragraph class has additional properties that other related classes do not share, including properties
for margins, tab stop settings, hyphenation, and word/letter spacing.

paragraph object elements

Elements Refer to by
character style name, numeric index, range of elements, before/after another element, satisfying a
test
character numeric index, range of elements, before/after another element, satisfying a test
insertion point numeric index, range of elements, before/after another element, satisfying a test
line numeric index, range of elements, before/after another element, satisfying a test
paragraph style name, numeric index, range of elements, before/after another element, satisfying a
test
paragraph numeric index, range of elements, before/after another element, satisfying a test
text numeric index, range of elements, before/after another element, satisfying a test
word numeric index, range of elements, before/after another element, satisfying a test

paragraph object properties

Property Value type What it is


aki left real The amount of extra space (aki)
added to the left side of each glyph
in Japanese text (in thousandths of
an em).
aki right real The amount of extra space (aki)
added to the right side of each
glyph in Japanese text (in
thousandths of an em).
alignment Valid values: The character alignment type.
bottom
center
icf bottom
icf top
roman baseline
top
CHAPTER 1: AppleScript Objects paragraph, paragraphs 117

Property Value type What it is


alternate glyphs Valid values: The type of alternate glyphs.
default
expert
full width
half width
jis78
jis83
proportional width
quarter width
third width
traditional
jis90
jis04

auto leading boolean If true, automatic leading is used.


auto leading amount real The auto leading amount, as a
percentage.
auto TCY integer The automatic Tate-Chu-Yoko
amount.
baseline direction Valid values: The Japanese text baseline
standard direction.
Tate Chu Yoko
vertical rotated

baseline position Valid values: The baseline position of text.


normal
subscript
superscript

baseline shift real The amount of shift (in points) of


the text baseline.
best type type class Read-only. The best type for the
object’s value.
BunriKinshi boolean If true, BunriKinshi is enabled.
Burasagari type Valid values: The Burasagari type which specifies
forced whether punctuation is allowed to
none fall outside of the paragraph
standard bounding box (not available when
Kinsoku Shori is set to None).
capitalization Valid values: The case of the text.
all caps
all small caps
normal
small caps

character offset integer Offset of the first character.


class type class Read-only. The object’s class.
connection forms boolean If true, use the OpenType
connection forms.
CHAPTER 1: AppleScript Objects paragraph, paragraphs 118

Property Value type What it is


container reference Read-only. The object’s container.
contents Unicode text The text content.
contextual ligature boolean If true, use the contextual ligature.
default type type class Read-only. The default type for the
object’s value.
desired glyph scaling real Desired glyph scaling, expressed as
a percentage of the default
character width. Range: 50.0 to
200.0; at 100.0, the width of
characters is not changed.
desired letter real Desired letter spacing, expressed as
spacing a percentage of the default kerning
or tracking Range: -100.0 to 500.0;
at 0, no space is added between
letters; at 100.0, an entire space
width is added between letters.
desired word spacing real Desired word spacing, expressed as
a percentage of the default space
for the font. Range: 0.0 to 1000.0; at
100.00, no space is added between
words.
discretionary boolean If true, use the discretionary
ligature ligature.
every line composer boolean If true, the Every-line Composer is
enabled. If false, the Single-line
Composer is enabled.
figure style Valid values: The number style for OpenType
default font.
proportional
proportional oldstyle
tabular
tabular oldstyle

fill color color info The color of the text fill.


first line indent real First line left indent expressed in
points.
fractions boolean If true, uses OpenType fractions.
horizontal scale real The character horizontal scaling
factor expressed as a percentage
(100 = 100%).
hyphenate capitalized boolean If true, hyphenation is enabled for
words capitalized words.
CHAPTER 1: AppleScript Objects paragraph, paragraphs 119

Property Value type What it is


hyphenation boolean If true, hyphenation is enabled for
the paragraph.
hyphenation real Hyphenation preference scale for
preference better spacing (0) or fewer hyphens
(1).
Range: 0.0 to 1.0
hyphenation zone real The distance (in points) from the
right edge of the paragraph that
marks the part of the line where
hyphenation is not allowed.
0 allows all hyphenation. Valid only
when every line composer is false.
index integer The index of this instance of the
object.
italics boolean If true, the Japanese OpenType
support supports the italic style.
justification Valid values: Paragraph justification.
center
full justify last line center
full justify last line full
full justify last
line left
full justify last line right
left
right

kerning integer Controls the spacing between two


characters, in thousandths of an
em.
kerning method Valid values: The automatic kerning method to
auto use.
none
optical

Kinsoku Unicode text The name of a Kinsoku Shori set (a


set of characters which cannot be
used to begin or end a line of
Japanese text).
Kinsoku order Valid values: The preferred Kinsoku order.
push in
push out first
push out only

KurikaeshiMojiShori boolean If true, Kurikaeshi Moji Shori is


enabled (controls how repeated
characters are handled in Japanese
text).
CHAPTER 1: AppleScript Objects paragraph, paragraphs 120

Property Value type What it is


language Valid values: The language.
Bokmal Norwegian
Brazillian Portuguese
Bulgarian
Canadian French
Catalan
Chinese
Czech
Danish
Dutch
Dutch 2005 Reform
English
Finnish
German 2006 Reform
Greek
Hungarian
Icelandic
Italian
Japanese
Nynorsk Norwegian
old German
Polish
Romanian
Russian
Spanish
Serbian
standard French
standard German
standard Portuguese
Swedish
Swiss German
Swiss German 2006 Reform
Turkish
UK English
Ukranian

leading real Specifies the amount of space


between two lines of text (in
points).
leading type Valid values: Auto leading type.
Japanese
Roman

left indent real Left indent of margin expressed in


points.
length integer The number of characters in the
paragraph. Minimum: 0
ligature boolean If true, the ligature should be used.
maximum consecutive integer Maximum number of consecutive
hyphens hyphenated lines.
CHAPTER 1: AppleScript Objects paragraph, paragraphs 121

Property Value type What it is


maximum glyph scaling real Maximum glyph scaling, expressed
as a percentage of the default
character width. Range: 50.0 to
200.0; at 100.0, the width of
characters is not changed.

NOTE: Valid only for justified


paragraphs.
maximum letter real Maximum letter spacing, expressed
spacing as a percentage of the default
kerning or tracking Range: -100.0 to
500.0; at 0, no space is added
between letters; at 100.0, an entire
space width is added between
letters.

NOTE: Valid only for justified


paragraphs.
maximum word spacing real Maximum word spacing, expressed
as a percentage of the default
space for the font. Range: 0.0 to
1000.0; at 100.00, no space is added
between words.

NOTE: Valid only for justified


paragraphs.
minimum after hyphen integer Minimum number of characters
after a hyphen.
minimum before hyphen integer Minimum number of characters
before a hyphen.
minimum glyph scaling real Minimum glyph scaling, expressed
as a percentage of the default
character width. Range: 50.0 to
200.0; at 100.0, the width of
characters is not changed.

NOTE: Valid only for justified


paragraphs.
minimum hyphenated integer Minimum number of characters for
word size a word to be hyphenated.
CHAPTER 1: AppleScript Objects paragraph, paragraphs 122

Property Value type What it is


minimum letter real Minimum letter spacing, expressed
spacing as a percentage of the default
kerning or tracking Range: -100.0 to
500.0; at 0, no space is added
between letters; at 100.0, an entire
space width is added between
letters.

NOTE: Valid only for justified


paragraphs.
minimum word spacing real Minimum word spacing, expressed
as a percentage of the default
space for the font. Range: 0.0 to
1000.0; at 100.00, no space is added
between words

NOTE: Valid only for justified


paragraphs.
Mojikumi Unicode text The name of a predefined Mojikumi
set for Japanese text composition.
no break boolean If true, a break is allowed.
ordinals boolean If true, use the OpenType ordinals.
ornaments boolean If true, use the OpenType
ornaments.
overprint fill boolean If true, overprint the fill of the text.
overprint stroke boolean If true, the stroke of the text may
be overprinted.
OpenType position Valid values: The OpenType baseline position.
default
denominator
numerator
subscript
superscript

properties record All properties of this object


returned as a record.
proportional metrics boolean If true, the proportional metrics in
Japanese OpenType may be used.
right indent real Right indent of margin expressed in
points.
roman hanging boolean If true, Roman hanging
punctuation is enabled.
rotation r eal The character rotation angle.
CHAPTER 1: AppleScript Objects paragraph, paragraphs 123

Property Value type What it is


selection list of text The selected text.
single word Valid values: Justification type for a single word.
justification center
full justify last line center
full justify
full justify last line left
full justify last line right
left
right

size real Font size in points.


space after real Spacing after paragraph in points.
space before real Spacing before paragraph in
points.
story story The story in the paragraph.
strike through boolean If true, characters use
strike-through style.
stroke color color info The color of the text stroke.
stroke weight real line width of stroke.
stylistic alternates boolean If true, use the OpenType stylistic
alternates.
swash boolean If true, use the OpenType swash.
tab stops list of tab stop info Tab stop settings.
TCY horizontal integer The Tate-Chu-Yoko horizontal
adjustment in points.
TCY vertical integer The Tate-Chu-Yoko vertical
adjustment in points.
text font text The text font.
titling boolean If true, the OpenType titling
alternates should be used.
tracking integer The tracking or range kerning
amount in thousandths of an em.
Tsume real The percentage of space reduction
around a Japanese character.
underline boolean If true, characters use underline
style.
vertical scale real Character vertical scaling factor.
CHAPTER 1: AppleScript Objects paragraph, paragraphs 124

Property Value type What it is


warichu characters integer How the characters in Wari-Chu
after break text (an inset note in Japanese text)
are divided into two or more lines.
warichu characters integer How the characters in Wari-Chu
before break text (an inset note in Japanese text)
are divided into two or more lines.
warichu enabled boolean If true, Wari-Chu is enabled.
warichu gap integer The Wari-Chu line gap.
warichu justification Valid values: The Wari-Chu justification.
auto justify
center
full justify last line center
full justify
full justify last line left
full justify last line right
left
right

warichu lines integer The number of Wari-Chu (multiple


text lines fit into a space meant for
one) lines.
warichu scale real The Wari-Chu scale.

paragraph object commands


apply character style
apply paragraph style
change case
count
delete
deselect
duplicate
exists
make
move
select

Change hyphenation in text

The hyphenation of all text can be quickly changed from a script, as this example shows.
-- Enable hyphenation for every paragraph of the current document
tell application "Adobe Illustrator"
if (count text frames of document 1) > 0 then
set itemCounter to count text frames of document 1
repeat with i from 1 to itemCounter
set hyphenation of (every paragraph of text frame i of document 1) to true
end repeat
end if
end tell
CHAPTER 1: AppleScript Objects paragraph, paragraphs 125

Resize and justify paragraphs


-- Make a new document and a rectangle
-- Make an area-text text frame, assign the rectangle as it's path
-- Set contents of the text frame to text containing three paragraphs
-- Resize and justify the paragraphs
tell application "Adobe Illustrator"
activate
make new document
make new rectangle in document 1 with properties {position:{100, 400}, width:400,
height:200}
set areaText to make new text frame in document 1 with properties {kind:area text,
text path:the result}
set theParagraph to "Left justified paragraph." & return & "Center justified
paragraph." & return & "Right justified paragraph."
set the contents of areaText to theParagraph
set the size of the text of areaText to 28
set the justification of paragraph 1 of areaText to left
set the justification of paragraph 2 of areaText to center
set the justification of paragraph 3 of areaText to right
end tell
CHAPTER 1: AppleScript Objects paragraph style, paragraph styles 126

paragraph style, paragraph styles


A named style that remembers paragraph attributes.

NOTE: Paragraph attributes do not have default values, and they are undefined until explicitly set.

paragraph style object properties

Property Value type What it is


best type type class Read-only. The best type for the
object’s value.
class type class Read-only. The object’s class.
default type type class Read-only. The default type for the
object’s value.
aki left real The amount of extra space (aki)
added to the left side of each
glyph in Japanese text (in
thousandths of an em).
aki right real The amount of extra space (aki)
added to the right side of each
glyph in Japanese text (in
thousandths of an em).
alignment Valid values: The character alignment type.
bottom
center
icf bottom
icf top
roman baseline
top

alternate glyphs Valid values: Specifies the type of alternate


default glyphs.
expert
full width
half width
jis78
jis83
proportional width
quarter width
third width
traditional
jis90
jis04

auto leading boolean If true, automatic leading is used.


auto leading amount real The auto leading amount, as a
percentage.
CHAPTER 1: AppleScript Objects paragraph style, paragraph styles 127

Property Value type What it is


baseline direction Valid values: Specifies the Japanese text
standard baseline direction.
Tate Chu Yoko
vertical rotated

baseline position Valid values: The baseline position of text.


normal
subscript
superscript

baseline shift real The amount of shift (in points) of


the text baseline.
best type type class Read-only. The best type for the
object’s value.
BunriKinshi boolean If true, BunriKinshi is enabled.
Burasagari type Valid values: The Burasagari type which
forced specifies whether punctuation is
none allowed to fall outside of the
standard paragraph bounding box (not
available when Kinsoku Shori is set
to none).
capitalization Valid values: The case of the text.
all caps
all small caps
normal
small caps

connection forms boolean If true, use the OpenType


connection forms.
container reference Read-only. The object’s container.
contextual ligature boolean If true, use the contextual ligature.
desired glyph scaling real Desired glyph scaling expressed as
a percentage.
desired letter spacing real Desired letter spacing expressed as
a percentage.
desired word spacing real Desired word spacing expressed as
a percentage.
discretionary boolean If true, use the discretionary
ligature ligature.
every line composer boolean If true, the every line composer is
enabled.
CHAPTER 1: AppleScript Objects paragraph style, paragraph styles 128

Property Value type What it is


figure style Valid values: Specifies which figure style to use
default in an OpenType font.
proportional
proportional oldstyle
tabular
tabular oldstyle

fill color color info The color of the text fill.


first line indent real First line left indent expressed in
points.
fractions boolean If true, use the OpenType
fractions.
horizontal scale real The character horizontal scaling
factor expressed as a percentage
(100 = 100%).
hyphenate capitalized boolean If true, hyphenation is enabled for
words the capitalized words.
hyphenation boolean If true, hyphenation is enabled for
the paragraph.
hyphenation real Hyphenation preference scale for
preference better spacing (0) or fewer
hyphens (1). Range: 0.0 to 1.0
hyphenation zone real Size of the hyphenation zone.
index integer Read-only. The index of this
instance of the object.
italics boolean If true, the Japanese OpenType
font supports italic text.
justification Valid values: Paragraph justification.
center
full justify
full justify last line center
full justify last line left
full justify last line right
left
right

kerning method Valid values: The automatic kerning method to


auto use.
none
optical

Kinsoku Unicode text The name of a Kinsoku Shori set (a


set of characters which cannot be
used to begin or end a line of
Japanese text).
CHAPTER 1: AppleScript Objects paragraph style, paragraph styles 129

Property Value type What it is


Kinsoku order Valid values: The preferred Kinsoku order.
push in
push out first
push out only

KurikaeshiMojiShori boolean If true, the Kurikaeshi Moji Shori is


enabled (controls how repeated
characters are handled in Japanese
text).
language Valid values: The language.
Bokmal Norwegian
Brazillian Portuguese
Bulgarian
Canadian French
Catalan
Chinese
Czech
Danish
Dutch
Dutch 2005 Reform
English
Finnish
German 2006 Reform
Greek
Hungarian
Icelandic
Italian
Japanese
Nynorsk Norwegian
old German
Polish
Romanian
Russian
Spanish
Serbian
standard French
standard German
standard Portuguese
Swedish
Swiss German
Swiss German 2006 Reform
Turkish
UK English
Ukranian

leading real Specifies the amount of space


between two lines of text, in
points.
leading type Valid values: Auto leading type.
Japanese
Roman

left indent real Left indent of margin expressed in


points.
CHAPTER 1: AppleScript Objects paragraph style, paragraph styles 130

Property Value type What it is


ligature boolean If true, use the ligature.
maximum consecutive integer Maximum number of consecutive
hyphens hyphenated lines.
maximum glyph scaling real Maximum glyph scaling expressed
as a percentage.
maximum letter spacing real Maximum letter spacing expressed
as a percentage.
maximum word spacing real Maximum word spacing expressed
as a percentage.
minimum after hyphen integer Minimum number of characters
after a hyphen.
minimum before hyphen integer Minimum number of characters
before a hyphen.
minimum glyph scaling real Minimum glyph scaling expressed
as a percentage.
minimum hyphenated integer Minimum hyphenated word size.
word size

minimum letter spacing real Minimum letter spacing expressed


as a percentage.
minimum word spacing real Minimum word spacing expressed
as a percentage.
Mojikumi Unicode text The name of a predefined
Mojikumi set for Japanese text
composition.
name Unicode text The paragraph style’s name.
no break boolean If true, no line break is allowed.
OpenType position Valid values: The OpenType baseline position.
default
denominator
numerator
subscript
superscript

ordinals boolean If true, use the OpenType ordinals.


ornaments boolean If true, use the OpenType
ornaments.
overprint fill boolean If true, overprint the fill of the text.
overprint stroke boolean If true, the stroke of the text may
be overprinted.
CHAPTER 1: AppleScript Objects paragraph style, paragraph styles 131

Property Value type What it is


proportional metrics boolean If true, the proportional metrics in
a Japanese OpenType font may be
used.
right indent real Right indent of margin expressed
in points.
roman hanging boolean If true, Roman hanging
punctuation is enabled.
rotation real The character rotation angle.
single word Valid values: Justification type for a single word.
justification center
full justify last line center
full justify
full justify last line left
full justify last line right
left
right

size real Font size in points.


space after real Spacing after paragraph in points.
space before real Spacing before paragraph in
points.
strike through boolean If true, characters use
strike-through style.
stroke color color info The color of the text stroke.
stroke weight real line width of stroke.
stylistic alternates boolean If true, use the OpenType stylistic
alternates.
swash boolean If true, use the OpenType swash.
tab stops list of tab stop info Tab stop settings.
TCY horizontal integer The Tate-Chu-Yoko horizontal
adjustment in points.
TCY vertical integer The Tate-Chu-Yoko vertical
adjustment in points.
text font text The text font.
titling boolean If true, use the OpenType titling
alternates.
tracking integer The tracking or range kerning
amount in thousandths of an em.
Tsume real The percentage of space reduction
around a Japanese character.
CHAPTER 1: AppleScript Objects paragraph style, paragraph styles 132

Property Value type What it is


underline boolean If true, characters use underline
style.
vertical scale real Character vertical scaling factor.
warichu characters integer How the characters in Wari-Chu
after break text (an inset note in Japanese
text) are divided into two or more
lines.
warichu characters integer How the characters in Wari-Chu
before break text (an inset note in Japanese
text) are divided into two or more
lines.
warichu enabled boolean If true, Wari-Chu is enabled.
warichu gap integer The Wari-Chu line gap.
warichu justification Valid values: The Wari-Chu justification.
auto justify
center
full justify last line center
full justify
full justify last line left
full justify last line right
left
right

warichu lines integer The number of Wari-Chu (multiple


text lines fit into a space meant for
one) lines.
warichu scale real The Wari-Chu scale.
CHAPTER 1: AppleScript Objects paragraph style, paragraph styles 133

Apply paragraph styles


-- Make a new document and a rectangle
-- Make an area-text text frame, assign the rectangle as it's path
-- Set contents of text frame to text containing three paragraphs
-- Resize and justify the paragraphs
-- Make a new paragraph style with a set of options
-- Apply the paragraph style to the text of the text frame
tell application "Adobe Illustrator"
activate
make new document
make new rectangle in document 1 with properties {position:{100, 400}, width:400,
height:200}
set areaText to make new text frame in document 1 with properties {kind:area text,
text path:the result}
set theParagraph to "Left justified paragraph." & return & "Center justified
paragraph." & return & "Right justified paragraph."
set the contents of areaText to theParagraph
set the size of the text of areaText to 28
set the justification of paragraph 1 of areaText to left
set the justification of paragraph 2 of areaText to center
set the justification of paragraph 3 of areaText to right
delay 2
make new paragraph style in document 1 with properties {class:paragraph style,
name:"ParSty 1"}
apply paragraph style paragraph style "ParSty 1" of document 1 to text of text frame
1 of document 1 with clearing overrides
end tell
CHAPTER 1: AppleScript Objects path item, path items 134

path item, path items


A path or list of paths. A path is an art item such as those created using the Line, Rectangle, or Pen Tools. A
path consists of path points that define its geometry. Path points are defined either as a path point
object or as an x-y page coordinate pair.

The path items class gives you complete access to paths in Illustrator.

path item object elements

Element Refer to by
path point index, before/after, range, test

path item object properties


This object class inherits all properties from the page item class.

Property Value type What it is


area real Read-only. The area of this path in square points. An area may be
negative or even 0. The paths winding order is determined by the
sign of area. If the area is negative, the path is wound
counter-clockwise. Self-intersecting paths may contain sub-areas
that cancel each other out. Therefore, it is possible for a path’s area
to appear as zero even though it has apparent area.
clipping boolean If true, use this path as a clipping path.
closed boolean If true, this path closed.
entire path list of path point All the path item’s path points.
info

evenodd boolean If true, use the even-odd rule to determine insideness.


fill color color info The fill color of the path.
fill boolean If true, the art beneath a filled object should be overprinted.
overprint

filled boolean If true, the path should be filled.


guides boolean If true, this path is a guide object.
length real Read-only. The length of this path in points.
polarity Valid values: The polarity of the path, used in the creation of compound paths.
positive
negative

resolution real The resolution of the path in dots per inch.


selected path list of object Read-only. All selected path points in the path.
points references
CHAPTER 1: AppleScript Objects path item, path items 135

Property Value type What it is


stroke cap Valid values: The type of line capping.
butted
rounded
projecting

stroke color color info The stroke color for the path.
stroke dash real The default distance into the dash pattern at which the pattern
offset should be started
stroke dashes list of real The lengths for dashes and gaps in dashed lines, starting with the
numbers first dash length, followed by the first gap length, and so on. Set to
an empty list, {}, for a solid line.
stroke join Valid values: Type of join for the path.
mitered
rounded
beveled

stroke miter real When default stroke join is set to mitered, specifies when the join
limit will be converted to beveled (squared-off ) by default. The default
miter limit of 4 means that when the length of the point reaches
four times the stroke weight, the join switches from a miter join to
a bevel join. Values: 1 to 500. 1 specifies a bevel join.
stroke boolean If true, the art beneath the stroked object should be overprinted.
overprint

stroke width real The width of the stroke (in points).


stroked boolean If true, the path should be stroked.

path item object commands


count
delete
duplicate
exists
move
rotate
scale
transform
translate

Setting stroke width and color


-- Set the stroke of the first path to a red 4 point line
tell application "Adobe Illustrator"
if (count path items of document 1) > 0 then
set properties of path item 1 of document 1 to ¬
{stroke color:{red:255.0}, stroke width:4.0}
end if
end tell
CHAPTER 1: AppleScript Objects path point, path points 136

path point, path points


A point or points on a specific path. Each path point is made up of a fixed point (anchor) and a pair of
handles (left direction and right direction). Any point can considered a corner point. Setting the
point type property of a path point to a corner forces the left and right direction points to be on a straight
line when the user attempts to modify them in the user interface.

path point object properties

Property Value type What it is


anchor fixed point The position of this point’s anchor point.
best type type class Read-only. The best type for the path point object’s
value. Always returns reference.
class type class Read-only. The path point object’s class, which is
path point.

container reference Read-only. The object’s container.


default type type class Read-only. The default type for the path point
object’s value. Always returns reference.
index integer Read-only. The position of this path point in the path
item.
left direction fixed point The position of the path point’s left direction point
(in position).
point type Valid values: Is this a corner path point or a curve path point.
smooth
corner

properties record All properties of this object returned as a record.


right direction fixed point The position of the path point’s left direction point
(out position).
selected Valid values: Specifies which points in this path point are currently
none selected.
anchor selected
left selected
right selected
left right selected
CHAPTER 1: AppleScript Objects path point, path points 137

path point object commands


count
delete
duplicate
exists
make

Move a path point


-- Move the first point in a path to the same spot as the last point
tell application "Adobe Illustrator"
set lastAnchor to ""
if (count path items of document 1) > 0 then
set lastAnchor to anchor of last path point of path item 1 of document 1
set anchor of path point 1 of path item 1 of document 1 to lastAnchor
end if
end tell

Get coordinates for path points


-- Returns the coordinates of each point on a path
tell application "Adobe Illustrator"
if (count path items of document 1) > 0 then
set anchorList to (anchor of every path point of path item 1 of document 1)
end if
end tell
CHAPTER 1: AppleScript Objects path point info 138

path point info


Path point information for a specific path item, returned by the entire path property of a path item. All
path points in a specific path item can be retrieved and specified using entire path, which returns a list
of path point info records.

path point info object properties

Property Value type What it is


anchor list The position of a path point’s anchor point.
left direction list The position of a path point’s left direction point (in position).
point type Valid values: Specifies whether the point is a corner path point or a curve
smooth path point.
corner

right direction fixed point The position of a path point’s left direction point (out position).

Get path point information


-- Returns the path points of the first path
tell application "Adobe Illustrator"
if (count path items of document 1) > 0 then
set pointList to entire path of path item 1 of document 1
end if
end tell
CHAPTER 1: AppleScript Objects pattern, patterns 139

pattern, patterns
An Illustrator pattern definition contained in a document. Patterns are shown in the Swatches palette.
Each pattern is referenced by a pattern color info object, which defines the pattern’s appearance.

pattern object properties

Property Value type What it is


best type type class Read-only. The best type for the pattern object’s value. Always
returns reference.
class type class Read-only. The object’s class, which is pattern.
container object reference Read-only. A reference to the document that contains this
pattern.

default type type class Read-only. The default type for the pattern object’s value.
Always returns reference.
index integer Read-only. The position of this pattern in the application.
name Unicode text The pattern name.
properties record All properties of this object returned as a record.

pattern object commands


count
delete
duplicate
exists

Get the name of a pattern


-- Returns the name of the first pattern
tell application "Adobe Illustrator"
set pathname to name of pattern 1 of document 1
end tell
CHAPTER 1: AppleScript Objects pattern color info 140

pattern color info


A pattern color specification, used to specify a pattern color in conjunction with the color property.
Pattern colors are created using a reference to an existing pattern in a document. A matrix may be
specified to further transform the pattern color.

pattern color info object properties


This class inherits all properties from the color info class.

Property Value type What it is


matrix matrix An additional transformation matrix to manipulate the
prototype pattern.
pattern object A reference to the pattern object that defines the pattern to use
reference in this color definition.
reflect boolean If true, the prototype should be reflected before filling. Default:
false

reflect angle real The axis (in degrees) around which to reflect. Default: 0.0
rotation real The angle (in degrees) to rotate the prototype pattern before
filling. Default: 0.0
scale factor fixed point The horizontal and vertical scaling to scale the prototype pattern
expressed as a fixed point. Default: 0.0
shear angle real The angle (in degrees) to slant the shear by. Default: 0.0
shear axis real The axis (in degrees) to be used for shearing. Default: 0.0
shift angle real The angle (in degrees) to translate the unscaled prototype
pattern before filling. Default: 0.0

shift distance real The distance to translate the unscaled prototype pattern before
filling. Default: 0.0

Using a pattern color


--Set the default fill of the document to the first pattern
tell application "Adobe Illustrator"
set default fill color of document 1 to {pattern:pattern 1 of document 1}
end tell
CHAPTER 1: AppleScript Objects PDF options 141

PDF options
Options that can be supplied when opening a PDF file.

PDF options object properties

Property Value type What it is


best type type class Read-only. The best type for the object’s value.
class type class Read-only. The object’s class.
container reference Read-only. The object’s container.
default type type class Read-only. The default type for the object’s value.
page integer What page should be used when opening a multipage
document. Default: 1
PDF crop bounds Valid values: What box should be used when placing a multipage
PDF art box document. Default: PDF media box
PDF bleed box
PDF bounding box
PDF crop box
PDF media box
PDF trim box

properties record All properties of this object returned as a record.

Open a PDF document


-- This function opens the file passed as
-- a file reference parameter at page 2, fileToOpen is
-- a reference to a multi-page PDF file and needs to
-- be set up before calling this function
on openMultipageFile(fileToOpen)
tell application "Adobe Illustrator"
set user interaction level to never interact
set page of PDF file options of settings to 2
open POSIX file fileToOpen as alias without dialogs
end tell
end openMultipageFile
CHAPTER 1: AppleScript Objects PDF save options 142

PDF save options


Options that can be supplied when saving a document as an Adobe PDF file. See the save command for
additional details. This class contains properties used to specify options when saving a document to a PDF
file. PDF save options can be supplied only in conjunction with the save command. It is not possible to
get or create a PDF save options object.

Preset options can be exported from and imported to a document; see the export PDF preset and
import PDF preset commands.

PDF save options object properties

Property Value type What it is


acrobat layers boolean Optional. Create Adobe Acrobat® layers from
top-level layers; Acrobat 6 only option
Default: false
allow printing Valid values: Optional. PDF security printing permission.
pdf 128 print high res Default: pdf 128 print high res
pdf 128 print low res
pdf 128 print none
pdf 40 print high res
pdf 40 print none

artboard range string Optional. This is considered for multi-asset


extraction, which specifies the artboard
range. An empty string extracts all the
artboards. Default: empty string
bleed link boolean Optional. Link four bleed values.
Default: true
bleed offset list The bleed offset rectangle
changes allowed Valid values: Optional. Which PDF security changes are
pdf 128 any changes allowed. Default: pdf 128 any changes
pdf 128 commenting allowed
pdf 128 edit page allowed
pdf 128 fill form allowed
pdf 128 no changes
pdf 40 any changes
pdf 40 commenting allowed
pdf 40 no changes
pdf 40 page layout allowed

color bars boolean Optional. Draw color bars. Default: false


CHAPTER 1: AppleScript Objects PDF save options 143

Property Value type What it is


color Valid values: Optional. How color bitmap images should
compression automatic JPEG high be compressed.
automatic JPEG low Default: automatic JPEG maximum
automatic JPEG maximum
automatic JPEG medium
automatic JPEG minimum
automatic JPEG2000 high
automatic JPEG2000 lossless
automatic JPEG2000 low
automatic JPEG2000 maximum
automatic JPEG2000 medium

color Valid values: Optional. PDF color conversion policy.


conversion id repurpose Default: none
color conversion to dest
none

color Valid values: Optional. The color destination, when color


destination id color dest doc cmyk conversion is performed. Default: none
color dest doc rgb
color dest profile
color dest working cmyk
color dest working rgb
none

color real Optional. The resolution to which to


downsampling downsample color image. If 0, no
downsampling. Default: 150.
color real Optional. Downsample if the image’s
downsampling resolution is above this value. Default: 450.0
threshold

color profile Valid values: Optional. PDF color profile inclusion policy.
id include all profiles Default: none
include all rgb
include dest profile
leave profile unchanged
none

color resample Valid values: Optional. How color bitmap images should
average downsampling be resampled. Default: nodownsample
bicubic downsample
nodownsample
subsampling

color tile size integer Optional. Tile size when compressing with
JPEG2000. Default: 256
compatibility Valid values: Optional. The version of the Acrobat file
Acrobat 4 format to create. Default: Acrobat 5
Acrobat 5
Acrobat 6
Acrobat 7
Acrobat 8

compress art boolean Optional. If true, the line art and text should
be compressed. Default: true
CHAPTER 1: AppleScript Objects PDF save options 144

Property Value type What it is


document Unicode text Optional. A password string to open the
password document. Default: no string
enable access boolean Optional. If true, accessing 128-bit should be
enabled. Default: true
enable copy boolean Optional. If true, enable copying of text
128-bit. Default: true
enable copy and boolean Optional. If true, enable copying and
access accessing 40-bit. Default: true
enable boolean Optional. If true, enable plaintext metadata
plaintext 128-bit; available only for Acrobat 6.
Default: false
flattener Unicode text Optional. The transparency flattener preset
preset name.
flattener ExportForScreens Optional. The printing flattener options.
settings

font subset real Optional. Include a subset of fonts when less


threshold than this percentage of characters are used.
Range: 0.0 to 100.0. Default: 100.0
generate boolean Optional. If true, generate thumbnails for
thumbnails the saved document. Default: true
grayscale Valid values: Optional. How grayscale bitmap images
compression automatic JPEG high should be compressed. Default: none
automatic JPEG low
automatic JPEG maximum
automatic JPEG medium
automatic JPEG minimum
automatic JPEG2000 high
automatic JPEG2000 lossless
automatic JPEG2000 low
automatic JPEG2000 maximum
automatic JPEG2000 medium
automatic JPEG2000 minimum
none

grayscale real Optional. The resolution to which to


downsampling downsample grayscale images. If 0, no
downsampling. Default: 150.0
grayscale real Optional. Downsample if the image’s
downsampling resolution is above this value. Default: 225.0
threshold

grayscale Valid values: Optional. How the grayscale bitmap images


resample average downsampling should be resampled. Default: nodownsample
bicubic downsample
nodownsample
subsampling
CHAPTER 1: AppleScript Objects PDF save options 145

Property Value type What it is


grayscale tile integer Optional. Tile size when compressing with
size JPEG2000. Default: 256
monochrome Valid values: Optional. How monochrome bitmap images
compression CCIT3 should be compressed. Default: none
CCIT4
none
run length
ZIP

monochrome real Optional. The resolution to which to


downsampling downsample monochrome images. If 0, no
downsampling. Default: 300.0
monochrome real Optional. Downsample if the image’s
downsampling resolution is above this value. Default: 450.0
threshold

monochrome Valid values: Optional. How monochrome bitmap images


resample average downsampling should be resampled. Default: nodownsample
bicubic downsample
nodownsample
subsampling

offset real Optional. Custom offset (in points) for using


the custom paper. Default: 0.0
optimization boolean Optional. If true, the PDF file should be
saved for fast web view. Default: false
output Unicode text Optional. A comment that describes the
condition intended printing condition.
Default: no string
output Unicode text Optional. The name of a registered printing
condition id condition. Default: no string
output intent Unicode text Optional. The color profile for the intended
profile output. When CMS is on, this is the same as
the profile selected for Destination in the
Color group box. Default: no string
page info boolean Optional. If true, draw page information.
Default: false
page marks Valid values: Optional. The page marks style.
style Japanese style Default: Roman
Roman

PDF preset Unicode text Optional. Name of PDF preset to use.


Maximum string length is 255 bytes.
CHAPTER 1: AppleScript Objects PDF save options 146

Property Value type What it is


pdfXstandard Valid values: Optional. The PDF standard, or none if not
PDFX None complying with any standard.
PDFX 1a 2001 Default: PDFX None
PDFX 1a 2003
PDFX 3 2002
PDFX 3 2003
PDFX 4 2007

pdfXstandard Unicode text Optional. A description of the selected PDF


description standard.
permission Unicode text Optional. A password string to restrict editing
password security settings. Default: no string
preserve boolean Optional. If true, preserve Illustrator editing
editability capabilities when saving the document.
Default: true
printer real Optional. Flattening style printer resolution.
resolution Default: 800.0
registration boolean Optional. If true, draw registration marks.
marks Default: false
require doc boolean Optional. If true, require a password to open
password the document. Default: false
require perm boolean Optional. If true, a password is required to
password edit security settings. Default: false
trapped boolean Optional. If true, manual trapping has been
prepared in the document. Default: false
trim mark Valid values: Optional. Weight of the trim marks. Default:
weight trimmarkweight0125 trimmarkweight0125
trimmarkweight025
trimmarkweight05

trim marks boolean Optional. If true, draw trim marks.


Default: false
view pdf boolean Optional. If true, view PDF after saving.
Default: false
CHAPTER 1: AppleScript Objects PDF save options 147

Save to PDF

This handler processes a folder of Illustrator files, saving each file as a PDF file, with Illustrator editability
and Acrobat® 6 compatibility. Note that the class property is specified in the record to ensure that
Illustrator can determine the save option class.
-- Opens files from a predefined source folder in Illustrator
-- then exports them to a predefined destination folder in the chosen format
-- fileList is a list of file names in the source folder
-- filePath is the full path to the source folder
-- destFolder is an alias to a folder where the files are to be saved

on SaveFilesAsPDF(fileList, filePath, destFolder)


set destPath to destFolder as string
set fileCount to count of fileList
if fileCount > 0 then
repeat with i from 1 to fileCount
set fileName to item i of fileList
set fullPath to filePath & fileName
set newFilePath to destPath & fileName & ".pdf"
tell application "Adobe Illustrator"
open POSIX file fullPath as alias without dialogs
save current document in file newFilePath as pdf ¬
with options {class:PDF save options ¬
, compatibility:Acrobat 5 ¬
, preserve editability:true}
close current document saving no
end tell
end repeat
end if
end SaveFilesAsPDF
CHAPTER 1: AppleScript Objects Photoshop export options 148

Photoshop export options


Options that can be supplied when exporting a document as a Photoshop file. See the export command
for additional details.

This class contains properties that specify options when exporting a document as a Photoshop file.
Photoshop export options can only be supplied in conjunction with the export command. It is not
possible to get or create a Photoshop export options object.

Photoshop export options object properties

Property Value type What it is


antialiasing boolean If true, the exported image should be anti-aliased. Default: true
artboard range string If save multiple artboards is true, this is considered for
multi-asset extraction, which specifies the artboard range. An
empty string extracts all the artboards. Default: empty string
color space Valid values: The color space of the exported file. Default: RGB
Gray
RGB
CMYK

editable text boolean If true, text objects should be exported as editable text layers.
Default: true
embed ICC boolean If true, an ICC profile should be embedded in the exported image.
profile Default: false
maximum boolean If true, preserve as much of the original document’s structure as
editability possible. Default: true
resolution real Specifies the resolution of the exported image in dots per inch.
Default: 150.0
save multiple boolean If true, all artboards or range of artboards are saved.
artboards Default: false
warnings boolean If true, a warning dialog should be displayed because of conflicts
in the export settings. Default: true
write layers boolean If true, the layers of the Illustrator document should be preserved
in the exported image. Default: true
CHAPTER 1: AppleScript Objects Photoshop export options 149

Export to Photoshop format with options

This handler saves all files in a folder as layered Photoshop files. Note that the class property is specified
in the record to ensure that Illustrator can determine the save option class.
-- Opens files from a predefined source folder in Illustrator
-- then exports them to a predefined destination folder in the chosen format
-- fileList is a list of file names in the source folder
-- filePath is the full path to the source folder
-- destFolder is an alias to a folder where the files are to be saved

on SaveFilesAsPhotoshop(fileList, filePath, destFolder)


set destPath to destFolder as string
set fileCount to count of fileList
if fileCount > 0 then
repeat with i from 1 to fileCount
set fileName to item i of fileList
set fullPath to filePath & fileName
set newFilePath to destPath & fileName & ".psd"
tell application "Adobe Illustrator"
open POSIX file fullPath as alias without dialogs
export current document to file newFilePath as Photoshop ¬
with options {class:Photoshop export options ¬
, color space:RGB ¬
, embed ICC profile:true ¬
, resolution:150}
close current document saving no
end tell
end repeat
end if
end SaveFilesAsPhotoshop
CHAPTER 1: AppleScript Objects Photoshop options 150

Photoshop options
You can supply options when opening a Photoshop file. See the open command in the command
reference for additional details.

Photoshop options object properties


.

Property Value type What it is


best type type class Read-only. The best type for the object’s value.
class type class Read-only. The object’s class.
container specifier Read-only. The object
default type type class Read-only. The default type for the object’s value.
layer comp Unicode text The name of the layer comp to use when the document is
converted.
preserve hidden boolean If true, preserve hidden layers when the document is
layers converted. Default: false.
preserve image boolean If true, image maps should be preserved when the document
maps is converted. Default: true
preserve layers boolean If true, layers should be preserved when the document is
converted. Default: true
preserve slices boolean If true, slices should be preserved when the document is
converted. Default: true
properties record All properties of this object returned as a record.

Open a Photoshop file


-- This function opens the passed in Photoshop file with
-- open options to preserve layers and correct aspect ratio
-- set to false, fileToOpen is the file reference and needs
-- to be set up before calling this function
on PhotoshopFileOptions(fileToOpen)
tell application "Adobe Illustrator"
set user interaction level to never interact
activate
set photoshopOptions to {class:Photoshop options, preserve layers:true,
artboardRowsOrCols:false}
set IllustratorPreferences to {class:Illustrator preferences, Photoshop file
options:photoshopOptions}
open POSIX file fileToOpen as alias without dialogs
end tell
end PhotoshopFileOptions
CHAPTER 1: AppleScript Objects placed item, placed items 151

placed item, placed items


An artwork item placed in a document as a linked file. Users can place files with the File > Place command
in Illustrator. Placed items can be created in a script using the technique illustrated in the following
example.

placed item object properties


This class inherits all properties from the page item class.
.

Property Value type What it is


bounding rectangle Read-only. Dimensions of placed item regardless of transformations.
box

content anything The content variable to which this placed item is bound.
variable
It is not necessary to set the type of the content variable before
binding. Illustrator automatically sets the type to image.
file path file specification The file containing the placed artwork.
matrix matrix The transformation matrix applied to the placed item.
properties record All properties of this object returned as a record.

placed item object commands


count
delete
duplicate
embed
exists
make
move
relink
rotate
scale
trace placed
transform
translate

Place a file in a document


-- This function adds a new placed item to a document from a file reference,
-- fileToPlace, which is passed in during the function call, fileToPlace is an
-- alias or file reference to an art file, which must be set up before calling this
-- function, itemPosition is a fixed point at which to position the placed item
on PlacedItemCreate(fileToPlace)
tell application "Adobe Illustrator"
set itemPosition to {100.0, 200.0}
set placedRef to make new placed item in document 1 ¬
with properties {file path:fileToPlace, position:itemPosition}
end tell
end PlacedItemCreate
CHAPTER 1: AppleScript Objects plugin item, plugin items 152

plugin item, plugin items


An art item or objects created by an Illustrator plug-in. Scripts cannot create plug-in items, but can
duplicate, copy, and paste them.

plugin item object properties


This class inherits all properties from the page item class.

Property Value type What it is


properties record All properties of this object returned as a record.
is tracing boolean Read-only. If true, this plugin group was created by tracing a raster
art item.
tracing tracingobject Read-only. If this object was created by tracing a raster art item, the
tracingobject that associates the resulting vector art with tracing
options. Use the expand tracing and release tracing commands with
this object to convert this plugin group to a group item, or to revert
to the original raster art.

plugin item object commands


count
delete
duplicate
exists
move
rotate
scale
transform
translate
CHAPTER 1: AppleScript Objects PNG8 export options 153

PNG8 export options


Options that can be supplied when exporting a document as a PNG file with 8-bit color. See the export
command for additional details.

This class contains properties that specify options when exporting a document as a PNG8 file.
PNG8 export options can only be supplied in conjunction with the export command. It is not possible to
get or create a PNG8 export options object.

PNG8 export options object properties

Property Value type What it is


antialiasing boolean If true, the resulting image should be anti-aliased.
Default: true
artboard clipping boolean If true, the resulting image should be clipped to the
artboard. Default: false
color count integer The number of colors in the exported color table. This
value can range from 2 to 256. The default value is 128 if
the property is not set explicitly.
color dither Valid values: The method used to dither colors. Default: diffusion
diffusion
pattern dither
noise
none

color reduction Valid values: The method used to reduce the number of colors in the
selective document. Default: selective
adaptive
perceptual
web

dither percent integer How much should the colors be dithered as a percentage.
Range: 0 to 100. Default: 88
horizontal real The percentage horizontal scaling factor to apply to the
scaling resulting image. Range: 0.0 to 100.0 Default: 100.0
interlaced boolean If true, the resulting image be should be interlaced.
Default: false
matte boolean If true, the artboard should be matted with a color.
Default: true
matte color RGB color info The color to use when matting the artboard.
Default: white
saving as HTML boolean If true, the resulting image should be saved with an
accompanying HTML file. Default: false
transparency boolean If true, the resulting image should use transparency.
Default: true
CHAPTER 1: AppleScript Objects PNG8 export options 154

Property Value type What it is


vertical scaling real The percentage vertical scaling factor to apply to the
resulting image. Range: 0.0 to 100.0. Default: 100.0
web snap integer How much should the color table be changed to match the
web pallet as a percentage. Range: 0 to 100. Default: 0

Export to PNG8

This handler saves all files in a folder as 8-bit PNG files in HTML format with dithering and interlacing. The
class property is specified in the record to ensure that Illustrator can determine the save option class.

-- Opens files from a predefined source folder in Illustrator


-- then exports them to a predefined destination folder in the chosen format
-- fileList is a list of file names in the source folder
-- filePath is the full path to the source folder
-- destFolder is an alias to a folder where the files are to be saved

on SaveFilesAsPNG8HTML(fileList, filePath, destFolder)


set destPath to destFolder as string
set fileCount to count of fileList
if fileCount > 0 then
repeat with i from 1 to fileCount
set fileName to item i of fileList
set fullPath to filePath & fileName
set newFilePath to destPath & fileName & ".png"
tell application "Adobe Illustrator"
open POSIX file fullPath as alias without dialogs
export current document to file newFilePath as PNG8 ¬
with options {class:PNG8 export options ¬
, color count:64 ¬
, color reduction:web ¬
, color dither:pattern dither ¬
, dither percent:50 ¬
, interlaced:true}
close current document saving no
end tell
end repeat
end if
end SaveFilesAsPNG8HTML
CHAPTER 1: AppleScript Objects PNG24 export options 155

PNG24 export options


Options that can be supplied when exporting a document as a PNG file with 24-bit color. See the export
command for additional details.

This class contains properties that specify options to be used when exporting a document as a PNG24 file.
PNG24 export options can only be supplied in conjunction with the export command. It is not possible
to get or create a PNG24 export options object.

PNG24 export options object properties

Property Value type What it is


antialiasing boolean If true, the resulting image should be anti-aliased. Default: true
artboard clipping boolean If true, the resulting image should be clipped to the artboard.
Default: false
horizontal real The percent horizontal scaling factor to apply to the resulting
scaling image. Range: 0.0 to 100.0. Default: 100.0
matte boolean If true, the artboard should be matted with a color. Default: true
matte color RGB color The color to use when matting the artboard.
info Default: {255.0, 255.0, 255.0}
saving as HTML boolean If true, the resulting image be saved with an accompanying
HTML file. Default: false
transparency boolean If true, the resulting image should use transparency.
Default: true
vertical scaling real The percentage vertical scaling factor to apply to the resulting
image. Range: 0.0 to 100.0. Default: 100.0
CHAPTER 1: AppleScript Objects PNG24 export options 156

Exporting to PNG24

This handler saves all files in a folder as 24-bit PNG files in HTML format scaled to 50%. Note that the class
property is specified in the record to ensure that Illustrator can determine the save option class.
-- Opens files from a predefined source folder in Illustrator
-- then exports them to a predefined destination folder in the chosen format
-- fileList is a list of file names in the source folder
-- filePath is the full path to the source folder
-- destFolder is an alias to a folder where the files are to be saved

on SaveFilesAsPNG24(fileList, filePath, destFolder)


set destPath to destFolder as string
set fileCount to count of fileList
if fileCount > 0 then
repeat with i from 1 to fileCount
set fileName to item i of fileList
set fullPath to filePath & fileName
set newFilePath to destPath & fileName & ".png"
tell application "Adobe Illustrator"
open POSIX file fullPath as alias without dialogs
export current document to file newFilePath as PNG24 ¬
with options {class:PNG24 export options ¬
, horizontal scaling:50.0 ¬
, vertical scaling:50.0 ¬
, saving as HTML:false}
close current document saving no
end tell
end repeat
end if
end SaveFilesAsPNG24
CHAPTER 1: AppleScript Objects polygon 157

polygon
A class used to create a multi-sided path item in an Illustrator document. This object is available only in the
context of a make command, which creates an instance of the path item class. This special class allows you
to quickly create complex path items using the properties provided. Properties usually associated with
path items, such as fill color, can also be specified at the time of creation.

If you do not specify any properties when making a new polygon, default values are used.

polygon object properties

Property Value type What it is


center point fixed point Write-once. The center point for the polygon. Default: {200.0, 300.0}
radius real Write-once. The radius of the polygon’s points. Default: 50.0
reversed boolean Write-once. If true, the polygon path is reversed. Default: false
sides integer Write-once. The number of sides for the polygon. Default: 8
(unsigned)

polygon object commands


make

Create a polygon
-- Make an octagon in document 1
tell application "Adobe Illustrator"
set pathRef to make new polygon in document 1 with properties ¬
{center point:{200.0, 200.0}, radius:40.0, sides:8}
end tell
CHAPTER 1: AppleScript Objects postscript options 158

postscript options
Specifies the options for printing to a PostScript language printer or image setter when printing a
document with the print command.

postscript options object properties

Property Value type What it is


binary printing boolean If true, job is to be printed in binary mode. Default: false
compatible shading boolean If true, use PostScript language level 1 compatible
gradient and gradient mesh printing. Default: false
force continuous tone boolean If true, force continuous tone. Default: false
image compression Valid values: The image compression type. Default: none
JPEG
none
RLE

negative printing boolean If true, print in negative mode. Default: false


PostScript Valid values: The PostScript language level. Default: level 2
level 1
level 2
level 3

shading resolution real The shading resolution in dots per inch.


Range: 1.0 to 9600.0;.Default: 300.0
CHAPTER 1: AppleScript Objects PPD file 159

PPD file
Associates properties with a PPD file to be used in printing to a PostScript language printer or image setter.
The properties are not available unless a document is open.

PPD file object properties

Property Value type What it is


name Unicode text The PPD model name.
properties PPD properties The PPD file information.

Save to PPD
-- Make a new document
-- Get the PPDs
-- Get the name, PS Level, and file path of the first PPD
-- Make a new text frame with the PPD info as its contents
tell application "Adobe Illustrator"
activate
make new document
set PPDFiles to PPDs
set PPDName to name of item 1 of PPDFiles
set PPDProperties to get properties of item 1 of PPDFiles
set PPDLevel to language level of PPDProperties
set PPDPath to file path of PPDProperties
set textContents to PPDName & return & "PostScript Level " & PPDLevel & return & "PPD
Path: " & PPDPath as string
make new text frame in document 1 with properties {contents:textContents,
position:{20, 600}}
end tell
CHAPTER 1: AppleScript Objects PPD properties 160

PPD properties
Specifies information about a PPD file.

PPD properties object properties

Property Value type What it is


file path File object Path specification for the PPD file.
language level Unicode text The PostScript language level.
screens list of separation screen List of color separation screens.
spot functions list of screen spot function List of color separation screen spot functions.

Using PPD information


-- Make a new document
-- Get the PPD files
-- Get name, PS Level, screens, screen spot functions, and file path of first PPD
-- For each screen, get the name, angle, and frequency
-- For each spot function, get the name and the function
-- Make a new text frame with the PPD info as its contents
tell application "Adobe Illustrator"
activate
make new document
set PPDFiles to PPDs
set PPDName to name of item 1 of PPDFiles
set PPDProperties to get properties of item 1 of PPDFiles
set PPDLevel to language level of PPDProperties
set PPDPath to file path of PPDProperties
set PPDScreens to screens of PPDProperties
set screensText to "Screens" & return
repeat with PPDScreen in PPDScreens
set PPDScreenName to name of PPDScreen
set PPDScreenAngle to angle of properties of PPDScreen
set PPFScreenFrequency to frequency of properties of PPDScreen
set screensText to screensText & tab & PPDScreenName & ¬
" - Angle: " & PPDScreenAngle & ", Frequency: " & PPFScreenFrequency ¬
& return as string
end repeat
set PPDSpotFunctions to spot functions of PPDProperties
set PPDSpotFunctionText to "Spot Functions" & return
repeat with PPDSpotFunction in PPDSpotFunctions
set PPDSpotFunctionName to name of PPDSpotFunction
set PPDSpotFunctionTX to spot function of PPDSpotFunction
set PPDSpotFunctionText to PPDSpotFunctionText & tab ¬
& PPDSpotFunctionName & ": " & PPDSpotFunctionTX ¬
& return as string
end repeat
set textContents to PPDName & return & ¬
"PostScript Level " & PPDLevel & return & "PPD Path: " & PPDPath & return &
return ¬
& screensText & return & return & PPDSpotFunctionText as string
make new text frame in document 1 ¬
CHAPTER 1: AppleScript Objects PPD properties 161

with properties {contents:textContents, position:{20, 700}}


end tell
CHAPTER 1: AppleScript Objects print options 162

print options
Collects all print options when printing a document with the print command.

print options object properties

Property Value type What it is


color management color management The printing color management options.
settings options

color separation color separation The printing color separation options.


settings options

coordinate settings coordinate The printing coordinate options.


options

flattener preset Unicode text The transparency flattener preset name.


flattener settings ExportForScreens The printing flattener options.
font settings font options The printing font options.
job settings job options The printing job options.
page marks settings page marks The printing page marks options.
options

paper settings paper options The paper options.


postscript settings postscript The printing PostScript options.
options

PPD name Unicode text The name of the PPD file.


print preset Unicode text The name of the printer preset to use.
printer name Unicode text The printer name.
CHAPTER 1: AppleScript Objects print options 163

Print with options


-- Make new document. add symbol items
-- Set job options, color management options, coordinate options, flattening options
-- Print the document using these options
tell application "Adobe Illustrator"
activate
make new document
repeat with i from 1 to (count of symbols in document 1)
round (i / 2 - (round (i / 2) rounding down)) rounding up
make new symbol item in document 1 with properties ¬
{symbol:symbol i of document 1, position:{100 + (the result * 150), (50 + i *
70)}} ¬

end repeat
set jobOptions to {class:job options, designation:all layers, reverse pages:true} ¬

set colorOptions to {class:color management options, name:"ColorMatch RGB",


intent:saturation} ¬

set coordinateOptions to {class:coordinate options, fit to page:true}


set flatteningOptions to ¬
{class:flattening options, clip complex regions:true, gradient resolution:60,
rasterization resolution:60} ¬

set printOptions to ¬
¬
{class:print options, job settings:jobOptions, color management
settings:colorOptions, coordinate settings:coordinateOptions, flattener
settings:flatteningOptions} ¬

print document 1 options printOptions


end tell
CHAPTER 1: AppleScript Objects printer 164

printer
Associates an installed printer with a printer configuration object.

printer object properties

Property Value type What it is


name Unicode text The printer name.
properties printer properties The printer information.

Listing printers
-- Make a new documet
-- Get the name of every printer
-- Display the list of names
tell application "Adobe Illustrator"
set printerList to ""
activate
make new document
set textRef to make new text frame in current document
if printers is not {} then
name of every item of printers as list
repeat with theName in the result
set printerList to printerList & theName & return
end repeat
set theText to printerList
set position of textRef to {200, 600}
else
set theText to "No installed printers"
end if
set contents of textRef to theText
end tell
CHAPTER 1: AppleScript Objects printer properties 165

printer properties
Specifies configuration information for a printer.

printer properties object properties

Property Value type What it is


binary printing boolean If true, the printer supports binary
printing.
color support Valid values: The printer’s color capability.
black and white output
color output
grayscale output

custom paper sizes boolean If true, the printer supports custom paper
sizes.
custom paper boolean If true, the printer supports custom paper
transverse transverse.
default resolution real The printer’s default resolution.
Minimum: 0.0
InRIP separation boolean If true, the printer supports InRIP color
support separation.
maximum height offset real The custom paper’s maximum height
offset.
maximum paper height real Custom paper’s maximum height.
maximum paper width real Custom paper’s maximum width.
maximum resolution real The printer’s maximum device resolution.
Minimum: 0.0
maximum width offset real Custom paper’s maximum width offset.
minimum height offset real Custom paper’s minimum height offset.
minimum paper height real Custom paper’s minimum height.
minimum paper width real Custom paper’s minimum width.
minimum width offset real Custom paper’s minimum width offset.
paper sizes list of paper A list of supported paper sizes.
CHAPTER 1: AppleScript Objects printer properties 166

Property Value type What it is


PostScript Valid values: The PostScript language level.
level 1
level 2
level 3

printer type Valid values: The type of printer.


non PostScript printer
PostScript printer
unknown
CHAPTER 1: AppleScript Objects radial repeat config 167

radial repeat config


Specifies radial repeat art configuration options

radial repeat object properties

Property Value type What it is

number of integer number of instances of radial repeat art.


instances
Default value: 8
reverse boolean Reverse overlap of radial repeat art.
overlap
Default value: false
CHAPTER 1: AppleScript Objects radial repeat item, radial repeat items 168

radial repeat item, radial repeat items


Specifies radial repeat item options.

radial repeat item object properties

Property Value type What it is


properties record All of this object's properties returned in a single
record.
radial config radial repeat Read-only. Radial repeat configuration for repeat
config
art.

radial repeat object commands


set radial configuration
CHAPTER 1: AppleScript Objects radial repeat, aeadd 169

radial repeat, aeadd


Creates a radial repeat art.

radial repeat item object properties

Property Value type What it is


source art any The page item(s) to apply to
config (radial repeat the radial repeat configuration.
config)

radial repeat object commands


set radial configuration
CHAPTER 1: AppleScript Objects raster effect options 170

raster effect options


Specifies raster effects settings for the document. All properties are optional.

raster effect options object properties

Property Value type What it is


antialiasing boolean If true, the image is antialiased.
Default: false
clipping mask boolean If true, a clipping mask is created for the
image. Default: false
color model Valid values: The color model for the rasterization.
default rasterization Default: default rasterization
grayscale rasterization
bitmap rasterization

convert spot colors boolean If true, all spot colors are converted to
process colors for the image. Default: false
padding real The amount of white space (in points) added
around the object during rasterization.
Default: .0
resolution real The resolution in dots per inch (dpi).
Range: 72.0 to 2400.0. Default: 300.0
transparency boolean If true, the image uses transparancy.
Default: false
CHAPTER 1: AppleScript Objects raster item, raster items 171

raster item, raster items


A bitmap art item or list of objects. You can create raster items from a script if you use an external file.
You can also create new raster items by duplicating or copying and pasting an existing raster item.

raster item object properties


This class inherits all properties from the page item class.

Property Value type What it is


bits per integer Read-only. The number of bits per channel.
channel

bounding box rect The dimensions of the raster item regardless of


transformations.
channels integer Read-only. The number of channels.
color space Valid values: Read-only. The color space of the raster item.
Gray
RGB
CMYK

colorants list of Unicode text Read-only. The colorant used in the raster art.
colorized boolean Read-only. If true, the raster art is a colorized grayscale image.
content anything The contents of the variable to which this raster item is bound. It
variable is not necessary to set the type of the content variable
before binding. Illustrator automatically sets the type to image.
embedded boolean If true, the raster item is embedded within the illustration.
file path file specification Read-only. The file containing the raster item, if it is stored
externally.
matrix matrix The transformation matrix of the raster art item.
overprint boolean If true, the raster art is overprinting.
properties record All properties of this object returned as a record.
status Valid values: Read-only. The status of the linked image, if the image is stored
no data externally.
data from file
modified data

transparent boolean If true, the raster art is transparent.


CHAPTER 1: AppleScript Objects raster item, raster items 172

raster item object commands


count
delete
duplicate
exists
move
rotate
scale
trace raster
transform
translate

Create a raster item


-- This handler accepts filePath as the path to a new
-- raster item and embeds the item in to a new document
on rasterItemCreate(filePath)
tell application "Adobe Illustrator"
set myDoc to make new document
set myPosition to {0.0, height of myDoc}
set myPlacedItem to make new placed item in myDoc with properties ¬
{file path:filePath, position:myPosition}
embed myPlacedItem
end tell
end rasterItemCreate
CHAPTER 1: AppleScript Objects rasterize options 173

rasterize options
Specifies options that may be supplied when rasterizing artwork. All properties are optional.

rasterize options object properties

Property Value type What it is


antialiasing method Valid values: The type of antialiasing method.
none Default: art optimized
art optimized
type optimized

background black boolesn If true, the rasterization is done against a


black background (intead of white).
Default: false
clipping mask boolean If true, a clipping mask is created for the
image. Default: false
color model Valid values: The color model for the rasterization.
default rasterization Default: default rasterization
grayscale rasterization
bitmap rasterization

convert spot colors boolean If true, spot colors are converted to process
colors for the image. Default: false
convert text to boolean If true, all text is converted to outlines before
outlines rasterization. Default: false
include layers boolean If true, the resulting image incorporates
layer attributes (like opacity and blend
mode). Default: false
padding real The amount of white space (in points) added
around the object during rasterization.
Default: .0
resolution real The rasterization resolution in dots per inch
(dpi). Range: 72.0 to 2400.0. Default: 300.0
transparency boolean If true, the image uses transparency.
Default: false
CHAPTER 1: AppleScript Objects rectangle 174

rectangle
A class used to create a rectangular path in an Illustrator document. This object is available only in the
context of a make command, which creates an instance of the path item class. This special class allows you
to quickly create complex path items. Properties associated with path items, such as fill color and
note, can also be specified at the time of creation.

A rectangle is stored as a list of four real numbers, where the first item is the leftmost horizontal coordinate
of the rectangle, the second item is the top vertical coordinate of the rectangle, the third item is the
rightmost horizontal coordinate, and the fourth item is the bottom vertical coordinate of the rectangle.

In the Illustrator coordinate system, vertical coordinates increase from bottom to top, which is the
opposite of screen coordinates. This mean that the top coordinate value in a rectangle is larger than the
bottom coordinate value.

rectangle object properties

Property Value type What it is


bounds list Write-once. The bounds of the rectangle. Default: {100.0, 200.0, 175.0, 100.0}
reversed boolean Write-once. If true, the path is reversed. Default: false

rectangle object commands


make

Creating a rectangle
-- Make a square in document 1
tell application "Adobe Illustrator"
make new document
set pathRef to make new rectangle at beginning of document 1 ¬
with properties {bounds:{50.0, 200.0, 200.0, 50.0}, note:"square"}
end tell
CHAPTER 1: AppleScript Objects rectangle 175

Using rectangle values

The values in a rectangle can be used in a number of ways in a script.


tell application "Adobe Illustrator"
-- Get the bounds of a page item
set itemBounds to geometric bounds of page item 1 of document 1
--> for example: {100.0, 400.0, 300.0, 200.0}
-- Assigns the four values in a rectangle point to four variables
set {leftBound, topBound, rightBound, bottomBound} to itemBounds
-- or assign to four variables directly
set {leftBound, topBound, rightBound, bottomBound} to geometric bounds of page item
1 of document 1

-- Calculate center of page item from its bounds


set xCenter to ((item 1 of itemBounds) + (item 3 of itemBounds)) / 2
set yCenter to ((item 2 of itemBounds) + (item 4 of itemBounds)) / 2
--> example: xCenter = 200.0, yCenter = 300.0

-- or calculate the center using the individual coordinate variables


set xCenter to (leftBound + rightBound) / 2
set yCenter to (topBound + bottomBound) / 2

-- Change the left value in a fixed rectangle


set item 1 of itemBounds to (item 1 of itemBounds) + 100.0
--> example: {200.0, 400.0, 300.0, 200.0}
end tell
CHAPTER 1: AppleScript Objects RGB color info 176

RGB color info


An RGB color specification, used to specify a RGB color where a color info object is required.

If the color space of a document is CMYK and you specify the color value for a page item in that document
using RGB color info, Illustrator will translate the RGB color specification into a CMYK color specification.
The same thing happens if the document’s color space is RGB and you specify colors using
CMYK color info. Since this translation can cause information loss you should specify colors using the
color info class that matches the document’s color space.

RGB color info object properties


This class inherits all properties from the color info class.

Property Value type What it is


red real The red color value. Range: 0.0 to 255.0. Default: 0.0
green real The green color value. Range: 0.0 to 255.0. Default: 0.0
blue real The blue color value. Range: 0.0 to 255.0. Default: 0.0

Set the default stroke color to an RGB color


-- Set the default stroke color of document 1 to yellow
tell application "Adobe Illustrator"
set default stroke color of document 1 to {red:255, green:255, blue:0}
end tell
CHAPTER 1: AppleScript Objects rounded rectangle 177

rounded rectangle
A class used to create a rectangular path with rounded corners in an Illustrator document. This object is
available only in the context of a make command, which creates an instance of the path item class. This
special class allows you to quickly create complex path items. Properties associated with path items, such
as fill color and note, can also be specified at the time of creation.

If you do not specify any properties when making a new rounded rectangle, default values are used.

rounded rectangle object properties

Property Value type What it is


bounds rect Write-once. The bounds of the rectangle to create. Default: {100.0,
100.0, 150.0, 200.0}
horizontal radius real Write-once.The horizontal radius of the rectangle’s rounded
corners. Default: 15.0
reversed boolean Write-once.If true, the rectangle path is reversed. Default: false
vertical radius real Write-once. The vertical radius of the rectangle’s rounded corners.
Default: 20.0

rounded rectangle object commands


make

Create a rounded rectangle


-- Make a rounded rectangle
tell application "Adobe Illustrator"
make new document
set pathRef to make new rounded rectangle in document 1 with properties ¬
{bounds:{50.0, 200.0, 200.0, 50.0}, horizontal radius:20.0, vertical
radius:25.0}
end tell
CHAPTER 1: AppleScript Objects screen properties 178

screen properties
Contains screen information.

screen properties object properties

Property Value type What it is


angle real The screen’s angle in degrees.
default screen boolean If true, it is the default screen.
frequency real The screen’s frequency.

Get screen properties


-- PPD Screens
-- Make a new document, get the PPDs
-- Get the name, and screens of the first PPD
-- For each screen, get the name, angle, and frequency
-- Display the results of the PPD info in a text frame

tell application "Adobe Illustrator"


activate
make new document
set PPDFiles to PPDs
set PPDName to name of item 1 of PPDFiles
set PPDProperties to get properties of item 1 of PPDFiles
set PPDScreens to screens of PPDProperties
set screensText to "Screens" & return
repeat with PPDScreen in PPDScreens
set PPDScreenName to name of PPDScreen
set PPDScreenAngle to angle of properties of PPDScreen
set PPFScreenFrequency to frequency of properties of PPDScreen
set screensText to screensText & tab & PPDScreenName & Â
" - Angle: " & PPDScreenAngle & ", Frequency: " & PPFScreenFrequency Â
& return as string
end repeat
set textContents to PPDName & return & screensText
make new text frame in document 1 Â
with properties {contents:textContents, position:{20, 600}}
end tell
CHAPTER 1: AppleScript Objects screen spot function 179

screen spot function


Information about the color separation screen spot function.

screen spot function object properties

Property Value type What it is


name Unicode text The color separation screen spot function name.
spot function Unicode text The spot function in terms of the PostScript commands.

Get screen spot function information


-- PPD Screen Spot Functions
-- Make a new document, get the PPDs
-- Get the name, and spot functions of the first PPD
-- For each spot function, get the name and the function
-- Display the results of the PPD info in a text frame

tell application "Adobe Illustrator"


activate
make new document
set PPDFiles to PPDs
set PPDName to name of item 1 of PPDFiles
set PPDProperties to get properties of item 1 of PPDFiles
set PPDSpotFunctions to spot functions of PPDProperties
set PPDSpotFunctionText to "Spot Functions" & return
repeat with PPDSpotFunction in PPDSpotFunctions
set PPDSpotFunctionName to name of PPDSpotFunction
set PPDSpotFunctionTX to spot function of PPDSpotFunction
set PPDSpotFunctionText to PPDSpotFunctionText & tab ¬
& PPDSpotFunctionName & ": " & PPDSpotFunctionTX ¬
& return as string
end repeat
set textContents to PPDName & return & PPDSpotFunctionText
make new text frame in document 1 ¬
with properties {contents:textContents, position:{20, 600}}
end tell
CHAPTER 1: AppleScript Objects separation screen 180

separation screen
Represents a color-separation screen.

separation screen object properties

Property Value type What it is


name Unicode text The color-separation screen name.
properties screen properties The color-separation screen information.
CHAPTER 1: AppleScript Objects spot, spots 181

spot, spots
A custom color definition, or list of definitions, contained in a document.

If no properties are specified when creating a new spot, default properties will be provided. If specifying
the color, however, you must use the same color space as the document, either CMYK or RGB; otherwise,
an error will result. When created, the spot is added to the end of the swatches list in the Swatches palette.

spot object properties

Property Value type What it is


best type type class Read-only. The best type for the spot object. Always returns
reference.

class type class Read-only. The object’s class, which is spot.


color spot color info The color information for this spot color.
color type Valid values: The color model for the spot color.
process color
registration color
spot color

container object reference Read-only. A reference to the document that contains this
spot color.
default type type class Read-only. Default type for the spot. Always returns
reference.

index integer Read-only. The position of this spot in the document.


name Unicode text The spot color’s unique name.
properties record All properties of this object returned as a record.
spot kind Valid values: Read-only. The kind of spot color (RGB, CMYK, or LAB). This
spot cmyk color is the name of the color kind contained in the spot object.
spot rgb color
spot lab color

spot object commands


count
delete
duplicate
exists
get internal color
make
CHAPTER 1: AppleScript Objects spot, spots 182

Create a spot color


-- Make a new spot with name and color properties
tell application "Adobe Illustrator"
set spotColorCount to count of spots in document 1
-- set up the appropriate color record for the document color space
set docColorSpace to color space of document 1
if (docColorSpace is CMYK) then
set newSpotColor to ¬
{cyan:25.0, magenta:75.0, yellow:0.0, black:0.0}
else
set newSpotColor to {red:255.0, green:0.0, blue:25.0}
end if
-- now create the new spot
make new spot in document 1 with properties ¬
{name:"My Spot", color:newSpotColor}
end tell
CHAPTER 1: AppleScript Objects spot color info 183

spot color info


A spot color specification, used to specify a spot color in the spot object’s color property.

spot color info object properties


This class inherits all properties from the color info class.

Property Value type What it is


spot object reference A reference to the spot object which defines the color. Must be set to
a reference to an existing spot color definition
tint real The tint of the color. Range: 0.0 to 100.0. Default: 100.0

Setting the default stroke color to a spot color


-- Make a new spot color and apply a 50% tint to the default stroke color
tell application "Adobe Illustrator"
-- create a document with RGB color space
make new document with properties {color space:RGB}
set spotColorCount to count of spots in document 1
set newSpot to make new spot in document 1 with properties ¬
{name:"Big Blue", color:{red:0.0, green:0.0, blue:255.0}}
set default stroke color of document 1 to {spot:newSpot, tint:50.0}
end tell
CHAPTER 1: AppleScript Objects star 184

star
A class used to create a star-shaped path in an Illustrator document. This object is available only in the
context of a make command, which creates an instance of the path item class. This special class allows you
to quickly create complex path items. Properties associated with path items, such as fill color and
note, can also be specified at the time of creation.

star object properties

Property Value type What it is


center point fixed point Write-once. The center point of the star. Default: {200.0, 300.0}
inner radius real Write-once. The inner radius of the star. Default: 20.0
point count integer Write-once. The number of points on the star. Default: 5
radius real Write-once. The radius of the star’s points. Default: 50.0
reversed boolean Write-once. If true, the star path is reversed. Default: false

star object commands


make

Create a star
-- Make a 16-pointed star
tell application "Adobe Illustrator"
make new star in document 1 with properties ¬
{center point:{200.0, 500.0}, inner radius:70, radius:100, point count:16} ¬

end tell
CHAPTER 1: AppleScript Objects story, stories 185

story, stories
A contiguous block of text. A story can contain one or more text frames; if more—the multiple text frames
are threaded to form a single story.

story object elements

Elements Refer to by
character numeric index, range of elements, before/after another element, satisfying a test
insertion point numeric index, range of elements, before/after another element, satisfying a test

line numeric index, range of elements, before/after another element, satisfying a test
paragraph numeric index, range of elements, before/after another element, satisfying a test
text numeric index, range of elements, before/after another element, satisfying a test
text frame name, numeric index, range of elements, before/after another element, satisfying a
test
word numeric index, range of elements, before/after another element, satisfying a test

story object properties

Property Value type What it is


best type type class Read-only. The best type for the object’s value.
class type class Read-only. The object’s class.
container reference Read-only. The object’s container.
default type type class Read-only. The default type for the object’s value.
index integer Read-only. The index of this instance of the object.
length integer Read-only. The number of characters in the story. Minimum: 0
properties record All properties of this object returned as a record.
selection list of text Read-only. The selected text.
text range text Read-only. The text in the story.
CHAPTER 1: AppleScript Objects story, stories 186

Using stories
-- Story
-- Make a new document and two text frames
-- Set the previous frame of the second text frame to text frame 1
-- Add a story to text frame 1, long enough to overflow to text frame 2
-- Count the number of stories
-- Add a new text frame
-- Count the number of stories

tell application "Adobe Illustrator"


activate
make new document
make new rectangle in document 1 with properties {position:{200, 600}, height:30,
width:50}
make new text frame in document 1 with properties {name:"Text1", kind:area text,
text path:the result}
make new rectangle in document 1 with properties {position:{300, 550}, height:200,
width:50}
make new text frame in document 1 with properties {name:"Text2", kind:area text,
text path:the result}
set previous frame of text frame "Text2" of document 1 to text frame "Text1" of
document 1
set the contents of text frame "Text1" of document 1 to "This is two text frames
linked together as one story"
make new rectangle in document 1 with properties {position:{200, 300}, height:30,
width:150}
make new text frame in document 1 with properties {name:"Text3", kind:area text,
text path:the result}
set the contents of text frame "Text3" of document 1 to "Each unlinked textFrame
adds a new story"
end tell
CHAPTER 1: AppleScript Objects SVG export options 187

SVG export options


Options that can be supplied when exporting a document as an SVG file. See the export command in the
command reference for additional details.

This class is used to define a record containing properties that specify options when exporting a document
as a SVG file. SVG export options can only be supplied in conjunction with the export command. It is not
possible to get or create an SVG export options object.

SVG export options object properties

Property Value type What it is


artboard range string If save multiple artboards is true, this is
considered for multi-asset extraction, which
specifies the artboard range. An empty
string extracts all the artboards.
Default: empty string
compressed boolean If true, the exported file should be
compressed. Default: false
coordinate integer The decimal precision for element
precision coordinate values. Range: 1 to 7 Default: 3
CSS properties Valid values: How should the CCS properties of the
entities document be included in the exported file.
style attributes Default: style attributes
style elements
presentation attributes

document encoding Valid values: How the text should be encoded in the
ASCII document. Default: ASCII
UTF8
UTF16

DTD Valid values: The DTD version to which the exported file
SVG 1.0 conforms. Default: SVG 1.1
SVG 1.1
SVG Basic 1.1
SVG Tiny 1.1
SVG Tiny 1.1 Plus

embed auto kerning boolean If true, SVG automatic kerning is allowed


for the file. Default: false
embed raster images boolean If true, the raster images used in the
document should be included in the
exported file. Default: false
embed text on path boolean If true, the SVG text-on-path construct is
allowed for the file. Default: false
CHAPTER 1: AppleScript Objects SVG export options 188

Property Value type What it is


font subsetting Valid values: Specifies which font glyphs should be
none included in the exported file. Default: all
all glyphs glyphs
glyphs used
common english
glyphs used plus english
common roman
glyphs used plus roman

font type Valid values: The type of font to be included in the


CEF font exported file.
outline font
SVG font

include file info boolean If true, the XMP metadata should be


included in the exported file. Default: false
include unused boolean If true, unused styles should be included in
styles the exported file. Default: false
include variables boolean If true, variables and datasets should be
and datasets included. Default: false
optimize for SVG boolean If true, the Adobe namespace should be
Viewer included. Default: false
preserve boolean If true, Illustrator editing capabilities
editability should be preserved when exporting the
document. Default: false
save multiple boolean If true, all artboards or range of artboards
artboards are saved. Default: false
slices boolean If true, slice data should be preserved in
exported document. Default: false

Export to SVG

This handler saves all files in a folder as SVG files with linked raster imaged embedded in the exported files.
The class property is specified in the record to ensure that Illustrator can determine the save option class.
-- Opens files from a predefined source folder in Illustrator
-- then exports them to a predefined destination folder in the chosen format
-- fileList is a list of file names in the source folder
-- filePath is the full path to the source folder
-- destFolder is an alias to a folder where the files are to be saved

on SaveFilesAsSVG(fileList, filePath, destFolder)


set destPath to destFolder as string
set fileCount to count of fileList
if fileCount > 0 then
repeat with i from 1 to fileCount
set fileName to item i of fileList
set fullPath to filePath & fileName
set newFilePath to destPath & fileName & ".svg"
tell application "Adobe Illustrator"
CHAPTER 1: AppleScript Objects SVG export options 189

open POSIX file fullPath as alias without dialogs


export current document to file newFilePath as SVG ¬
with options {class:SVG export options ¬
, embed raster images:true}
close current document saving no
end tell
end repeat
end if
end SaveFilesAsSVG
CHAPTER 1: AppleScript Objects swatch, swatches 190

swatch, swatches
A color swatch or list of swatches contained in a document. The swatches correspond to the swatch
palette in the Illustrator user interface. Additional swatches can be created either manually by a user or by
a script. The swatch can hold all types of color data (such as pattern, gradient, CMYK, RGB, gray, or spot).

swatch object properties

Property Value type What it is


best type type class Read-only. The best type for the swatch. Always returns reference.
class type class Read-only. The swatch object’s class, which is swatch.
color color info The color information for this swatch.
container object reference Read-only. A reference to the document that contains this swatch.
default type type class Read-only. The default type for the swatch. Always returns
reference.

index integer Read-only. The position of this swatch in the document.


name Unicode text The unique name of the swatch.
properties record All properties of this object returned as a record.

swatch object commands


count
delete
duplicate
exists
make

Create a swatch
-- Make a new swatch
tell application "Adobe Illustrator"
set swatchCount to count of swatches in document 1
make new swatch in document 1 with properties ¬
{name:"My Swatch", color:{red:175.0, green:50.0, blue:0.0}}
end tell
CHAPTER 1: AppleScript Objects swatchgroup, swatchgroups 191

swatchgroup, swatchgroups
A group of swatches.

swatchgroup object properties

Property Value type What it is


best type type class Read-only. The best type for the swatchgroup object’s value. Always
returns reference.
class type class Read-only. The swatchgroup’s class, which is swatchgroup.
container object reference Read-only. A reference to the object that contains this swatchgroup.
default type type class Read-only. The default type for the swatchgroup.
index integer Read-only. The index of this swatchgroup.
name Unicode text Read-only. The name of the swatchgroup. Defaults to
New swatchgroup nnn, where n is an integer, starting at 1 and
increasing with each newly created swatchgroup.
properties record All properties of this object returned as a record.

swatchgroup object commands


add spot
add swatch
count
delete
duplicate
exists
get all swatches
make
CHAPTER 1: AppleScript Objects symbol, symbols 192

symbol, symbols
A symbol or list of symbols. A symbol is an art item that is stored in the Symbols palette, and can be reused
one or more times in the document without duplicating the art data. Symbols are contained in
documents.

symbol object properties

Property Value type What it is


best type type class Read-only. The best type for the symbol object’s value. Always
returns reference.
class type class Read-only. The symbol’s class, which is symbol.
container specifier Read-only. A reference to the object that contains this symbol.
default type type class Read-only. The default type for the symbol.
index integer Read-only. The index of this symbol.
name Unicode text Read-only. The name of the symbol. Defaults to New Symbol nnn,
where n is an integer, starting at 1 and increasing with each
newly created symbol.
properties record All properties of this object returned as a record.
source art anything Read-only. The source art is only used when creating a new
symbol.

symbol object commands


count
delete
duplicate
exists
make
CHAPTER 1: AppleScript Objects symbol, symbols 193

Using symbols
-- Symbol Items
-- Make a new document
-- Add rectangles, apply different graphic style to each
-- Add delay of at least a second (allow UI to catch up to scripting plug-in)
-- Make a new symbol for each page item, use the page item as the source art

tell application "Adobe Illustrator"


activate
make new document
repeat with i from 1 to (count of graphic styles in document 1)
round (i / 2 - (round (i / 2) rounding down)) rounding up
make new rectangle in document 1 with properties ¬
{position:{100 + (the result * 150), (50 + i * 70)}, height:20, width:20}
apply graphic style (i) of document 1 to the result
end repeat
delay 2
repeat with i from 1 to (count of graphic styles in document 1)
make new symbol in document 1 with properties ¬
{name:("symbol" & i as string), source art:page item i of document 1}
end repeat
end tell
CHAPTER 1: AppleScript Objects symbol item, symbol items 194

symbol item, symbol items


An instance of a symbol in a document. Symbol items are linked to the symbol from which they are
created and change with any modification of that symbol.

symbol item object properties


This class inherits all properties from the page item class.

Property Value type What it is


properties record All properties of this object returned as a record.
symbol symbol The symbol that was used to create this symbol item.

symbol item object commands


count
delete
duplicate
exists
move
rotate
scale
transform
translate

Create symbol items


-- Symbol Items
-- Make a new document, add symbol items from symbols panel

tell application "Adobe Illustrator"


activate
make new document
repeat with i from 1 to (count of symbols in document 1)
round (i / 2 - (round (i / 2) rounding down)) rounding up
make new symbol item in document 1 with properties ¬
{symbol:symbol i of document 1, position:{100 + (the result * 150), (50 + i *
70)}}
end repeat
end tell
CHAPTER 1: AppleScript Objects symmetry repeat config 195

symmetry repeat config


Specifies symmetry repeat art configuration options

symmetry repeat object properties

Property Value type What it is

axis rotation real Symmetry axis rotation angle wrt x-axis in


angle in
radians anti-clockwise fashion.
Default value: 1.57
CHAPTER 1: AppleScript Objects symmetry repeat item, symmetry repeat items 196

symmetry repeat item, symmetry repeat items


Specifies symmetry repeat item options.

symmetry repeat item object properties

Property Value type What it is


properties record All of this object's properties returned in a single
record.
symmetry symmetry Read-only. Symmetry repeat configuration for repeat
config repeat config
art.

symmetry repeat object commands


set symmetry configuration
CHAPTER 1: AppleScript Objects symmetry repeat, aeadd 197

symmetry repeat, aeadd


Creates a symmetry repeat art.

symmetry repeat item object properties

Property Value type What it is


source art any The page item(s) to apply to
config (symmetry the symmetry repeat configuration.
repeat config)
CHAPTER 1: AppleScript Objects tab stop info, tab stops 198

tab stop info, tab stops


Tab stop information for a paragraph. All tab stops in a paragraph can be retrieved and specified using tab
stops, which returns a list of tab stop info records.

tab stop info object properties

Property Value type What it is


alignment Valid values: The alignment of the tab stop. Default: left
left
center
right
decimal

decimal character Unicode text The character to use for decimal tab stops.
leader Unicode text The leader dot.
position real The position of the tab stop expressed in points. Default: 0.0

Get tab stops


-- Return the tab stops of the first paragraph
tell application "Adobe Illustrator"
set allTabs to tab stops of paragraph 1 of text frame 1 of document 1
set docRef to make new document
set textRef to make new text frame in docRef
set sText to "PositionLeader"
repeat with i in allTabs
set curPosition to position of i
set curLeader to leader of i
set sText to sText & return & curPosition & "" & curLeader
end repeat

set contents of textRef to sText


set position of textRef to {100.0, 600.0}
end tell
CHAPTER 1: AppleScript Objects tag, tags 199

tag, tags
A tag or list of tags associated with a specific page item. Tags allows you to assign an unlimited number of
key-value pairs to any page item in a document.

tag object properties

Property Value type What it is


best type type class Read-only. The best type for the tag. Always returns reference.
class type class Read-only. The object’s class, which is tag.
container object Read-only. A reference to the page item that contains this tag.
reference
default type type class Read-only. The default type for the tag. Always returns reference.
index integer Read-only. The index of this tag in the page item.
name Unicode text The tag’s name.
properties record All properties of this object returned as a record.
value Unicode text The data stored in this tag.

tag object commands


count
delete
duplicate
exists
make

Get tags

-- Creates then gets tags for the first page item in the document
tell application "Adobe Illustrator"
make new document
set newItem to make rectangle in document 1 with properties {name:"rectPath"}
set myPosition to position of newItem
set myBoundsString to ((item 1 of myPosition) & "," & (item 2 of myPosition) as
string) & ","
set myBoundsString to myBoundsString & ((width of newItem) & "," & (height of
newItem) as string)
set myTag to (make new tag at newItem)
set name of myTag to "MyNewTag"
set value of myTag to myBoundsString
set URL of newItem to "http://www.adobe.com/"
set tempProp to properties of myTag
set myTagPropName to name of tempProp
end tell
CHAPTER 1: AppleScript Objects text 200

text
Any text in the contents of a text frame. Text can be accessed using the character, insertion point,
word, line, paragraph, and text classes. All text is contained within text frames.

text object elements

Elements Refer to by
character style name, numeric index, range of elements, before/after another element, satisfying a
test
character numeric index, range of elements, before/after another element, satisfying a test
insertion point numeric index, range of elements, before/after another element, satisfying a test
line numeric index, range of elements, before/after another element, satisfying a test
paragraph style name, numeric index, range of elements, before/after another element, satisfying a
test
paragraph numeric index, range of elements, before/after another element, satisfying a test
text numeric index, range of elements, before/after another element, satisfying a test
word numeric index, range of elements, before/after another element, satisfying a test

text object properties

Property Value type What it is


best type type class Read-only. The best type for the object’s value.
character offset integer Offset of the first character.
class type class Read-only. The object’s class.
container reference Read-only. The object’s container.
contents Unicode text The text content.
default type type class Read-only. The default type for the object’s value.
index integer Read-only. The index of this instance of the object.
kerning integer Controls the spacing between two characters, in
thousandths of an em.
length integer The length (in characters). Minimum: 0
properties record All properties of this object returned as a record.
selection list of text Read-only. The selected text.
story story Read-only. The story that contains the text object.
CHAPTER 1: AppleScript Objects text 201

text object commands


apply character style
apply paragraph style
change case
count
delete
deselect
duplicate
exists
make
move
select

Change point size of text


-- Change all 12pt text to 18pt
tell application "Adobe Illustrator"
set textArtItemCount to count text frames of document 1
-- Loop through all the text frames
repeat with itemCount from 1 to textArtItemCount
set textRef to text of text frame itemCount of document 1 ¬
as reference
if (size of textRef = 12) then
set size of textRef to 18
end if
end repeat
end tell
CHAPTER 1: AppleScript Objects text font, text fonts 202

text font, text fonts


An installed font.

text font object properties

Property Value type What it is


best type type class Read-only. The best type for the object’s value. Always returns
reference.

class type class Read-only. The object’s class, which is text font.
default type class Read-only. The default type for the object. Always returns reference.
type

family Unicode text Read-only. The font’s family name.


index integer Read-only. The index of this object in the art item.
name Unicode text The full name of the font.
properties record All properties of this object returned as a record.
style Unicode text Read-only. The font’s style name.
CHAPTER 1: AppleScript Objects text frame, text frames 203

text frame, text frames


The basic art item for displaying text. From the user interface, this is text created with the Text tool. There
are three types of text art in Illustrator: point text, path text, and area text. The type is specified by the text
frame’s kind property.

When you create a text frame, you also create a story object (see story, stories); however, threading text
frames combines the frames into a single story object. To thread frames, use the next frame or previous
frame property.

text frame object elements

Element Refer to by
character index, before/after, range, test
insertion point index, before/after, range, test
line index, before/after, range, test
paragraph index, before/after, range, test
text index, before/after, range
word index, before/after, range, test

text frame object properties


This class inherits all properties from the page item class.

Property Value type What it is


anchor list The position of the anchor point (start of base line for point text).
antialias Valid values: The type of anti-aliasing to use in the text.
crisp
none
sharp
strong

column gutter real The column gutter in the text frame (area text only).
content variable anything The content variable to which this text frame is bound.

It is not necessary to set the type of the content variable


before binding. Illustrator automatically sets the type to be the
same as the page item to which it is bound.
contents Unicode text The textual contents of the text frame, represented as a string.
column count integer The column count in the text frame (area text only).
end T value real The end position of text along a path, as a value relative to the
path’s segments (path text only).
CHAPTER 1: AppleScript Objects text frame, text frames 204

Property Value type What it is


flow links boolean If true, the text flows horizontally first between linked frames.
horizontally

kind Valid values: The type of text frame.


point text
area text
path text

matrix matrix Read-only. The transformation matrix of the text frame.


next frame text frame The linked text frame following this one.
optical boolean If true, the optical alignment is active.
alignment

previous frame text frame The linked text frame preceding this one.
properties record All properties of this object returned as a record.
row count integer The row count in the text frame (area text only).
row gutter real The row gutter in the text frame (area text only).
selection object Read-only. The selected text.
reference
spacing real The amount of spacing.
start T value real The start position of text along a path, as a value relative to the
path

NOTE: Valid only when kind is path text.


story story Read-only. The story to which the text frame belongs.
text orientation Valid values: The orientation of the text in the frame.
horizontal
vertical

text path list of path Read-only. The path item associated with the text frame.
point info
NOTE: Valid only when kind is area text or path text.
text range Unicode text Read-only. The text in the text frame.
CHAPTER 1: AppleScript Objects text frame, text frames 205

text frame object commands


apply character style
apply paragraph style
change case
convert area object to point object
convert point object to area object
convert to paths
count
delete
deselect
duplicate
exists
move
rotate
scale
select
transform
translate

Create and manipulate text frames


-- Text Frames
-- Make a new document, one text frame of each type: Area, Point, and Path
-- Display the count of text frames
-- Change the contents of each text frame
-- Delete the point text frame
-- Display the count of text frames

tell application "Adobe Illustrator"


activate
make new document
make new rectangle in document 1 with properties ¬
{position:{100, 700}, height:100, width:100}
make new text frame in document 1 with properties ¬
{name:"AreaText", kind:area text, text path:the result, contents:"Text Frame 1"}
¬

set pathPoint1 to {class:path point info, anchor:{250, 700}}


set pathPoint2 to {class:path point info, anchor:{350, 550}}
make new path item in document 1 with properties ¬
{entire path:{pathPoint1, pathPoint2}}
make new text frame in document 1 with properties ¬
{name:"PathText", kind:path text, text path:the result, contents:"Text Frame 2"}
¬

make new text frame in document 1 with properties ¬


{name:"PointText", contents:"Text Frame 3"}
set the position of text frame "PointText" of document 1 to {400, 700}
set the contents of text frame "AreaText" of document 1 ¬
to "Area Text is cool"
set the contents of text frame "PathText" of document 1 ¬
to "Path Text is cooler"
set the contents of text frame "PointText" of document 1 ¬
to "Point Text is not"
delay 1
delete text frame "PointText" of document 1
end tell
CHAPTER 1: AppleScript Objects text frame, text frames 206

Scale area text frames


-- Scale all area text frames to 50% wide
tell application "Adobe Illustrator"
set textArtItemCount to count text frames in document 1
set countOTFChanged to 0
repeat with itemCount from 1 to textArtItemCount
set textKind to kind of text frame itemCount of document 1
if (textKind = area text) then
set curwidth to the width of text frame itemCount of document 1
set width of text frame itemCount of document 1 to curwidth / 2
set countOTFChanged to countOTFChanged + 1
end if
end repeat
end tell
CHAPTER 1: AppleScript Objects text path item, text path items 207

text path item, text path items


A path or list of paths for area or path text. A path consists of path points that define its geometry.

text path item object elements

Element Refer to by
path point index, range of elements, before/after another element, satisfying a test

text path item object properties


This object class inherits all properties from the page item class.

Property Value type What it is


area real Read-only. The area of this path in square points. An area
may be negative or even 0. The paths winding order is
determined by the sign of area. If the area is negative, the
path is wound counter-clockwise. Self-intersecting paths
may contain sub-areas that cancel each other out. Therefore,
it is possible for a path’s area to appear as zero even though
it has apparent area.
blend mode Valid values: The mode to use when compositing this object. An object is
color blend considered composited when its opacity is set to less than
color burn 100.0 (100%).
color dodge
darken
difference
exclusion
hard light
hue
lighten
luminosity
multiply
normal
overlay
saturation blend
screen
soft light

clipping boolean If true, use this path as a clipping path.


closed boolean If true, this path closed.
container reference Read-only. A reference to the art item that contains this path.
editable boolean If true, this path can be modified.
entire path list of path point All the path item’s path points.
info

evenodd boolean If true, use the even-odd rule to determine insideness.


CHAPTER 1: AppleScript Objects text path item, text path items 208

Property Value type What it is


fill color color info The fill color of the path.
fill overprint boolean If true, the art beneath a filled object should be overprinted.
filled boolean If true, the path should be filled.
guides boolean If true, this path is a guide object.
height real The height of the path in points. Range: 0.0 to 16348.0
note Unicode text The note text assigned to the path.
opacity real The object’s opacity, expressed as a percentage. Range: 0.0
to 100.0.
polarity Valid values: The polarity of the path, used in the creation of compound
positive paths.
negative

position list The position (in points) of the top left corner of the item in
the format {x, y}. Does not include stroke weight.
resolution real The resolution of the path in dots per inch.
selected path list of object Read-only. All selected path points in the path.
points references
stroke cap Valid values: The type of line capping.
butted
rounded
projecting

stroke color color info The stroke color for the path.
stroke dash real The default distance into the dash pattern at which the
offset pattern should be started
stroke dashes list of real numbers The lengths for dashes and gaps in dashed lines, starting
with the first dash length, followed by the first gap length,
and so on. Set to an empty list, {}, for a solid line.
stroke joi Valid values: Type of join for the path.
mitered
rounded
beveled

stroke miter real When a default stroke join is set to mitered, this property
limit specifies when the join will be converted to beveled
(squared-off ) by default. The default miter limit of 4 means
that when the length of the point reaches four times the
stroke weight, the join switches from a miter join to a bevel
join. Values: 1 to 500. 1 specifies a bevel join.
stroke boolean If true, the art beneath the stroked object should be
overprint overprinted.
stroke width real Width of stroke.
CHAPTER 1: AppleScript Objects text path item, text path items 209

Property Value type What it is


stroked boolean If true, the path should be stroked.
width real The width of the text path in points. Range: 0.0 to 16348.0

text path item object commands


count
delete
duplicate
exists
move
rotate
scale
transform
translate
CHAPTER 1: AppleScript Objects TIFF export options 210

TIFF export options


Options that can be supplied when exporting a document as a TIFF file. See the export command for
additional details.

This class contains properties that specify options to be used when exporting a document as a TIFF file.
TIFF export options can only be supplied in conjunction with the export command. It is not possible to
get or create a TIFF export options object.

TIFF export options object properties

Property Value type What it is


antialiasing boolean If true, the exported image should be anti-aliased. Default:
true

byte order Valid values: The byte order to use in the new file.
IBM PC
MACINTOSH

imagecolorspace Valid values: The color space of the exported file. Default: RGB
Gray
RGB
CMYK

izwcompression boolean If true, use IZW compression in the new file.


resolution real Resolution of the exported file in dots per inch (dpi). Range:
72.0 to 2400.0. Default: 150.0
CHAPTER 1: AppleScript Objects tracingobject, tracings 211

tracingobject, tracings
Associates source raster art item with a vector-art plugin group created by tracing. Scripts can initiate
tracing using the trace placed command for a placed item or raster item. The resulting plugin item
object represents the vector art group, and has this object in its tracing property.

A script can force the tracing operation by calling the application’s redraw command. The operation is
asynchronous, so a script should call redraw after creating the tracingobject, but before accessing its
properties or expanding the tracing to convert it to an art item group.

The read-only properties that describe the tracing result have valid values only after the first tracing
operation completes. A value of 0 indicates that the operation has not yet been completed.

tracingobject object properties

Property Value type What it is


anchor count integer Read-only. The number of anchors in the tracing result.
area count integer Read-only. The number of areas in the tracing result.
best type type class Read-only. The best type for the object’s value. Always
returns reference.
class type class Read-only. The object’s class, which is text font.
container object reference Read-only. A reference to the object that contains this
tracing group.
default type type class Read-only. The default type for the object. Always
returns reference.
image resolution real Read-only. The resolution of the source image in pixels
per inch.
original art placed item or Read-only. The raster art used to create the associated
raster item) vector-art plugin group.
path count integer Read-only. The number of paths in the tracing result.
properties record All properties of this object returned as a record.
tracing options tracing options Read-only. The options used to convert the raster
artwork to vector art.
used color count integer Read-only. The number of colors used in the tracing
result.

tracingobject object commands


expand tracing
release tracing
CHAPTER 1: AppleScript Objects tracing options, multiple tracing options 212

tracing options, multiple tracing options


A set of options used in converting raster art to vector art by tracing.

tracing options object properties

Property Value type What it is


best type type class Read-only. The best type for the object’s value. Always
returns reference.
class type class Read-only. The object’s class, which is text font.
container object reference Read-only. A reference to the object that contains this
tracing group.
corner real The sharpness, in degrees of a turn in the original
angle image that is considered a corner in the tracing result
path. Range: 0 to 180
default type class Read-only. The default type for the object. Always
type returns reference.
fills boolean If true, trace with fills. At least one of fills or strokes
must be true.
ignore boolean If true, ignores white fill color.
white

live paint boolean If true, result is LivePaint art. If false, it is classic art.
output
NOTE: A script should set this value only in preparation
for a subsequent expand operation. Leaving a tracing
on the artboard when this property is true can lead to
unexpected application behavior.
maximum integer The maximum number of colors allowed for automatic
colors palette generation. Used only if tracing mode is color
or grayscale. Range: 2 to 256
maximum real The maximum stroke weight, when strokes is true.
stroke Range: 0.01 to 100.0
weight

minimum integer The smallest feature, in square pixels, that is traced. For
area example, if it is 4, a feature of 2 pixels wide by 2 pixels
high is traced.
minimum real The minimum length in pixels of features in the original
stroke image that can be stroked, when strokes is true.
length Smaller features are omitted. Range: 0.0 to 200.0
Default: 20.0
output boolean If true, named colors (swatches) are generated for
swatches each new color created by the tracing result. Used only
if tracing mode is color or grayscale.
CHAPTER 1: AppleScript Objects tracing options, multiple tracing options 213

Property Value type What it is


palette string The name of a color palette to use for tracing. If the
empty string, use the automatic palette. Used only if
tracing mode is color or grayscale.

path real The distance between the traced shape and the
fitting original pixel shape. Lower values create a tighter path
fitting. Higher values create a looser path fitting.
Range: 0.0 to 10.0
preprocess real The amount of blur used during preprocessing.
blur Blurring helps reduce small artifacts and smooth
jagged edges in the tracing result. Range: 0.0 to 2.0
preset string Read-only. The name of a preset file containing these
options.
properties record All properties of this object returned as a record.
resample boolean If true, resample when tracing. (This setting is not
captured in a preset file.)

Always true when the raster source art is placed or


linked.
resample real The resolution to use when resampling in pixels per
resolution inch (ppi). Lower resolution increases the speed of the
tracing operation. (This setting is not captured in a
preset file.)
strokes boolean If true, trace with strokes. At least one of fills or
strokes must be true. Used only if tracing mode is
black-and-white.
threshold integer The threshold value of black-and-white tracing. All
pixels with a grayscale value greater than this are
converted to black. Used only if tracing mode is
black-and-white. Range: 0 to 255
tracing Valid values: The color mode for tracing.
mode bw tracing mode
color tracing mode
gray tracing mode

view raster Valid values: The view for previews of the raster image. (This setting
view adjusted image is not captured in a preset file.)
view no image
view original image
view transparent image

view vector Valid values: The view for previews of the vector result. (This setting
view no tracing result is not captured in a preset file.)
view outlines
view outlines tracing
view tracing result
CHAPTER 1: AppleScript Objects tracing options, multiple tracing options 214

tracing options object commands


load preset
store preset
CHAPTER 1: AppleScript Objects variable, variables 215

variable, variables
A document-level variable that can be imported or exported.

A variable is a dynamic object used to create data-driven graphics. For an example, see dataset, datasets.
Variables are accessed in Illustrator through the Variables palette.

variable object elements

Element Refer to by
page item name, numeric index, range of elements, before/after another element, satisfying a test

variable object properties

Property Value type What it is


best type type class Read-only. The best type for the variable object’s value.
Always returns reference.
class type class Read-only. The object’s class, which is variable.
container object reference Read-only. A reference to the art item that contains this
variable.
default type type class Read-only. The default type for the variable. Always returns
reference.

index integer Read-only. The index of this variable in the art item.
kind Valid values: The kind of variable.
graph
image
textual
unknown
visibility

name Unicode text The name of the variable.


properties record All properties of this object returned as a record.

variable object commands


count
delete
exists
make
CHAPTER 1: AppleScript Objects view, views 216

view, views
A document view or list of views in an Illustrator document. The view object represents a window view
onto a document. Scripts cannot create new views, but can modify some properties of existing views,
including the center point, screen mode, and zoom.

view object properties

Property Value type What it is


best type type class Read-only. The best type for the view object. Always returns
reference.

bounds rect Read-only. The bounding rectangle of this view relative to the
current document’s bounds
center point fixed point The center point of this view relative to the current document’s
bounds
class type class Read-only. The object’s class, which is view.
rotateAngle real The rotation angle of this view.
container object reference Read-only. A reference to the document that contains this view.
default type type class Read-only. The default type for the view object. Always returns
reference.

index integer Read-only. The index of the view in the document.


properties record All properties of this object returned as a record.
screen mode Valid values: The mode of display for this view.
multiwindow
desktop
full screen

zoom real The zoom factor of this view, where 1.0 is 100%.

view object commands


count
exists

Center a view
-- Center the view on the first selected object
tell application "Adobe Illustrator"
set selectedItems to the selection
if selectedItems is not {} then
set firstObject to item 1 of selectedItems
set newPosition to position of firstObject
set center point of view 1 of document 1 to newPosition
end if
end tell
CHAPTER 1: AppleScript Objects view, views 217

Make a view full screen


-- Fill the entire screen with the first view
tell application "Adobe Illustrator"
if (count documents) > 0 then
set screen mode of view 1 of document 1 to full screen
end if
end tell
CHAPTER 1: AppleScript Objects WebP export options 218

WebP export options


Options for exporting a document as a WebP file, used with the exportFile method. All properties are
optional.

When you export a document, the appropriate file extension is appended automatically. You should not
include any file extension in the file specification.

WebP export options object properties

Property Value type What it is


antiAliasing AntiAliasingMet The type of antialiasing method of the exported
hod image. Default - AntiAliasingMethod.TypeOptimized.
losslessCompression boolean Indicates whether to have lossless or lossy
compression.
imageQuality number (long) In lossy compression, indicates the quality of the
exported image. Default - 100 Range - 0 to 100
isTransparent boolean If true, the exported image use transparency. Default -
true.
embedICCProfile boolean If true, an ICC profile should be embedded in the
exported file. Default - true.
pPI number (double) Resolution of the exported file in pixels per inch (ppi).
Default - 72.0 Range - 4.0 to 2400.0
matteColor RGBColor Matte color to be used for background if image is not
transparent
typename string The class name of the referenced object.

Exporting to WebP format


//Exports current document to dest as a WebP file with specified options, dest contains
the full path including the file name

function exportFileToWebP (dest) {


if ( app.documents.length > 0 ) {
var exportOptions = new ExportOptionsWebP();
var type = ExportType.WEBP;
var fileSpec = new File(dest);
exportOptions.isTransparent = true;
exportOptions.imageQuality = 100;
app.activeDocument.exportFile( fileSpec, type, exportOptions );
}
}
CHAPTER 1: AppleScript Objects word 219

word
A string of text in a text frame that is separated by whitespace. A document’s text can be accessed using
the character, insertion point, word, line, paragraph, and text classes. All text is contained within
text frames.

word object elements

Elements Refer to by
character name, numeric index, range of elements, before/after another element, satisfying a test
style

character numeric index, range of elements, before/after another element, satisfying a test
insertion numeric index, range of elements, before/after another element, satisfying a test
point

line numeric index, range of elements, before/after another element, satisfying a test
paragraph name, numeric index, range of elements, before/after another element, satisfying a test
style

paragraph name, numeric index, range of elements, before/after another element, satisfying a test
text numeric index, range of elements, before/after another element, satisfying a test
word name, numeric index, range of elements, before/after another element, satisfying a test

word object properties

Property Value type What it is


aki left real The amount of extra space (aki) added to
the left side of each glyph in Japanese
text (in thousandths of an em).
aki right real The amount of extra space (aki) added to
the right side of each glyph in Japanese
text (in thousandths of an em).
alignment Valid values: The character alignment type.
bottom
center
icf bottom
icf top
roman baseline
top
CHAPTER 1: AppleScript Objects word 220

Property Value type What it is


alternate glyphs Valid values: Specifies the type of alternate glyphs.
default
expert
full width
half width
jis78
jis83
proportional width
quarter width
third width
traditional
jis90
jis04

auto leading boolean If true, use automatic leading.


baseline Valid values: Specifies the Japanese text baseline
direction standard direction.
Tate Chu Yoko
vertical rotated

baseline Valid values: The baseline position of text.


position normal
subscript
superscript

baseline shift real The amount of shift (in points) of the text
baseline.
best type type class Read-only. The best type for the object’s
value.
capitalization Valid values: Specifies whether the text is normal, all
all caps uppercase, all small caps, or a mix of small
all small caps caps and lowercase.
normal
small caps

character offset integer Offset of the first character.


class type class Read-only. The object’s class.
connection forms boolean If true, use the OpenType connection
forms.
container reference Read-only. The object’ s container.
contents Unicode text The text content.
contextual boolean If true, use the contextual ligature.
ligature

default type type class Read-only. The default type for the
object’s value.
discretionary boolean If true, use the discretionary ligature.
ligature
CHAPTER 1: AppleScript Objects word 221

Property Value type What it is


alternate glyphs Valid values: Specifies the type of alternate glyphs.
default
expert
full width
half width
jis78
jis83
proportional width
quarter width
third width
traditional
jis90
jis04

auto leading boolean If true, use automatic leading.


baseline Valid values: Specifies the Japanese text baseline
direction standard direction.
Tate Chu Yoko
vertical rotated

baseline Valid values: The baseline position of text.


position normal
subscript
superscript

baseline shift real The amount of shift (in points) of the text
baseline.
best type type class Read-only. The best type for the object’s
value.
capitalization Valid values: Specifies whether the text is normal, all
all caps uppercase, all small caps, or a mix of small
all small caps caps and lowercase.
normal
small caps

character offset integer Offset of the first character.


class type class Read-only. The object’s class.
connection forms boolean If true, use the OpenType connection
forms.
container reference Read-only. The object’ s container.
contents Unicode text The text content.
contextual boolean If true, use the contextual ligature.
ligature

default type type class Read-only. The default type for the
object’s value.
discretionary boolean If true, use the discretionary ligature.
ligature
CHAPTER 1: AppleScript Objects word 222

Property Value type What it is


figure style Valid values: Specifies which figure style to use in an
default OpenType font.
proportional
proportional oldstyle
tabular
tabular oldstyle

fill color color info The color of the text fill.


fractions boolean If true, use the OpenType fractions.
horizontal scale real The character horizontal scaling factor
expressed as a percentage (100 = 100%).
index integer Read-only. The index of this instance of
the object.
italics boolean If true, the Japanese font supports italics.
kerning integer Controls the spacing between two
characters, in thousandths of the em
space.
kerning method Valid values: The type of automatic kerning method to
auto use.
none
optical
CHAPTER 1: AppleScript Objects word 223

Property Value type What it is


language Valid values: The language.
Bokmal Norwegian
Brazillian Portuguese
Bulgarian
Canadian French
Catalan
Chinese
Czech
Danish
Dutch
Dutch 2005 Reform
English
Finnish
German 2006 Reform
Greek
Hungarian
Icelandic
Italian
Japanese
Nynorsk Norwegian
old German
Polish
Romanian
Russian
Spanish
Serbian
standard French
standard German
standard Portuguese
Swedish
Swiss German
Swiss German 2006 Reform
Turkish
UK English
Ukranian

leading real The amount of space between two lines


of text, in points.
length integer Read-only. The length (in characters).
Minimum: 0
ligature boolean If true, use the ligature.
no break boolean If true, no line break is allowed in this
word.
OpenType Valid values: The OpenType baseline position.
position default
denominator
numerator
subscript
superscript

ordinals boolean If true, use the OpenType ordinals.


ornaments boolean If true, use the OpenType ornaments.
CHAPTER 1: AppleScript Objects word 224

Property Value type What it is


overprint fill boolean If true, overprint the fill of the text.
overprint stroke boolean If true, overprinting of the stroke of the
text is allowed.
properties record All properties of this object returned as a
record.
proportional boolean If true, the Japanese OpenType supports
metrics proportional fonts.
rotation real The character rotation angle in degrees.
selection list of text Read-only. The selected text.
size real The font size in points.
story story Read-only. The story that contains the
object.
strike through boolean If true, characters use strike-through
style.
stroke color color info The color of the text stroke.
stroke weight real Line width of stroke.
stylistic boolean If true, use OpenType stylistic alternates.
alternates

swash boolean If true, use the OpenType swash


character.
TCY horizontal integer The Tate-Chu-Yoko horizontal adjustment
in points.
TCY vertical integer The Tate-Chu-Yoko vertical adjustment in
points.
text font text font The text font.
titling boolean If true, use the OpenType titling
alternates.
tracking integer The tracking or range kerning amount in
thousandths of an em.
Tsume real The percentage of space reduction
around a Japanese character.
underline boolean If true, characters use underline style.
vertical scale real Character vertical scaling factor. 100 =
100%
warichu integer How the characters in Wari-Chu text (an
characters after inset note in Japanese text) are divided
break into two or more lines.
CHAPTER 1: AppleScript Objects word 225

Property Value type What it is


warichu integer How the characters in Wari-Chu text (an
characters inset note in Japanese text) are divided
before break into two or more lines.
warichu enabled boolean If true, Wari-Chu is enabled.
warichu gap integer The Wari-Chu line gap.
warichu Valid values: The Wari-Chu justification.
justification auto justify
center
full justify last line center
full justify
full justify last line left
full justify last line right
left
right

warichu lines integer The number of Wari-Chu (multiple text


lines fit into a space meant for one) lines.
warichu scale real The Wari-Chu scale.

word object commands


apply character style
apply paragraph style
change case
count
delete
deselect
duplicate
exists
make
select
CHAPTER 1: AppleScript Objects word 226

Finding specific words

This example demonstrates how to use the matching abilities of the whose clause in conjunction with
word properties to modify words that match a specific string.
-- Change the color of every occurrence of a specific
-- word in all text frames

set searchString to "the"

tell application "Adobe Illustrator"


set textArtItemCount to (count text frames in document 1)
if (textArtItemCount > 0) then

repeat with itemCounter from 1 to textArtItemCount


if (((contents of text frame itemCounter of document 1) as string) ¬
contains searchString) then
set fill color of (words of text frame itemCounter of document 1 ¬
whose contents contains searchString) to {red:255, green:0, blue:0}
end if
end repeat
end if
end tell
2 AppleScript Commands

This chapter provides a complete reference for the commands in the Illustrator AppleScript dictionary. The
commands are presented alphabetically.

The commands supported by each object, with links to the detailed descriptions here, are listed in
Chapter 1, “AppleScript Objects.”

Overview
This chapter describes the commands in the Illustrator AppleScript dictionary, as well as some of the
important standard AppleScript commands. The AppleScript dictionary itself shows only that the
command returns an object, or that the command takes an object reference as a parameter; it does not
show the specific objects that can respond to a particular command. Not all Illustrator objects can respond
to all commands; this reference details which objects respond to which commands, and what type of
object each command returns (if any).

The following information is given for each command:

Column heading What it means


Parameters Constants, keywords, and values needed by the command.

 Variable values to be supplied are shown in bold.

 Literal terms and constants are shown in plain type.

 Items surrounded by brackets [ ] are optional.


What it is An explanation of the parameters.
Objects Which objects support the command and/or which objects the command can
supported operate upon. The document object, for example, supports the command close, but
not the command quit.
Returns Many commands return values (text, numbers, lists, and object references). This
column shows you what kind of reference you can expect the command to return (if
any).

227
CHAPTER 2: AppleScript Commands activate 228

activate
Makes an application active; that is, makes Illustrator the front-most application.

Parameters What it is Objects supported Returns


none application nothing

Notes Illustrator must be the frontmost application when executing any command that deals with the clipboard.
Use this command to ensure this. See the clipboard commands for examples.
CHAPTER 2: AppleScript Commands add document 229

add document
Creates a new document from a preset template.

Parameters What it is Objects supported Returns


using startup preset The document template. document document

[with preset settings] Document settings with values to


override.
[options dialog boolean] True to open the Options dialog.
CHAPTER 2: AppleScript Commands add spot 230

add spot
Adds a spot swatch to the swatch group.

Parameters What it is Objects supported Returns


spot spot The spot swatch to be added. swatch nothing
CHAPTER 2: AppleScript Commands add swatch 231

add swatch
Adds a swatch to the swatch group.

Parameters What it is Objects supported Returns


swatch swatch The swatch to be added. swatch nothing
CHAPTER 2: AppleScript Commands apply 232

apply
Applies a brush or graphic style to one or more page items.

Parameters What it is Objects supported Returns


object reference The brush or graphic style to apply to the graphic style nothing
referenced objector objects. brush

to anything The page item or items to which to apply compound path item
abrush or graphic style. group item
mesh item
non native item
page item
path item
placed item
plugin item
raster item
text frame

Notes Use apply to affect one or more page items by applying an existing brush or graphic style. Brushes and
graphic styles can be created in the user interface, but not from a script.

Apply an art style


-- Draws an ellipse in the center of the document
-- and applies a graphic style to it
tell application "Adobe Illustrator"
make new document with properties {color space:CMYK}
set docWidth to (width of document 1) / 2
set docHeight to (height of document 1) / 2
set pathItemRef to make new ellipse in document 1 with properties ¬
{bounds:{docWidth - 50, docHeight + 50, docWidth + 50, docHeight - 50}}
apply graphic style 2 of document 1 to pathItemRef
end tell
CHAPTER 2: AppleScript Commands apply character style 233

apply character style


Applies a character style to a specified text object(s).

Parameters What it is Objects supported Returns


character style The character style object or character style nothing
objects to be operated upon.
to anything The text object or objects to text
which to apply the style.
[clearing overrides boolean] Whether to clear any text
attributes before apply the style.
Default: false
CHAPTER 2: AppleScript Commands apply paragraph style 234

apply paragraph style


Applies the paragraph style to text object(s).

Parameters What it is Objects supported Returns


paragraph style The paragraph style object or paragraph style nothing
objects to be operated upon.
to anything The text object or objects to which text
to apply the style.
[clearing overrides boolean] If true, text attributes are cleared
before apply the style.
Default: false
CHAPTER 2: AppleScript Commands arrange 235

arrange
The style in which to arrange multiple documents in the main window.

Parameters What it is Objects supported Returns


layout style Valid values: document boolean

cascade
horizontal tile
vertical tile
float all
consolidate all
CHAPTER 2: AppleScript Commands bring in perspective 236

bring in perspective
Places art object(s) in a perspective grid at a specified position and grid plane.

Parameters What it is Objects supported Returns


page item The page item object or objects to page item nothing
be operated upon.
position x real Horizontal coordinate at which to
place art on grid plane.
position y real Vertical coordinate at which to
place art on grid plane.
[perspective grid plane Type of perspective grid plane.
floorplane/leftplane/
noplane/rightplane]
CHAPTER 2: AppleScript Commands capture 237

capture
Captures the current document window to the target TIFF image file.

Objects
Parameters What it is supported Returns
to file specification The TIFF file to which the captured image should document nothing
be written.
size point The size to make the window before capture.
CHAPTER 2: AppleScript Commands change case 238

change case
Changes the capitalization of the selected text.

Objects
Parameters What it is supported Returns
text The text object or objects to be operated upon. text nothing
to lower case/ The type of case.
sentence case/
title case/
upper case
CHAPTER 2: AppleScript Commands close 239

close
Closes a document.

Objects
Parameters What it is supported Returns
document The document to close. document nothing
[saving yes/no/ask] Whether to save the document before closing.

Close a document
-- Close the first document and prompt the user with a "Save as" dialog
tell application "Adobe Illustrator"
activate
close document 1 saving ask
end tell
CHAPTER 2: AppleScript Commands colorize 240

colorize
Colorizes a raster item.

Parameters What it is Objects supported Returns


object reference The raster item to colorize. raster item nothing
raster color The color to use when coloring the CMYK color info
color info reference TIFF image. gradient color info
gray color info
pattern color info
RGB color info
spot color info
CHAPTER 2: AppleScript Commands concatenate matrix 241

concatenate matrix
Concatenates two transformation matrices to form a single resulting matrix.

Parameters What it is Objects supported Returns


matrix The first matrix. matrix matrix

with matrix The second matrix. matrix

Concatenate matrices
-- This script concatenates 2 matrices
tell application "Adobe Illustrator"
set someMatrix to get identity matrix
set anotherMatrix to get rotation matrix angle 30.0
set newMatrix to concatenate matrix someMatrix with anotherMatrix
end tell
CHAPTER 2: AppleScript Commands concatenate rotation matrix 242

concatenate rotation matrix


Concatenates a rotation angle together with a matrix and returns the resulting matrix.

Parameters What it is Objects supported Returns


matrix The matrix. matrix matrix

angle real Rotation angle in degrees.

Concatenate rotation matrix


-- This script adds a 45 degree rotation to an existing matrix
tell application "Adobe Illustrator"
set someMatrix to get identity matrix
set newMatrix to concatenate rotation matrix someMatrix angle 45.0
end tell
CHAPTER 2: AppleScript Commands concatenate scale matrix 243

concatenate scale matrix


Concatenates a horizontal and/or vertical scaling with a matrix to form a new, rescaled matrix.

Parameters What it is Objects supported Returns


matrix The matrix. matrix matrix

[horizontal scale real] Horizontal scaling factor, 100.0 is 100%.


Default: 100.0
[vertical scale real] Vertical scaling factor, 100.0 is 100%.
Default: 100.0

Concatenate scale matrix


-- This script combines a 75% horizontal and 25% vertical scaling with an existing
matrix
tell application "Adobe Illustrator"
set someMatrix to get identity matrix
set newMatrix to concatenate scale matrix someMatrix ¬
horizontal scale 75 vertical scale 25.0
end tell
CHAPTER 2: AppleScript Commands concatenate translation matrix 244

concatenate translation matrix


Concatenates a positional translation factor (specified by a horizontal and/or vertical offset) with a matrix
to form a new, repositioned matrix.

Parameters What it is Objects supported Returns


matrix The matrix. matrix matrix

[delta x real] Horizontal translation offset. Default: 0.0


[delta y real] Vertical translation offset. Default: 0.0

Concatenate translation matrix


--This script combines a 25 point horizontal offset with an existing matrix
tell application "Adobe Illustrator"
set someMatrix to get identity matrix
set newMatrix to concatenate translation matrix someMatrix delta x 25.0
end tell
CHAPTER 2: AppleScript Commands convert 245

convert
Converts the legacy text item to a text frame and deletes the original legacy text item.

Parameters What it is Objects supported Returns


legacy text item The legacy text item object or objects to legacy text item group item
be operated upon.
CHAPTER 2: AppleScript Commands convert area object to point object 246

convert area object to point object


Converts an area-type text frame to a point-type text frame.

Parameters What it is Objects supported Returns


none text frame text frame
CHAPTER 2: AppleScript Commands convert coordinate 247

convert coordinate
Converts the coordinates of a single point from one coordinate system to another. Returns the modified
coordinate list.

Parameters What it is Objects supported Returns


document The document object or objects to be document list
operated upon.
coordinate list The coordinates of the point to be
converted.
source The current coordinate system. Valid values:
artboard coordinate system
document coordinate system

destination The system to which to convert. Valid


values:
artboard coordinate system
document coordinate system
CHAPTER 2: AppleScript Commands convert point object to area object 248

convert point object to area object


Converts a point-type text frame to an area-type text frame.

Parameters What it is Objects supported Returns


none text frame text frame
CHAPTER 2: AppleScript Commands convert sample color 249

convert sample color


Converts a sample-component color from one color space to another.

Objects
Parameters What it is supported Returns
source color space image The source color space. application array of
color space ColorComponents
source color color The color to convert, a color sample An array of color
components object. The first location should components(e.g.
contain alpha if source has alpha R,G and B value)
is true. which constitute
destination color space The destination color space. The the color. First
image color space first location should contain alpha if location of
dest has alpha is true. returned array will
contain alpha
color convert purpose The purpose of conversion. Valid value if
color conversion purpose values: destination-has-al
default purpose pha is true.
dummy purpose option
export purpose
preview purpose

[source has alpha True if the alpha channel is present


boolean] in the source color. Default: false
[destination has alpha True if the alpha channel is present
boolean] in the destination color.
Default: false
CHAPTER 2: AppleScript Commands convert to paths 250

convert to paths
Converts the specified text to path items.

Parameters What it is Objects supported Returns


text frame The text frame object or objects to be text frame group item or null
operated upon.

Create outlines from text


--This script converts all text art to path art
tell application "Adobe Illustrator"
convert to paths (every text frame of document 1)
end tell
CHAPTER 2: AppleScript Commands copy 251

copy
Copies the selection in the current document to the clipboard.

Parameters What it is Objects supported Returns


none compound path item nothing
group item
mesh item
non native item
path item
placed item
plugin item
raster item
text frame

Notes Commands that manipulate the clipboard (cut, copy, and paste) require that Illustrator be the frontmost
application during these operations. Use activate to bring Illustrator to the front before executing the
copy command. No error is returned if there is no selection to copy. If the application is not frontmost, an
error is returned.

Copy selected objects


--This script copies the selected objects (if any) to the clipboard
tell application "Adobe Illustrator"
activate
copy
end tell
CHAPTER 2: AppleScript Commands count 252

count
Counts the elements of a specified type contained in a specified object.

Parameters What it is Objects supported Returns


count reference The object or list of objects whose graphic style integer
elements are to be counted. brush
character
[each type class] The class of the objects to count. compound path item
document
gradient
gradient stop
group item
insertion point
layer
line
mesh item
non native item
page item
paragraph
path item
path point
pattern
placed item
plugin item
raster item
spot
tag
text frame
view
word

[whose property is value] A condition that objects must


meet to be counted.

Notes With the optional each/every term, use the singular form for the object type to be counted; for example,
brush rather than brushes. Otherwise, you can use the singular or plural form.

Count filled path items in a document


-- This script stores the total path items in pathCount and
-- the total filled path items in numberFilled
tell application "Adobe Illustrator"
set pathCount to count every path item of document 1
set numberFilled to ¬
count (path items of document 1 whose filled is true)
end tell
CHAPTER 2: AppleScript Commands cut 253

cut
Cuts the current selection from the current document and places it in the clipboard.

Parameters What it is Objects supported Returns


none nothing compound path item nothing
group item
mesh item
non native item
path item
path point
placed item
plugin item
raster item
text
text frame

Notes Commands that manipulate the clipboard (cut, copy, and paste) require that Illustrator be the frontmost
application. Use activate to bring Illustrator to the front before executing the cut command. No error is
returned if there is no selection to cut. If the application is not frontmost, an error is returned.

Cut selected objects to the clipboard


--This script cuts the selected objects (if any)
tell application "Adobe Illustrator"
activate
cut
end tell
CHAPTER 2: AppleScript Commands delete 254

delete
Removes one or more elements from a container, or deletes one or more objects.

Parameters What it is Objects supported Returns


object reference Contained object or objects to delete artboard nothing
or remove. compound path item
gradient
You cannot remove the last artboard gradient stop
in a document. group item
layer
mesh item
non native item
page item
point
pattern
placed item
plugin item
raster item
spot
swatch
tag
text
text frame
text path

[of object reference] Container object. If supplied, removes document


the specified object or objects from group
this container. If not supplied, deletes layer
compound path item
the specified object or objects.
path item
story

Delete a layer
-- This script deletes the second layer in the document
tell application "Adobe Illustrator"
if (count layers of document 1) > 1 then
delete layer 2 of document 1
end if
end tell
CHAPTER 2: AppleScript Commands delete preference 255

delete preference
Removes the application preference key. See “Preference accessor guidelines” on page 78.

Parameters What it is Objects supported Returns


Illustrator preferences The Illustrator preferences object nothing
or objects to delete.
key The preference key
CHAPTER 2: AppleScript Commands delete workspace 256

delete workspace
Removes the given workspace.

Parameters What it is Objects supported Returns


workspaceName string The name of the workspace to delete. application boolean
CHAPTER 2: AppleScript Commands deselect 257

deselect
Deselects a text range.

Parameters What it is Objects supported Returns


text The text object or objects to be deselected. text nothing
CHAPTER 2: AppleScript Commands display 258

display
Displays the dynamic data that has been captured in a dataset object.
.

Parameters What it is Objects supported Returns


dataset The dataset object or objects to be displayed. dataset boolean
CHAPTER 2: AppleScript Commands do javascript 259

do javascript
Executes a JavaScript script and returns the result of execution.

Parameters What it is Objects supported Returns


javascript The JavaScript code to execute. N/A Unicode
text
[with arguments A list of suitable arguments to pass to the
list of anything] Javascript routine.
[show debugger When a debugger should be shown. Default:
before running/ never
never/
on runtime error]
CHAPTER 2: AppleScript Commands do script 260

do script
Plays an action from the Actions palette.

Objects
Parameters What it is supported Returns
Unicode text The name of the action to play. Case-sensitive. N/A nothing
from Unicode text The name of the Action Set containing the action.
Case-sensitive.
[dialogs boolean] If true, dialog boxes should be associated with the
action presented to the user. Default: true

Notes If the action is selected in the Actions palette in the Illustrator user interface, this command returns an
error.

Execute an action
-- This script executes an action in the default set without displaying any dialogs
tell application "Adobe Illustrator"
do script "Opacity 60 (selection)" from "Default Actions" without dialogs
end tell
CHAPTER 2: AppleScript Commands duplicate 261

duplicate
Duplicates an object or objects.

Objects
Parameters What it is supported Returns
object reference The object or objects to duplicate all objects except: object
reference or
[to location reference] The location for the new object or application list (of object
objects mesh item
references)
plugin items
[with properties record] New values for specified properties
of the new object or objects

Notes You can duplicate page items from one document to another. This is equivalent to setting the selection,
performing a cut or copy, bringing another document to the front, and then pasting. When duplicating
objects from one document to another, you must specify the location reference.

Duplicate to another document


-- Duplicate the first page item in document 1 to document 2
tell application "Adobe Illustrator"
set pageItemRef to duplicate page item 1 of document 1 to beginning of document 2
end tell
CHAPTER 2: AppleScript Commands equal matrices 262

equal matrices
Compares two matrices for equality.

Parameters What it is Objects supported Returns


matrix The first matrix for the comparison. matrix boolean

with matrix The second matrix for the comparison.

Compare matrices
-- This script compares 2 matrices and beeps if they are equal
tell application "Adobe Illustrator"
set someMatrix to get identity matrix
set anotherMatrix to get identity matrix
if (equal matrices someMatrix with anotherMatrix) then beep
end tell
CHAPTER 2: AppleScript Commands embed 263

embed
Embeds linked art in a document. Applied to a placed item, it converts the art to art item objects as
needed and deletes the placed item object.

Parameters What it is Objects supported Returns


object reference The placed item to embed. placed item nothing
CHAPTER 2: AppleScript Commands exists 264

exists
Determines whether an object exists.

Parameters What it is Objects supported Returns


object reference The object to test for existence. Any object except application boolean

Check if a document exists


-- Check if a document exists and beep twice
tell application "Adobe Illustrator"
if exists document 1 then beep 2
end tell
CHAPTER 2: AppleScript Commands expand tracing 265

expand tracing
Converts the vector art associated with a tracingobject into a new group item. The new group item
object replaces the plugin item object in the document. Deletes this object and its associated plugin
item object. Any group-level attributes that were applied to the plugin item are applied to the top level of
the new group item.

Parameters What it is Objects supported Returns


tracingobject The tracingobject object to operate on. tracingobject group item
object reference
[ wi t h vi ewed] By default the new group contains only the
tracing result (the filled or stroked paths). If
with viewed is specified, the new group
retains additional information that was
specified for the viewing mode, such as
outlines and overlays.
CHAPTER 2: AppleScript Commands export 266

export
Exports the specified document to a specified file type.

Objects
Parameters What it is supported Returns
object reference The document to export. document nothing
to file The file to export to, specified as a string containing
specification the full file path or an alias.
as JPEG/Photoshop/ The file type to which to export the document.
SVG/PNG8/PNG24/
GIF/AutoCAD/TIFF

[with options] The export options for the specified file type.
object reference

Export a document to JPEG


-- This script exports the current document as JPEG to the
-- destinationFolder passed in as a parameter, destinationFolder
-- is set by the framework this fragment is tested in
on exportFile(destinationFolder)
set destinationPath to destinationFolder as string
set newFilePath to destinationPath & "Sample.jpg"
tell application "Adobe Illustrator"
export current document to newFilePath as JPEG with options ¬
{class:JPEG export options, quality:60}
end tell
end exportFile
CHAPTER 2: AppleScript Commands export PDF preset 267

export PDF preset


Exports PDF presets for a document and saves them to a file.

Objects
Parameters What it is supported Returns
document The document object or objects to be operated on. document nothing
to file specification The file to export to, specified as a string containing
the full file path or an alias.
CHAPTER 2: AppleScript Commands export perspective grid preset 268

export perspective grid preset


Saves all perspective grid presets to a file.

Objects
Parameters What it is supported Returns
document The document object or objects to be operated document nothing
upon.
to file specification The file to export to.
CHAPTER 2: AppleScript Commands export print preset 269

export print preset


Exports Illustrator print presets for a document to a file.

Objects
Parameters What it is supported Returns
document The document object or objects to be operated on. document nothing
to file specification The file to export to, specified as a string containing
the full file path or an alias.
CHAPTER 2: AppleScript Commands export variables 270

export variables
Saves datasets containing variables and their associated dynamic data into an XML library.

Objects
Parameters What it is supported Returns
document The document object or objects to be operated on. document nothing
to file specification The file to export to, specified as a string containing
the full file path or an alias.
CHAPTER 2: AppleScript Commands fit artboard to selected art 271

fit artboard to selected art


Resizes the artboard to the bounds of the currently selected art.

Objects
Parameters What it is supported Returns
document The document object or objects to be operated on. document boolean

index The index of the artboard to update.


CHAPTER 2: AppleScript Commands get 272

get
Gets data from an object.

Parameters What it is Objects supported Returns


object reference The object or property to get a Any object The property value or
or property reference to or data from. object reference as the
specified type.
[as class or list The type of data to retrieve.
(of classes)]

Notes This standard AppleScript command is included because it illustrates AppleScript’s ability to coerce values
from one value type to another. You do not need to use get to assign values to variables.

Using the get command

-- This script gets the contents of a text frame both as a string and as a reference
tell application "Adobe Illustrator"
set textString to contents of text frame 1 of document 1
set textRef to text of text frame 1 of document 1 as reference
end tell
CHAPTER 2: AppleScript Commands get all swatches 273

get all swatches


Gets a list of all swatches in the swatch group.

Parameters What it is Objects supported Returns


none Nothing swatchgroup swatchlist (list of selected
swatches)
CHAPTER 2: AppleScript Commands get boolean preference 274

get boolean preference


Gets the value of the application preference key as boolean. See “Preference accessor guidelines” on
page 78.

Parameters What it is Objects supported Returns


Illustrator The Illustrator Illustrator preferences The value of the
preferences preferences object or application
objects to be operated on. preference key
as boolean.
key as Unicode text The type of data to retrieve.
CHAPTER 2: AppleScript Commands get identity matrix 275

get identity matrix


Returns an identity matrix.

Parameters What it is Objects supported Returns


none nothing matrix matrix

Notes The identity matrix is a transformation matrix that causes no transformation. Use it to get a base matrix to
use with the matrix concatenation commands.

Using an identity matrix


-- This script gets the identity matrix,
-- combines with rotation and scale and applies to an object
tell application "Adobe Illustrator"
set transformMatrix to get identity matrix
set transformMatrix to concatenate scale matrix ¬
transformMatrix horizontal scale 60
set transformMatrix to concatenate rotation matrix ¬
transformMatrix angle 45.0
transform page item 1 of document 1 using transformMatrix
end tell
CHAPTER 2: AppleScript Commands get internal color 276

get internal color


Gets the internal color of a spot.

Parameters What it is Objects supported Returns


none nothing spot color components
CHAPTER 2: AppleScript Commands get integer preference 277

get integer preference


Gets the value of the application preference key as an integer. See “Preference accessor guidelines” on
page 78.

Parameters What it is Objects supported Returns


Illustrator The Illustrator Illustrator The value of the
preferences preferences object or preferences application preference
objects to be operated upon. key as an integer.
key as Unicode text The type of data to retrieve.
CHAPTER 2: AppleScript Commands get perspective active plane 278

get perspective active plane


Retrieves the active plane of the active perspective grid of the document.

Parameters What it is Objects supported Returns


document The document object or objects document floorplane
to be operated upon. leftplane
noplane
rightplane
CHAPTER 2: AppleScript Commands get PPD info 279

get PPD info


Gets detailed file information for a specified PPD file.

Parameters What it is Objects supported Returns


name Unicode text The model name of the PPD file application PPD properties
CHAPTER 2: AppleScript Commands get preset file of 280

get preset file of


Returns the full path to the application

Parameters What it is Objects supported Returns


preset type The name of the preset type. Valid application file
values: specification
basic CMYK document
basic RGB document
print document preset
mobile document preset
video document preset
web document preset
CHAPTER 2: AppleScript Commands get preset settings 281

get preset settings


Retrieves the tracing-option settings from the template with a given preset name.

Parameters What it is Objects supported Returns


preset Unicode text The name of the preset application document preset
CHAPTER 2: AppleScript Commands get real preference 282

get real preference


Gets the value of the application preference key as a real number. See “Preference accessor guidelines” on
page 78.

Parameters What it is Objects supported Returns


Illustrator The Illustrator Illustrator The value of the
preferences preferences object or preferences application preference
objects to be operated upon. key as a real number.
key as Unicode text The type of data to retrieve.
CHAPTER 2: AppleScript Commands get rotation matrix 283

get rotation matrix


Returns a rotation matrix based on a specified rotation angle.

Parameters What it is Objects supported Returns


[angle real] The rotation angle in degrees. Default is 0.0, matrix matrix
which returns the standard identity matrix.

Notes Requires a value in degrees. 30 rotates the object 30 degrees counterclockwise; -30 rotates the object 30
degrees clockwise.

Get a rotation matrix


-- Get a 30-degree rotation matrix
tell application "Adobe Illustrator"
set rotateMatrix to get rotation matrix angle 30.0
end tell
CHAPTER 2: AppleScript Commands get scale matrix 284

get scale matrix


Returns a scale matrix based on specified horizontal and vertical scaling factor.

Objects
Parameters What it is supported Returns
[horizontal scale real] The horizontal scaling factor as a percentage. matrix matrix
Default is 100.0, which is 100%
[vertical scale real] The vertical scaling factor.
Default is 100.0, which is 100%

Notes If no parameters are supplied, returns the standard identity matrix.

Requires a value in percentage. 60 scales the object to 60% of its original size; 200 doubles the objects
bounds.

Get a scale matrix


-- This script gets a scale matrix
tell application "Adobe Illustrator"
set scaleMatrix to get scale matrix horizontal scale 100.0 vertical scale 50.0
end tell
CHAPTER 2: AppleScript Commands get screen mode 285

get screen mode


The mode of display for this view.

Parameters What it is Objects supported Returns


The mode of document NormalScreenMode
display for this
FullScreenWithMenuMode
view.
FullScreenNoMenuMode

PresentationMode
CHAPTER 2: AppleScript Commands get scriptable help group 286

get scriptable help group


Gets the scriptable help group object that represents the search widget in the app bar.

Parameters What it is Objects supported Returns


application variant (app bar help group live object)
CHAPTER 2: AppleScript Commands get selected 287

get selected
Gets the selected swatches in a document.

Parameters What it is Objects supported Returns


swatches swatchlist (list of selected swatches)
CHAPTER 2: AppleScript Commands get string preference 288

get string preference


Gets the value of the application preference key as string type. See “Preference accessor guidelines” on
page 78.

Parameters What it is Objects supported Returns


Illustrator The Illustrator Illustrator The value of the
preferences preferences object or preferences application preference
objects to be operated upon. key as string type.
key as Unicode text The type of data to retrieve.
CHAPTER 2: AppleScript Commands get translation matrix 289

get translation matrix


Returns a translation matrix based on a single movement with horizontal and vertical offsets.

Parameters What it is Objects supported Returns


[delta x real] The horizontal offset. Default: 0.0 matrix matrix

[delta y real] The vertical offset. Default: 0.0

Notes If no parameters are supplied, returns the standard identity matrix.

Requires a value in points. {100,200} moves the object 100 pt. to the right and 200 pt. up; a minus (-) before
each number moves the object left and down.

Get a translation matrix


-- This script gets a translation matrix
tell application "Adobe Illustrator"
set translateMatrix to get translation matrix delta x 10.0 delta y 100.0
end tell
CHAPTER 2: AppleScript Commands get view mode 290

get view mode


The view mode for this mode.

Parameters What it is Objects supported Returns


The view document OverprintPreview
mode for this
PixelPreview
mode.
DefaultPreview
CHAPTER 2: AppleScript Commands hide perspective grid 291

hide perspective grid


Hides the current active perspective grid for the document, if one is visible.

Objects
Parameters What it is supported Returns
document The document object or objects to be operated document boolean
upon.
CHAPTER 2: AppleScript Commands image capture 292

image capture
Captures the artwork content within the clipping boundaries in this document as a raster image, and
writes the image data to a specified file.

Objects
Parameters What it is supported Returns
to file specification The file to which the captured image should be document nothing
written.
[inside rect] The rectangular region of the artwork for image
capture. If omitted, captures the entire artwork.
[with options image The object describing the image-capture options.
capture options]
CHAPTER 2: AppleScript Commands import character styles 293

import character styles


Loads character styles from a file.

Parameters What it is Objects supported Returns


document The document object or objects to be document nothing
operated on.
from file specification File from which to import.
CHAPTER 2: AppleScript Commands import paragraph styles 294

import paragraph styles


Loads paragraph styles from a file.

Parameters What it is Objects supported Returns


document The document object or objects to be document nothing
operated on.
from file specification File from which to import.
CHAPTER 2: AppleScript Commands import PDF preset 295

import PDF preset


Loads all PDF presets from a file.

Parameters What it is Objects supported Returns


document The document object or objects to document nothing
be operated on.
from file specification File from which to import.
[replacing preset boolean] Whether existing editable presets
should be replaced. Default: false
CHAPTER 2: AppleScript Commands import perspective grid preset 296

import perspective grid preset


Loads a specified perspective grid preset, or all presets, from a specified file.

Parameters What it is Objects supported Returns


document The document object or objects to document nothing
be operated upon.
from file specification File to import from.
[perspective preset text] Name of a perspective grid preset. If
not supplied, loads all presets from
the file.
CHAPTER 2: AppleScript Commands import print preset 297

import print preset


Loads a print preset from a file.

Objects
Parameters What it is supported Returns
document The document object or objects to be document nothing
operated on.
print preset Unicode text The name of the print preset to
import.
from file specification The file to import from, specified as a
string containing the full file path or
an alias.
CHAPTER 2: AppleScript Commands import variables 298

import variables
Loads a library from a file that contains datasets, variables, and the associated dynamic data. The imported
data overwrites any existing variables and datasets.

Objects
Parameters What it is supported Returns
document The document object or objects into which to document nothing
import variables
from file specification The file from which to import variables,
specified as a string containing the full file
path or an alias.
CHAPTER 2: AppleScript Commands invert matrix 299

invert matrix
Returns an inverted matrix.

Parameters What it is Objects supported Returns


matrix The matrix to invert. matrix matrix

Notes A singular matrix cannot be inverted. Use the singular matrix command to test if a matrix is singular.

Invert a matrix
-- This script gets the inverse matrix of a 50% vertical scale matrix
-- When applied, the inverse matrix scales the object 200% vertically
tell application "Adobe Illustrator"
set transformMatrix to get scale matrix vertical scale 50.0
set transformMatrix to invert matrix transformMatrix
transform page item 1 of document 1 using transformMatrix
end tell
CHAPTER 2: AppleScript Commands is ruler visible 300

is ruler visible
If true, the ruler is visible.

Parameters What it is Objects supported Returns


If true, the ruler is visible. document boolean
CHAPTER 2: AppleScript Commands is transparency grid visible 301

is transparency grid visible


If true, the transparency grid is visible

Parameters What it is Objects supported Returns


If true, the transparency grid is document boolean
visible.
CHAPTER 2: AppleScript Commands launch 302

launch
Launches Illustrator.

Parameters What it is Objects supported Returns


none application nothing
CHAPTER 2: AppleScript Commands load color settings 303

load color settings


Loads color settings from specified file, or, if file is empty, turns color management off.

Parameters What it is Objects supported Returns


from file specification The color-settings file application nothing
CHAPTER 2: AppleScript Commands load preset 304

load preset
Loads a set of preset tracing options from a file into a tracing options object.

Parameters What it is Objects supported Returns


tracing options The tracing options object to tracing options boolean
operate on.
presetname Unicode text The preset name, as found in the
application tracing presets list.
CHAPTER 2: AppleScript Commands make 305

make
Creates a new object and returns a reference to newly created object. To place new art in a document, use
this command to create a placed item, then use the embed command on the resulting placed item
object to convert it to embedded art items.

Objects
Parameters What it is supported Returns
new type class The class of object to create. The term all objects except: object
new is optional. reference
application
at location reference Location at which to insert new object. mesh item
plugin item
[with properties record] Any property of the object you wish to
set at creation.
[with data anything] Any data needed for creation that is
not a property.

Create layers

An open document must exist before this script is executed.


-- Make 2 layers, one at the top and one at the bottom
-- demonstrating the power of location references like beginning and end
tell application "Adobe Illustrator"
set topLayer to make new layer ¬
at beginning of document 1 with properties {name:"Top Layer"}
set bottomLayer to make new layer ¬
at end of document 1 with properties {name:"Bottom Layer"}
end tell
CHAPTER 2: AppleScript Commands merge 306

merge
Merges this style into the current style(s) of the specified items.

Parameters What it is Objects supported Returns


graphic style The graphic style to be merged. compound path item The merged style
group item
graphic style to The object or objects to merge mesh item
anything the style into. non native item
page item
path item
placed item
plugin item
raster item
text frame
CHAPTER 2: AppleScript Commands move 307

move
Moves one or more objects to a new location; returns references to the moved object or objects at the new
location.

Parameters What it is Objects supported Returns


object reference Object or objects to move. compound path item object reference or list
group item (of object references)
to location New location of the object or layer
reference objects. mesh item
non native item
page item
path item
placed item
plugin item
raster item
text frame

Notes Objects cannot be moved between documents.

Move objects to a layer


-- This script moves all objects in a document to the first layer
tell application "Adobe Illustrator"
set allPageItems to every page item of document 1
move allPageItems to beginning of layer 1 of document 1
end tell

Move layers
-- This script moves the bottommost layer to after the first layer
tell application "Adobe Illustrator"
tell document 1 to move last layer to after first layer
end tell
CHAPTER 2: AppleScript Commands open 308

open
Opens one or more specified documents.

Objects
Parameters What it is supported Returns
file specification The file to be opened. N/A nothing
[forcing RGB/CMYK] Pre-Illustrator 9 files only.

Opens the document using the specified color


space, converting if necessary. If not supplied,
and the document contains both color spaces,
displays a dialog for the user to choose one.
[dialogs boolean] If true, show warning and error dialogs when
opening the file or files. Default: true
[with options anything] Options for opening a particular type of file.

Open a PDF file


-- This function opens the file passed as
-- a file reference parameter, fileToOpen is
-- a reference to a PDF file and needs to
-- be set up before calling this function
on openFile(fileToOpen)
tell application "Adobe Illustrator"
set user interaction level to never interact
open POSIX file fileToOpen as alias without dialogs
end tell
end openFile
CHAPTER 2: AppleScript Commands paste 309

paste
Pastes the clipboard contents into the current layer of the current document.

Parameters What it is Objects supported Returns


none compound path item nothing
group item
mesh item
non native item
path item
path point
placed item
plugin item
raster item
text
text frame

Notes Commands that manipulate the clipboard (cut, copy, and paste) require that Illustrator be the frontmost
application. Use activate to bring Illustrator to the front before executing the paste command. No error
is returned if there is no selection to paste. If the application is not frontmost, an error is returned.

Paste from the clipboard


-- Paste the contents of the clipboard into the current document
tell application "Adobe Illustrator"
activate
paste
end tell
CHAPTER 2: AppleScript Commands print 310

print
Prints one or more documents or files.

Parameters What it is Objects supported Returns


anything Document(s) or file(s) to be printed. document nothing
[options print options] A print options object. print options

Print a document
-- Print the current document without displaying a dialog
tell application "Adobe Illustrator"
print document 1 without dialog
end tell

Print with options


-- Make new document. add symbol items
-- Set job options, color management options, coordinate options, flattening options
-- Print the document using these options
tell application "Adobe Illustrator"
activate
make new document
repeat with i from 1 to (count of symbols in document 1)
round (i / 2 - (round (i / 2) rounding down)) rounding up
make new symbol item in document 1 with properties ¬
{symbol:symbol i of document 1, position:{100 + (the result * 150), (50 + i *
70)}} ¬

end repeat
set jobOptions to {class:job options, designation:all layers, reverse pages:true} ¬

set colorOptions to {class:color management options, name:"ColorMatch RGB",


intent:saturation} ¬

set coordinateOptions to {class:coordinate options, fit to page:true}


set flatteningOptions to ¬
{class:flattening options, clip complex regions:true, gradient resolution:60,
rasterization resolution:60} ¬

set printOptions to ¬
¬
{class:print options, job settings:jobOptions, color management
settings:colorOptions, coordinate settings:coordinateOptions, flattener
settings:flatteningOptions} ¬

print document 1 options printOptions


end tell
CHAPTER 2: AppleScript Commands quit 311

quit
Forces Illustrator to quit.

Parameters What it is Objects supported Returns


none application nothing

Quit Illustrator
-- Quit Illustrator after clearing the clipboard and closing documents
tell application "Adobe Illustrator"
activate
set the clipboard to {}
close every document saving no
quit
end tell
CHAPTER 2: AppleScript Commands rasterize 312

rasterize
Rasterizes the source art(s) within the specified clip bounds. The source art(s) is disposed of as a result of
the rasterization.

Objects
Parameters What it is supported Returns
SourceArt variant The page item(s) to be rasterized. document page item

ClipBounds rect The rectangular region of the artwork for


the rasterization. If this parameter is
omitted, the bounds of the source art(s) is
used instead.
Options rasterize options Describes the rasterization options.
CHAPTER 2: AppleScript Commands rearrange artboards 313

rearrange artboards
Rearranges artboards in a document.

Objects
Parameters What it is supported Returns
document The document object or objects to document boolean
operate on.
[artboardLayout column/grid by The layout style to use. Default is
column/grid by row/rl grid by grid by row.
row/rl row/row]

[artboardRowsOrColumns integer] The number of rows or columns,


as appropriate for the chosen
layout style, in the range
[1..docNumArtboards-1], or 1
(the default) for single
row/column layouts.
[artboardSpacing real] The spacing betweeen artboards.
A number of pixels, default 20.0
[artboardMoveArtwork boolean] When true (the default), artwork
is moved with the artboards.
CHAPTER 2: AppleScript Commands redo 314

redo
Redoes the most recently undone transaction.

Parameters What it is Objects supported Returns


none application nothing
CHAPTER 2: AppleScript Commands redraw 315

redraw
Forces Illustrator to redraw its window or windows.

Parameters What it is Objects supported Returns


none application nothing

Redraw
-- This script redraws all windows in Illustrator
tell application "Adobe Illustrator" to redraw
CHAPTER 2: AppleScript Commands release tracing 316

release tracing
Reverts vector artwork in the document that was created by tracing to the original source raster art, and
removes the traced vector art. Returns the original object used to create the tracing, and deletes the
tracingobject object and its associated plugin item object.

Parameters What it is Objects supported Returns


tracingobject The tracingobject object to tracingobject placed item or raster
operate on. item object reference
CHAPTER 2: AppleScript Commands relink 317

relink
Relinks placed art in a document with the file that defines the content. Applied to a placed item, it
associates the placed item object with the specified file.

Parameters What it is Objects supported Returns


file The file to be linked with the placed placed item nothing
specification art.

Relink
-- This script relinks all placed art in the current document to a specific image file
tell application "Adobe Illustrator"
activate

set replacefile to (my (path to desktop folder) as string) & "replace.jpg"


set placedItemList to every placed item of current document
repeat with placedItemPath in placedItemList
relink placedItemPath from replacefile
end repeat
end tell
CHAPTER 2: AppleScript Commands reset workspace 318

reset workspace
Resets the current workspace.

Parameters What it is Objects supported Returns


none application boolean
CHAPTER 2: AppleScript Commands rotate 319

rotate
Rotates one or more page items counterclockwise by a specified rotation angle.

Parameters What it is Objects supported Returns


page item The page item object or objects to compound path item nothing
rotate. group item
mesh item
angle real The rotation angle in degrees. non native item
Rotation is counterclockwise. page item
path item
[transforming objects If true, the page item positions and path point
boolean] their orientations are affected. placed item
Default: true plugin item
raster item
[transforming fill If true, the fill patterns assigned to text frame
patterns boolean] paths are affected. Default: true
[transforming fill If true, the fill gradients assigned to
gradients boolean] paths are affected. Default: true
[transforming stroke If true, the stroke patterns assigned
patterns boolean] to paths are affected. Default: true
[about The point on the bounding box to
document origin/ which the rotation is applied.
top left/ Default: center
left/
bottom left/
top/
center/
bottom/
top right/
right/
bottom right]

Notes The rotate command provides many variations when used with the about parameter. Experiment with
different choices for about to see what the results are for each setting.

Rotate about the bottom left corner


-- Rotate the first page item by 45 degrees using the
-- bottom left corner as the rotation pivot point
tell application "Adobe Illustrator"
rotate page item 1 of document 1 angle 45.0 about bottom left
end tell
CHAPTER 2: AppleScript Commands save 320

save
Saves an Illustrator document. Returns a reference to the saved document.

Objects
Parameters What it is supported Returns
document The document to save. document object
reference
[in file specification] The file to save to, specified as a string
containing the full file path or an alias.

If not specified, the document is saved to its


existing file.
[as The file type to which to save.
Illustrator/
eps/
pdf/
fxg]

[with options anything] The save options for the specified file type.

Save PDF files

This example shows to batch process folders of Illustrator documents, saving each as a PDF file with
specific settings.
-- Save each Illustrator file as a PDF file.
-- fileList is a list of aliases to Illustrator files
-- filePath is the path to the folder containing the files
-- destFolder is an alias to a folder where the PDF files are to be saved

on SaveFilesAsPDF(fileList, filePath, destFolder)


set destPath to destFolder as string
set fileCount to count of fileList
if fileCount > 0 then
repeat with i from 1 to fileCount
set fileName to item i of fileList
set fullPath to filePath & fileName
set newFilePath to destPath & fileName & ".pdf"
tell application "Adobe Illustrator"
open POSIX file fullPath as alias without dialogs
save current document in file newFilePath as pdf ¬
with options {class:PDF save options ¬
, compatibility:Acrobat 5 ¬
, preserve editability:true}
close current document saving no
end tell
end repeat
end if
end SaveFilesAsPDF
CHAPTER 2: AppleScript Commands save workspace 321

save workspace
Saves a new workspace.

Parameters What it is Objects supported Returns


workspaceName string The name of the new workspace. application boolean
CHAPTER 2: AppleScript Commands scale 322

scale
Scales one or more page items by the specified horizontal and vertical amounts.

Parameters What it is Objects supported Returns


page item The page item object or objects to scale. compound path item nothing
group item
horizontal scale The horizontal scaling factor. 100.0 is 100% mesh item
real non native item
page item
vertical scale real The vertical scaling factor. 100.0 is 100% path item
path point
[transforming If true, the page item positions and their placed item
objects boolean] orientations are affected. Default: true plugin item
raster item
[transforming fill If true, the fill patterns assigned to paths text frame
patterns boolean] are affected. Default: true
[transforming fill If true, the fill gradients assigned to paths
gradients boolean] are affected. Default: true
[transforming stroke If true, the stroke patterns assigned to
patterns boolean] paths are affected. Default: true
[line scale real] The amount that line widths are to be
scaled. 100.0 is 100%. Default: 100.0
[about The point in the bounding box of the page
document origin/ item or items to which the scaling is
top left/ applied. Default: center
left/
bottom left/
top/
center/
bottom/
top right/
right/
bottom right]

Notes The scale command provides many variations when used in conjunction with the about parameter.
Experiment with different choices for the about parameter to see what the results are for each setting.

Scale a page item


-- Scale a page item by 50% horizontally resizing to the right
tell application "Adobe Illustrator"
tell document 1
scale page item 1 horizontal scale 50.0 vertical scale 100.0 about left
end tell
end tell
CHAPTER 2: AppleScript Commands select 323

select
Selects the text range.

Objects
Parameters What it is supported Returns
text The text object or objects to select. text nothing
[extending selection If true, the text range is added to the document’s
boolean] existing text selection. Default: false
CHAPTER 2: AppleScript Commands select objects on active artboard 324

select objects on active artboard


Selects all art objects on the currently active artboard.

Parameters What it is Objects supported Returns


document The document object or objects document boolean
to be operated upon.
CHAPTER 2: AppleScript Commands select perspective preset 325

select perspective preset


Selects a predefined perspective grid for the current document.

Objects
Parameters What it is supported Returns
document The document object or objects to be operated document boolean
upon.
perspective preset text Name of a perspective grid preset.
CHAPTER 2: AppleScript Commands set 326

set
Changes the value of a variable or an object’s property or data. This is a standard AppleScript command
used to assign values to variables and object properties.

Objects
Parameters What it is supported Returns
property or variable The object property or script variable to modify. any property nothing
or variable
to anything Any valid value.

Set a property
-- Set the zoom property of the frontmost view window to 100%
tell application "Adobe Illustrator"
set zoom of view 1 of document 1 to 1.0
end tell
CHAPTER 2: AppleScript Commands set boolean preference 327

set boolean preference


Sets the value of the application preference key as boolean. See “Preference accessor guidelines” on
page 78.

Parameters What it is Objects supported Returns


Illustrator The Illustrator Illustrator The boolean value of
preferences preferences object or preferences the preference key.
objects to be operated on.
key as Unicode text The type of data to retrieve.
CHAPTER 2: AppleScript Commands set integer preference 328

set integer preference


Sets the value of the application preference key as an integer. See “Preference accessor guidelines” on
page 78.

Parameters What it is Objects supported Returns


Illustrator The Illustrator Illustrator The integer value of the
preferences preferences object or preferences preference key.
objects to be operated on.
key as Unicode text The type of data to retrieve.
CHAPTER 2: AppleScript Commands set perspective active plane 329

set perspective active plane


Sets the active perspective plane for the active grid of the document.

Parameters What it is Objects supported Returns


document The document object or objects to document boolean
be operated upon.
CHAPTER 2: AppleScript Commands set real preference 330

set real preference


Sets the value of the application preference key as a real number. See “Preference accessor guidelines” on
page 78.

Parameters What it is Objects supported Returns


Illustrator The Illustrator Illustrator The real value of the
preferences preferences object or preferences preference key.
objects to be operated on.
key as Unicode text The type of data to retrieve.
CHAPTER 2: AppleScript Commands set string preference 331

set string preference


Sets the value of the application preference key as string type. See “Preference accessor guidelines” on
page 78.

Parameters What it is Objects supported Returns


Illustrator The Illustrator Illustrator The string value of the
preferences preferences object or preferences preference key.
objects to be operated on.
key as Unicode text The type of data to retrieve.
CHAPTER 2: AppleScript Commands set grid configuration 332

set grid configuration


Updates the grid repeat art

Objects
Parameters What it is supported Returns

set grid the grid repeat item object or objects to be grid repeat nothing
item, grid
configuration operated upon
grid repeat repeat items
item, grid
repeat items

config grid updated grid repeat configuration.


repeat config

state grid all/ specify which properties of grid repeat gets


horizontal
updated.
spacing/
vertical
spacing
CHAPTER 2: AppleScript Commands write as library 333

write as library
Writes the document to a file as a library of specified type.

Parameters What it is Objects supported Returns


File Writes the document to a file as a document nothing
library of specified type.
LibraryType
CHAPTER 2: AppleScript Commands set radial configuration 334

set radial configuration


Updates the radial repeat art

Objects
Parameters What it is supported Returns

set grid the radial repeat item object or objects to radial repeat nothing
configuration item, radial
be operated upon repeat items
radial repeat
item, radial
repeat items

config radial updated radial repeat configuration.


repeat config

state number of specify which properties of


instances/ radial repeat gets updated.
radial
all/ reverse
overlap
CHAPTER 2: AppleScript Commands set symmetry configuration 335

set symmetry configuration


Updates the symmetry repeat art

Objects
Parameters What it is supported Returns

set grid the symmetry repeat item object or objects symmetry repeat nothing
configuration item, symmetry
to be operated upon repeat items
symmetry
repeat item,
symmetry
repeat items

config updated symmetry repeat configuration.


symmetry
repeat config

state axis specify which properties of symmetry


rotation/
repeat gets updated.
symmetry all
CHAPTER 2: AppleScript Commands show perspective grid 336

show perspective grid


Shows the current active perspective grid for the document, if any; otherwise, shows the default
perspective grid.

Objects
Parameters What it is supported Returns
document The document object or objects to be document boolean
operated upon.
CHAPTER 2: AppleScript Commands show presets 337

show presets
Returns presets from a file as a list of Unicode text items.

Objects
Parameters What it is supported Returns
from file The file to import from, specified as a string N/A list (of Unicode
specification containing the full file path or an alias. text)
CHAPTER 2: AppleScript Commands singular matrix 338

singular matrix
Tests an existing matrix to see if it is singular. A singular matrix cannot be inverted.

Parameters What it is Objects supported Returns


matrix The matrix to test. matrix boolean

Invert a matrix
-- This script gets an identity matrix and then
-- test to see if it can be inverted (if not singular)
-- If it can, then it inverts it
tell application "Adobe Illustrator"
set someMatrix to get identity matrix
if (not (singular matrix someMatrix)) then
set someMatrix to invert matrix someMatrix
set testResult to true
else
set testResult to false
end if
end tell
CHAPTER 2: AppleScript Commands store preset 339

store preset
Saves a set of preset tracing options from a tracing options object. For an existing preset, overwrites an
unlocked preset and returns true. Returns false if the preset is locked.

Parameters What it is Objects supported Returns


tracing options The tracing options object to tracing options boolean
operate on.
presetname Unicode text The preset name. Use a name found
in the application object’s tracing
presets list, or a new name to create a
new preset.
CHAPTER 2: AppleScript Commands switch workspace 340

switch workspace
Switches to the given workspace.

Parameters What it is Objects supported Returns


workspaceName string The name of the workspace to switch application boolean
to.
CHAPTER 2: AppleScript Commands trace placed 341

trace placed
Converts the raster art for the art item to vector art, using default options. Reorders the placed art into the
source art of a plugin group, and converts it into a group of filled and/or stroked paths that resemble the
original image.

Creates and returns a plugin item object that references a traceobject object.

Parameters What it is Objects supported Returns


placed item object The object to operate on. placed item plugin item object
reference
CHAPTER 2: AppleScript Commands trace raster 342

trace raster
Converts the raster art for the art item to vector art, using default options. Reorders the raster art into the
source art of a plugin group, and converts it into a group of filled and/or stroked paths that resemble the
original image.

Creates and returns a plugin item object that references a traceobject object.

Parameters What it is Objects supported Returns


raster item object The object to operate on. raster item plugin item object
reference
CHAPTER 2: AppleScript Commands transform 343

transform
Transform one or more page items by a specified matrix.

Parameters What it is Objects supported Returns


page item The page item object or objects to compound path item nothing
transform. group item
mesh item
using matrix The matrix to use for the transformation. non native item
page item
[transforming If true, the page item positions and their path item
objects boolean] orientations are affected. Default: true path point
placed item
[transforming fill If true, the fill patterns assigned to paths plugin item
patterns boolean] are affected. Default: true raster item
text frame
[transforming fill If true, the fill gradients assigned to
gradients boolean] paths are affected. Default: true
[transforming stroke If true, the stroke patterns assigned to
patterns boolean] paths are affected. Default: true
[line scale real] The amount that line widths are to be
scaled. Default: 100.0, which is 100%
[about The point in the bounding box to which
document origin/ the transformation is applied. Default:
top left/ center
left/
bottom left/
top/
center/
bottom/
top right/
right/
bottom right]

Notes This command can be used to generate any combination of transformations contained in a matrix, making
it possible to skew objects among other modifications. The command provides many variations when
used with the about parameter. Experiment with different choices for about to see what the results are for
each setting.

Transform an object
-- This script skews an object 45 degrees to the right horizontally
-- by generating a rotation matrix and setting the appropriate matrix values
tell application "Adobe Illustrator"
set baseMatrix to get rotation matrix angle 45.0
set mvalue_b of baseMatrix to 0
set startGeoBounds to geometric bounds of page item 1 of document 1
transform page item 1 of document 1 using baseMatrix
end tell
CHAPTER 2: AppleScript Commands translate 344

translate
Moves one or more page items from their existing position in a document to a new position defined by
relative coordinates.

Parameters What it is Objects supported Returns


page item The page item object or objects to compound path item nothing
translate. group item
mesh item
[delta x real] The horizontal coordinate of the new non native item
position. Default: 0.0 page item
path item
[delta y real] The vertical coordinate of the new path point
position. Default: 0.0 placed item
plugin item
[transforming If true, the object positions and raster item
objects boolean] orientations are affected. Default: true text frame

[transforming fill If true, the fill patterns are affected.


patterns boolean] Default: true
[transforming fill If true, the fill gradients are affected.
gradients boolean] Default: true
[transforming stroke If true, the stroke patterns are affected.
patterns boolean] Default: true

Notes Use translate to move objects relatively from their existing position. Set the position property of an
object to move the object to absolute coordinates.

Move an item to a new position


--This script moves the first page item to new relative coordinates
tell application "Adobe Illustrator"
set startGeoBounds to geometric bounds of page item 1 of document 1
tell document 1 to translate page item 1 delta x 20.0 delta y -10.0
end tell
CHAPTER 2: AppleScript Commands translate placeholder text 345

translate placeholder text


Translate the placeholder text to regular text. This allows you to enter Unicode characters as hex values.

Parameters What it is Objects supported Returns


Unicode text The placeholder text to be translated. text Unicode text or null
CHAPTER 2: AppleScript Commands undo 346

undo
Undoes the most recent transaction.

Parameters What it is Objects supported Returns


none application nothing
CHAPTER 2: AppleScript Commands update 347

update
Reapplies the dynamic data of the active dataset to the artboard.

Parameters What it is Objects supported Returns


dataset Dataset to be updated. dataset dataset

You might also like