Macromedia Illustrator - CC User Guide

ADOBE® ILLUSTRATOR® CC 2017
ADOBE ILLUSTRATOR CC 2017
SCRIPTING REFERENCE:
APPLESCRIPT
2016 Adobe Systems Incorporated. All rights reserved.
Adobe Illustrator CC 2017 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 Systems 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 Systems Incorporated. Adobe Systems 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 Systems 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 Systems 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 Systems 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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
artboard, artboards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
AutoCAD export options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
AutoCAD options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
brush, brushes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
character . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
character style, character styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
CMYK color info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
color info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
color management options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
color separation options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
compound path item, compound path items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
coordinate options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
dataset, datasets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
document, documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
document preset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
ellipse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
EPS save options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Flash export options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
flattening options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
font options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
FreeHand options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
FXG save options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
GIF export options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
gradient, gradients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
gradient color info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
gradient stop, gradient stops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
gradient stop info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
graph item, graph items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
graphic style, graphic styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
gray color info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
group item, group items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Illustrator preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
3
Contents 4
Illustrator save options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
image capture options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
ink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
ink properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
insertion point . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
job options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
JPEG export options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Lab color info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
layer, layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
legacy text item, legacy text items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
mesh item, mesh items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
no color info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
non native item, non native items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
open options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
page item, page items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
page marks options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
paper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
paper options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
paper properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
paragraph, paragraphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
paragraph style, paragraph styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
path item, path items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
path point, path points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
path point info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
pattern, patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
pattern color info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
PDF options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
PDF save options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
Photoshop export options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
Photoshop options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
placed item, placed items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
plugin item, plugin items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
PNG8 export options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
PNG24 export options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
polygon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
postscript options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Contents 5
PPD file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
PPD properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
print options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
printer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
printer properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
raster effect options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
raster item, raster items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
rasterize options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
rectangle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
RGB color info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
rounded rectangle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
screen properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
screen spot function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
separation screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
spot, spots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
spot color info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
star . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
story, stories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
SVG export options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
swatch, swatches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
swatchgroup, swatchgroups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
symbol, symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
symbol item, symbol items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
tab stop info, tab stops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
tag, tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
text font, text fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
text frame, text frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
text path item, text path items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
TIFF export options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
tracingobject, tracings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
tracing options, multiple tracing options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
variable, variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
view, views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
word . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
2 AppleScript Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
Contents 6
activate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
add document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
add spot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
add swatch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
apply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
apply character style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
apply paragraph style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
arrange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
bring in perspective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
capture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
change case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
close . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
colorize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
concatenate matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
concatenate rotation matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
concatenate scale matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
concatenate translation matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
convert . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
convert area object to point object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
convert coordinate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
convert point object to area object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
convert sample color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
convert to paths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
copy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
count . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
cut . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
delete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
delete preference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
delete workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
deselect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
do javascript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
do script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
duplicate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
equal matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
embed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
exists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
expand tracing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
Contents 7
export . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
export PDF preset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
export perspective grid preset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
export print preset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
export variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
fit artboard to selected art . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
get . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
get all swatches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
get boolean preference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
get identity matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
get internal color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
get integer preference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
get perspective active plane . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
get PPD info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
get preset file of . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
get preset settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
get real preference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
get rotation matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
get scale matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
get scriptable help group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
get selected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
get string preference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
get translation matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
hide perspective grid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
image capture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
import character styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
import paragraph styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
import PDF preset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
import perspective grid preset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
import print preset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
import variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
invert matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
launch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
load color settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
load preset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
make . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
merge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
move . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
Contents 8
open . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
paste . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
print . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
quit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
rasterize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
rearrange artboards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
redo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
redraw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
release tracing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
relink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
reset workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
rotate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
save . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
save workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
scale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
select . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
select objects on active artboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
select perspective preset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
set boolean preference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
set integer preference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
set perspective active plane . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
set real preference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
set string preference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
show perspective grid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
show presets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
singular matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
store preset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
switch workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320
trace placed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
trace raster . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
translate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
translate placeholder text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
undo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
update . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
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 CC 2017 Scripting Guide.
9
CHAPTER 1: AppleScript Objects application 10

application

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

application elements

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

application object properties

Property Value type What it is
best type
browser available boolean
build number string
class
color settings
type class Read-only. The best type for the
type class Read-only. The object’s class, which is
list of Unicode text Read-only. The list of color-settings files
application object’s value. Always returns
reference.
Read-only. If true, a web browser is available.
Read-only. The application’s build number.
application.
currently available for use.
coordinate system
current document document
default color settings
default type
flattener presets
free memory integer
Valid values:
document coordinate system artboard coordinate system
file specification
type class Read-only. The default type for the
list of Unicode text Read-only. The list of flattener style
Coordinate system currently in use.
The active (frontmost) document in Illustrator.
Read-only. The default color-settings file for the current application locale.
application object’s value. Always returns
reference.
names currently available for use.
Read-only. The amount of unused memory (in bytes) within the Illustrator partition.
CHAPTER 1: AppleScript Objects application 11
Property Value type What it is
frontmost boolean
locale string
name
paste remembers layers
PDF presets
PPDs
print presets
printers
Unicode text Read-only. The application’s name (not
boolean
list of Unicode text Read-only. The list of preset PDF-options
list of PPD files Read-only. The list of PPD files currently
list of Unicode text Read-only. The list of preset
list of printers Read-only. The list of installed printers
Read-only. If true, this is the frontmost (active) application.
Read-only. The application’s locale.
related to the filename of the application file). Always returns
Illustrator CC 2017"
.
"Adobe
When true, paste operations maintain layer structure.
names available for use.
available for use. (A document must be open or an error is returned).
printing-options names available for use.
currently available for use. (A document must be open or an error is returned).
properties record
scripting version
Unicode text Read-only. The version of the Scripting
All the application’s properties returned in a single record. Properties that are individually read-only remain so in this record.
plug-in.
CHAPTER 1: AppleScript Objects application 12
Property Value type What it is
selection
settings Illustrator preferences
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
selection to in place of select. See
set the
the examples below.
The application’s selection can be accessed and modified. When there are no selected objects, an empty list, in the current document, set
selection contains
{}. To deselect all objects
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.
Read-only. Preferences for the Illustrator
application.
startup presets
tracing presets
user interaction level
version
list of Unicode text Read-only. The list of preset
list of Unicode text Read-only. The list of preset
Valid values:
Unicode text Read-only. The version of the Adobe

application commands

activate convert sample color copy cut do script delete workspace get preset file of get scriptable help group launch
interact with all interact with local interact with self never interact
printing-options names available for use.
tracing-options names available for use.
The level of interaction with the user that is allowed when handling script commands. Default:
interact with all
Illustrator application.
CHAPTER 1: AppleScript Objects application 13
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 selection.
cut, copy and paste commands, which act on the current
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
-- 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
activate command.
CHAPTER 1: AppleScript Objects artboard, artboards 14

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

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 appearance
colors
convert text to outlines
export file format
export option
export selected art only
raster format
scale lineweights boolean
boolean
Valid values:
max 8 colors max 16 colors max 256 colors true colors
boolean
Valid values:
dxf DWG
Valid values:
maintain appearance maximize editability
boolean
Valid values:
PNG raster JPEG raster
If true, alter paths if needed to maintain appearance. Default:
false
Number of colors to export into AutoCAD file.
If true, convert text to outlines. Default: false
The format to export to. Default: DWG
Whether to preserve appearance or editability during export. Default:
maximize editability
If true, export only selected artwork. Default:
false
Format in which to export raster art.
If true, scale line weights by the same scaling factor as the rest of the drawing. Default:
false
scale unit
scale ratio number (double)
AutoCAD version
Valid values:
autocad points autocad picas autocad inches autocad millimeters autocad centimeters autocad pixels
Valid values:
AutoCAD release 13 AutoCAD release 14 AutoCAD release 15 AutoCAD release 18 AutoCAD release 21 AutoCAD release 24
Measurement units from which to map.
Ratio by which to scale output.
The release of AutoCAD to export to. Default:
AutoCAD release 24
CHAPTER 1: AppleScript Objects AutoCAD options 16

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
container
global scale option
global scale percent
merge layers boolean
scale lineweights boolean
scale ratio integer
scale unit
object reference Read-only. A reference to the document that
Valid values:
original size fit artboard scale by value
integer
Valid values:
autocad points autocad picas autocad inches autocad millimeters autocad centimeters autocad pixels
If true, center the artwork that is created on the artboard. Default:
true
contains this object.
How to scale the drawing on import. Default: fit
artboard
The value when global scale option is scale by
value, expressed as a percentage. Range: 0.0 to
100.0 Default: 100.0
If true, the layers of the artwork are merged. Default:
false
If true, scale line weights by the same factor as the rest of the drawing. Default:
false
The ratio by which to scale while mapping units. Default: 1.0
The unit to map to. Default: autocad millimeters
selected layout name
Unicode text Name of the layout in the drawing to import.
CHAPTER 1: AppleScript Objects brush, brushes 17

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
class
container
default type
index integer
name
properties record
type class Read-only. The best type for the brush object’s value. Always
type class Read-only. The object’s class, which is brush.
object reference Read-only. A reference to the document that contains this brush.
type class Read-only. The default type for the brush object, which is
Unicode text The name of this brush.

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
returns
reference.
reference.
Read-only. The index of this brush.
All properties of this object returned as a record.
-- 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 18
-- 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 19

character

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

character object elements

Elements Refer to by
character, insertion point, word, line, paragraph, and text classes. The properties and
character has a
character style
name, numeric index, range of elements, before/after another element, satisfying a test
character
insertion point
line
paragraph style
numeric index, range of elements, before/after another element, satisfying a test
numeric index, range of elements, before/after another element, satisfying a test
numeric index, range of elements, before/after another element, satisfying a test
name, numeric index, range of elements, before/after another element, satisfying a test
paragraph
text
word
numeric index, range of elements, before/after another element, satisfying a test
numeric index, range of elements, before/after another element, satisfying a test
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
alignment
Valid values:
bottom center icf bottom icf top roman baseline top
The amount of inter-glyph spacing added to the right side of the glyph in Japanese text (in thousandths of an em).
The character alignment type.
CHAPTER 1: AppleScript Objects character 20
Property Value type What it is
alternate glyphs
auto leading boolean
baseline direction
baseline position Valid values:
baseline shift real
Valid values:
default expert full width half width jis78 jis83 proportional width quarter width third width traditional jis90 jis04
Valid values:
standard Tate Chu Yoko vertical rotated
normal subscript superscript
Specifies which kind of alternate glyphs to use.
If true, use automatic leading.
The Japanese text baseline direction.
The baseline position of text.
The amount of shift (in points) of the text baseline.
best type
capitalization
character offset integer
class
connection forms boolean
container reference
contents
contextual ligature
default type
discretionary ligature
type class Read-only. The best type for the
Valid values:
all caps all small caps normal small caps
type class Read-only. The object’s class.
Unicode text The text content.
boolean
type class Read-only. The default type for the
boolean
object’s value.
Specifies whether the text is normal, all uppercase, all small caps, or a mix of small caps and lowercase.
Offset of the first character.
If true, use the OpenType® connection forms.
Read-only. The object’ s container.
If true, use the contextual ligature.
object’s value.
If true, use the discretionary ligature.
CHAPTER 1: AppleScript Objects character 21
Property Value type What it is
figure style
fill color color info
fractions boolean
horizontal scale real
index integer
italics boolean
kerning integer
kerning method
Valid values:
default proportional proportional oldstyle tabular tabular oldstyle
Valid values:
none Auto Optical metricsromanonly
Specifies the figure style to use in an OpenType font.
The color of the text fill.
If true, use OpenType fractions.
The horizontal scaling factor for the character.
Read-only. The index of this instance of the object.
If true, the Japanese OpenType supports italics.
Controls the spacing between two characters, in thousandths of an em space.
The type of automatic kerning method to use.
CHAPTER 1: AppleScript Objects character 22
Property Value type What it is
language
Valid values:
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
The language.
leading real
length integer
ligature boolean
no break boolean
ordinals boolean
ornaments boolean
overprint fill boolean
overprint stroke boolean
properties record
The amount of space between two lines of text, in points.
The length (in characters). Minimum: 0
If true, use the ligature.
If true, no break is allowed.
If true, use the OpenType ordinals.
If true, use the OpenType ornaments.
If true, overprint the fill of the text.
If true, overprinting of the stroke of the text is allowed.
All properties of this object returned as a record.
CHAPTER 1: AppleScript Objects character 23
Property Value type What it is
proportional metrics
rotation real
selection text or list of text
size real
story story
strike through boolean
stroke color color info
stroke weight real
stylistic alternates
swash boolean
TCY horizontal integer
boolean
boolean
If true, Japanese OpenType supports proportional fonts.
The character rotation angle in degrees.
Read-only. The selected text.
The font size in points.
Read-only. The story that contains the object.
If true, characters use strike-through style.
The color of the text stroke.
Line width of stroke.
If true, use OpenType stylistic alternates.
If true, use the OpenType swash character.
The Tate-Chu-Yoko horizontal adjustment in points.
TCY vertical integer
text font text font
titling boolean
tracking integer
Tsume real
underline boolean
vertical scale real
warichu characters after break
warichu characters before break
long
long
The Tate-Chu-Yoko vertical adjustment in points.
The text font.
If true, use the OpenType titling alternates.
The tracking or range kerning amount in thousandths of an em.
The percentage of space reduction around a Japanese character.
If true, characters use underline style.
Character vertical scaling factor, expressed as a percentage (100 is 100%).
How the characters in Wari-Chu text (an inset note in Japanese text) are divided into two or more lines.
How the characters in Wari-Chu text (an inset note in Japanese text) are divided into two or more lines.
CHAPTER 1: AppleScript Objects character 24
Property Value type What it is
warichu enabled boolean
warichu gap integer
warichu justification
warichu lines integer
warichu scale real
Valid values:
auto justify center full justify last line center full justify full justify last line left full justify last line right left right

character object commands

apply character style change case count delete deselect duplicate exists make move select
If true, Wari-Chu is enabled.
The Wari-Chu line gap in points.
The Wari-Chu justification.
The number of Wari-Chu (multiple text lines fit into a space meant for one) lines.
The Wari-Chu scale.

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 25

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 26

character style, character styles

A named style that specifies character attributes.
N
OTE: 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
aki right real
alignment
alternate glyphs
alternate ligature
Valid values:
bottom center icf bottom icf top roman baseline top
Valid values:
default Traditional Expert jis78 jis83 half width third width quarter width full width proportional width jis90 jis04
boolean
The left aki (in thousandths of an em).
The right aki (in thousandths of an em).
The character alignment type.
The alternate glyphs form.
If true, use the alternate ligature.
auto leading boolean
baseline direction
baseline position
baseline shift real
best type
Valid values:
standard Tate Chu Yoko vertical rotated
Valid values:
normal subscript superscript
type class Read-only. The best type for the object’s
If true, use automatic leading.
The Japanese text baseline direction.
The baseline position of text.
The amount of shift (in points) of the text baseline.
value.
CHAPTER 1: AppleScript Objects character style, character styles 27
Property Value type What it is
capitalization
class
connection forms boolean
contextual ligature
container reference
default type
discretionary ligature
figure style
Valid values:
all caps all small caps normal small caps
type class Read-only. The object’s class.
boolean
type class Read-only. The default type for the
boolean
Valid values:
default proportional proportional oldstyle tabular tabular oldstyle
The case of the text.
If true, use the OpenType connection forms.
If true, use the contextual ligature.
Read-only. The object’s container.
object’s value.
If true, use the discretionary ligature.
Specifies which figure style to use in the OpenType font.
fill color color info
fractions boolean
horizontal scale real
index integer
italics boolean
kerning method
Valid values:
auto none optical metricsromanonly
The color of the text fill.
If true, use the OpenType fractions.
Character horizontal scaling factor expressed as a percentage (100 = 100%).
Read-only. The index of this instance of the object.
If true, the Japanese OpenType supports italics.
The automatic kerning method to use.
CHAPTER 1: AppleScript Objects character style, character styles 28
Property Value type What it is
language
Valid values:
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
The language.
leading real
ligature boolean
name
OpenType position
ordinals boolean
ornaments boolean
overprint fill boolean
Unicode text The character style’s name.
Valid values:
default denominator numerator subscript superscript
The amount of space between two lines of text, in points.
If true, use the ligature.
The OpenType font baseline position.
If true, use the OpenType ordinals.
If true, use the OpenType ornaments.
If true, the fill of the text should be overprinted.
CHAPTER 1: AppleScript Objects character style, character styles 29
Property Value type What it is
overprint stroke boolean
properties record
proportional metrics
rotation real
size real
strike through boolean
stroke color color info
stroke weight real
stylistic alternates
swash boolean
TCY horizontal integer
boolean
boolean
If true, the stroke of the text should be overprinted.
All properties of this object returned as a record.
If true, the Japanese OpenType font supports proportional glyphs.
The character rotation angle in degrees.
The font size in points.
If true, characters use strike-through style.
The color of the text stroke.
The line width of the stroke.
If true, use the OpenType stylistic alternates.
If true, use the OpenType swash glyph.
The Tate-Chu-Yoko horizontal adjustment in points.
TCY vertical integer
text font text
titling boolean
tracking integer
Tsume real
underline boolean
vertical scale real
warichu characters after break
warichu characters before break
integer
integer
The Tate-Chu-Yoko vertical adjustment in points.
The text font.
If true, use the OpenType titling alternates.
The tracking or range kerning amount in thousands of an em.
The percentage of space reduction around a Japanese character (100 = 100%).
If true, characters use underline style.
The character vertical scaling factor expressed as a percentage (100 = 100%).
How the characters in Wari-Chu text (an inset note in Japanese text) are divided into two or more lines.
How the characters in Wari-Chu text (an inset note in Japanese text) are divided into two or more lines.
warichu enabled boolean
If true, Wari-Chu is enabled.
CHAPTER 1: AppleScript Objects character style, character styles 30
Property Value type What it is
warichu gap integer
warichu justification
warichu lines integer
Valid values:
auto justify center full justify last line center full justify full justify last line left full justify last line right left right
The Wari-Chu line gap.
The Wari-Chu justification.
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 31

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.
color space of a document is RGB and you specify the color value for a page item in that document
If the
CMYK color info, Illustrator translates the CMYK color specification into an RGB color specification.
using 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
magenta real
yellow real
black real
The cyan color value. Range: 0.0 to 100.0. Default: 0.0.
The magenta color value. Range: 0.0 to 100.0. Default: 0.0.
The yellow color value. Range: 0.0 to 100.0. Default: 0.0.
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 32

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 33

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
name
profile kind
Valid values:
absolute colorimetric perceptual relative colorimetric saturation
The color management intent type. Default:
relative colorimetric
Unicode text The color management profile name.
Valid values:
custom profile oldstyle profile printer profile source profile
The color management profile mode. Default:
source profile
CHAPTER 1: AppleScript Objects color separation options 34

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

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 36

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 37

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
fit to page boolean
horizontal scale real
orientation
position
tiling
Valid values:
landscape portrait reverse landscape reverse portrait auto rotate
Valid values:
bottom bottom left bottom right center left right top top left top right
Valid values:
full pages imageable areas single full page
If true, flip the artwork horizontally. Default: false
If true, proportionally scale the artwork to fit on media. Default:
false
The horizontal scaling factor. 100.0 = 100%. Range: 1.0 to 10000.0. Default: 100.0.
The artwork orientation. Default: portrait
The artwork position on media. Default: center
The page tiling mode. Default: 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 38

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
class
container
type class Read-only. The best type for the dataset’s value. Always returns
type class Read-only. The object’s class, which is dataset.
object reference
default type
index integer
name
properties record
type class Read-only. The default type for the data set. Always returns
Unicode text The name of the dataset.

dataset object commands

count delete display exists make update
reference.
Read-only. A reference to the art item that contains this data set.
reference.
Read-only. The index of this data set in the art item.
All properties of this object returned as a record.

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 39
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 40

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 have analogous default properties.
fill color and stroked that
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
brush
character style
compound path item
dataset
gradient
graph item
graphic style
group item
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
layer
legacy text item
mesh item
non native item
page item
paragraph style
path item
pattern
placed item
plugin item
raster item
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
CHAPTER 1: AppleScript Objects document, documents 41
Element Refer to by
spot
story
swatch
swatch group
symbol
symbol item
tag
text frame
variable
view
name, index, before/after, range, test
index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
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
color space
crop marks rectangle
crop style
current dataset dataset
current layer layer
current view view
default fill color color info
default fill overprint
default filled boolean
default stroke cap
type class Read-only. The object’s class, which is document.
Valid values:
RGB CMYK
Valid values:
standard Japanese style
boolean
Valid values:
butted rounded projecting
Read-only. The color specification system to use for this document’s color space.
The boundary of the document’s cropping box for output.
The style of the document’s cropping box.
The currently active dataset.
The active layer in the document.
Read-only. The document’s current view.
The color to fill new paths if default filled is true.
If true, the art beneath a filled object should be overprinted by default.
If true, a new path should be filled.
Default type of line capping for paths created.
CHAPTER 1: AppleScript Objects document, documents 42
Property Value type What it is
default stroke color color info
default stroke dash offset
default stroke dashes
real
list of real numbers
default stroke join
default stroke miter limit
default stroke overprint
Valid values:
mitered rounded beveled
real
boolean
The stroke color for new paths if default stroked is
true.
The default distance into the dash pattern at which the pattern should be started for new paths.
Default 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.
Default type of joints in new paths.
When default stroke join is set to mitered, this 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.
If true, the art beneath a stroked object should be overprinted by default.
default stroke width real
default stroked boolean
default type
file path
geometric bounds rectangle
height real
index integer
inks list of ink
Kinsoku set
modified boolean
type class Read-only. The default type for the document object’s
file specification Read-only. The file associated with the document,
list of Unicode text Read-only. The Kinsoku set of characters that cannot
Default width of stroke for new paths.
If true, new paths should be stroked.
value. Always returns
reference.
which includes the complete path to the file.
Read-only. The object’s bounds excluding the stroke width.
Read-only. The height of the document, calculated from the geometric bounds.
Read-only. The position of this document in the stacking order of all open documents. The current (frontmost) document is always
document 1.
Read-only. The list of inks in this document.
begin or end a line of Japanese text.
If true, the document has been modified since the last save.
CHAPTER 1: AppleScript Objects document, documents 43
Property Value type What it is
Mojikumi set
name
output resolution real
page origin list
print tiles boolean
properties record
raster effect settings
ruler origin list
ruler units
list of Unicode text Read-only. A list of names of predefined Mojikumi
Unicode text Read-only. The document’s name (not the complete
raster effect options
Valid values:
unknown inches centimeters points picas millimeters qs pixels
sets which specify the spacing for the layout and composition of Japanese text.
file path to the document).
Read-only. The current output resolution for the document in dots per inch (dpi).
The zero-point of the page in the document without margins, relative to the overall height and width.
Read-only. If true, this document should print as tiled output.
All document’s properties returned in a single record. Properties that are individually read-only remain so in this record.
The document’s raster effect settings.
The zero-point of the rulers in the document relative to the bottom left of the document.
Read-only. The default units for the rulers in the document.
selection
list of object references
show placed images boolean
split long paths boolean
stationery boolean
tile full pages boolean
use default screen boolean
variables locked boolean
The list of references to the objects in this document’s current selection.
Read-only. If true, the placed images should be displayed in the document.
Read-only. If true, long paths should be split when printing.
Read-only. If true, the document should be saved as a stationery file.
Read-only. If true, full pages should be tiled when printing this document.
Read-only. If true, use the printer’s default screen when printing this document.
If true, the variables are locked.
CHAPTER 1: AppleScript Objects document, documents 44
Property Value type What it is
visible bounds rectangle
width real
XMP string
Unicode text The XMP metadata packet associated with this

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 hide perspective grid import character styles import paragraph styles import PDF preset import perspective grid preset import print preset import variables make open print rasterize save select objects on active artboard select perspective preset set perspective active plane show perspective grid
Read-only. The object’s visible bounds, including stroke width of any objects in the illustration.
Read-only. The width of this document, calculated from the geometric bounds.
document.

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 45

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 document in the Finder.
file path property of the active document to open the folder containing the Illustrator
-- 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 46

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
artboardRowsOrCols long
artboardSpacing double
color mode
documentBleedLink
documentBleedOffsetR ect
Valid values:
grid by row grid by column row column rl grid by row rl grid by col rl row
Valid values:
CMYK RGB
Boolean The document link for bleed
Rectangle The document bleed offset
The layout of artboards in the new document. Default:
grid by row
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
The spacing between artboards in the new document. Default: 20.0
The color space for the new document. Default:
CMYK
values
rectangle
document units
height real
numArtboards long
Valid values:
centimeters inches millimeters picas points qs pixels unknown
The ruler units for the new document. Default:
points
The height in document points. Default: 792.0
The number of artboards for the new document. Range: 1 to 100. Default: 1
CHAPTER 1: AppleScript Objects document preset 47
Property Value type What it is
preview mode
raster resolution
title
transparency grid
width real
Valid values:
default preview pixel preview overprint preview
Valid values:
screen resolution medium resolution high resolution
Unicode text The document title. Default:
Valid values:
hide transparency grids light color transparency grids medium color transparency grids dark color transparency grids red color transparency grids orange transparency grids green transparency grids blue transparency grids purple transparency grids
The preview mode for the new document. Default:
default preview
The raster resolution for the new document. Default:
Untitled
screen resolution
The transparency grid color for the new document. Default:
grids
hide transparency
The width in document points. Default: 612.0
CHAPTER 1: AppleScript Objects ellipse 48

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 be specified at the time of creation.

ellipse object properties

Property Value type What it is
path items, such as fill color and note, can also
bounds
inscribed boolean
reversed boolean
list of points Write-once. The bounds of the ellipse.

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
Write-once. If true, the ellipse path should be inscribed (drawn inside the rectangle described by the bounds).
Write-once. If true, the ellipse path is reversed. Default: false
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 49
-- 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 50

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. to get or create an

EPS save options object properties

Property Value type What it is
EPS save options can only be used in conjunction with the save command. It is not possible
EPS save options object.
artboard range string
CMYK PostScript boolean
compatibility
compatible gradient printing
Valid values:
Illustrator 3 Illustrator 8 Illustrator Illustrator 10 Illustrator 11 Illustrator Illustrator 13 Illustrator 14 Illustrator15 Illustrator16 Illustrator17 Illustrator19 Japanese
boolean
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
Optional. If true, the file should be saved as CMYK PostScript. Default:
false
Optional. The Illustrator file format version to create. Default:
Illustrator 19
9
12
3
Optional. If true, create a raster item of the gradient or gradient mesh so that PostScript Level 2 printers can print the object.
embed all fonts boolean
embed linked files boolean
flatten output
Valid values:
preserve paths preserve appearance
Optional. If true, fonts used in the EPS file should be embedded in the file (version 7 or later). Default:
false
Optional. If true, linked image files are to be included in the saved document. Default:
false
Optional. How transparency should be flattened for file formats before Illustrator 9. Default:
preserve appearance
CHAPTER 1: AppleScript Objects EPS save options 51
Property Value type What it is
included document thumbnails
overprint
PostScript
preview
save multiple artboards
boolean
Valid values:
discarded preserved
Valid values:
level 2 level 3
Valid values:
none BW TIFF color TIFF transparent color TIFF
boolean
Optional. If true, the thumbnail image of the EPS artwork should be included. Default:
true
Optional. The overprint style. Default:
preserved
Optional. Specifies the PostScript level to use when saving the file (level 1 is valid for file format version 8 or older). Default:
level 3
Specifies the format for the EPS preview image. Default:
color TIFF
Optional. If true, all artboards or range of 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 CC 2015 compatibility. The files are save to the folder specified in the parameter. Note that the
class property is specified in the record to ensure that Illustrator can determine
the save option class.
destinationFolder
-- 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 52
end if
end ExportFilesAsEPS
CHAPTER 1: AppleScript Objects Flash export options 53

Flash export options

You can supply a number of options when exporting a document as Macromedia® Flash™ (SWF). 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 Flash (SWF) file. Flash export options can be supplied only in conjunction with the export command. It is not possible to get or create a
All properties are optional.

Flash export options object properties

Property Value type What it is
Flash export options object.
art clipping
artboard range string
background color
background layers
blend animation
compressed
convert text to outlines
Valid values:
output art bounds output artboard bounds output croprect bounds
RGB color info
list of layers
Valid values:
in build in sequence none
boolean
boolean
How the arts should be clipped during the output. Default:
output art bounds
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
The background color.
Layers to be included as the static background in all exported Flash frames.
How the blend art objects are animated when exported to Flash frames. Default:
none
If true, the exported file should be compressed. Default:
false
If true, all text should be converted to outlines. Default:
false
curve quality
export all symbols
export style
integer
boolean
Valid values:
Flash file layers to frames layers to files layers to symbols Artboards to Files
How much curve information should be preserved. Range: 0 to 10. Default:
7
If true, export all symbols defined in the palette. Default:
false
How the Flash file should be created Default:
Flash file
CHAPTER 1: AppleScript Objects Flash export options 54
Property Value type What it is
export version
Flash Playback Security
frame rate real
image format
include metadata
JPEG method
Valid values:
SWF version 1 SWF version 2 SWF version 3 SWF version 4 SWF version 5 SWF version 6 SWF version 7 SWF version 8 SWF version 9
Valid values:
flash playback local access flash playback network access
Valid values:
lossless lossy
boolean
Valid values:
optimized standard
The version of the exported SWF file. Default:
SWF version 9
Security access for playback. Default:
flash playback local access
When exporting layers to Flash frames Range: 0.01 to 120.0. Default: 12.0
How the images in the exported file should be compressed. Default:
lossless
If true, include minimal XMP metadata in the SWF file. Default:
false
Specifies which method to use. Default:
standard
JPEG quality integer
layer order
looping boolean
preserve appearance
read only boolean
replacing
resolution real
Valid values:
bottom up top down
boolean
Valid values:
yes no ask
Level of compression. Range: 0 to 10, Default:
3
The order in which layers should be exported to Flash frames. Default:
bottom up
If true, the Flash file should be set to loop when run. Default:
false
If true, preserve appearance. If false, preserve editability. Default:
false
If true, export as read only file. Default:
false
If a file with the same name already exists, should it be replaced. Default:
ask
Pixels per inch. Range: 72 to 2400. Default:
72
CHAPTER 1: AppleScript Objects Flash export options 55
Property Value type What it is
save multiple artboards
textkerning boolean
boolean
If true, all artboards or range of artboards are saved. Default:
false
If true, ignore kerning information in text objects. Default:
false
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
convert strokes to outlines boolean
convert text to outlines boolean
flattening balance integer
gradient resolution real
If true, complex regions are clipped. Default: false
If true, all strokes are converted to outlines. Default:
false
If true, all text items are converted to outlines. Default:
false
The flattening balance. Range: 0 to 100; Default: 100
The gradient resolution in dots per inch. Range: 1.0 to 9600.0; Default: 300.0
overprint
rasterization resolution real
Valid values:
discard preserve
Overprint choice. Default: preserve
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
font substitution kind
Valid values:
complete none subset
Valid values:
device substitution oblique substitution tint substitution
The font download mode. Default: subset
The font substitution policy. Default:
oblique 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
class
container
type class Read-only. The best type for the object’s value.
type class Read-only. The object’s class.
object reference
convert text to outlines boolean
default type
import single page boolean
page long
properties record
type class Read-only. The default type for the object’s value.
Read-only. A reference to the document that contains this object.
If true, converts all text to outlines. Default:
false
If true, imports only the page specified in the page property. Default:
true
The number of the page to import when opening a multipage document.
NOTE: Valid only when import single page is true.
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
blends policy
downsample linked images
filters policy
fxg version
gradients policy
include unused symbols
Valid values:
autoConvert blends rasterize blends
boolean
Valid values:
expand filters keep filters editable rasterize filters
Valid values:
version 1.0 version 2.0
Valid values:
autoConvert gradients keep gradients editable
boolean
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
The policy used by FXG to expand blends. Default:
autoConvert blends
If true, linked images are downsampled (at 72 dpi). Default:
false
The policy used by FXG to preserve filters. Default:
keep filters editable
The version of the FXG file format to create. Default:
version 2.0
The policy used by FXG to preserve gradients. Default:
autoConvert gradients
If true, unused symbols are included. Default:
false
preserve editing capabilities
save multiple artboards
text policy
boolean
boolean
Valid values:
outline text keep text editable rasterize text autoConvert text
If true, the editing capabilities of FXG are preserved. Default:
true
If true, all artboards or range of artboards are saved. Default:
false
The policy used by FXG to preserve text. Default:
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. possible to get or create a

GIF export options object properties

Property Value type What it is
GIF export options can only be supplied in conjunction with the export command. It is not
GIF export options object.
antialiasing boolean
artboard clipping boolean
color count integer
color dither
color reduction
dither percent integer
horizontal scaling real
Valid values:
none diffusion pattern dither noise
Valid values:
selective adaptive perceptual web
If true, the resulting image should be anti-aliased. Default:
true
If true, the resulting image should be clipped to the artboard. Default:
false
The number of colors in the exported color table. Range: 2 to 256. Default: 128
The method used to dither colors. Default: diffusion
The method used to reduce the number of colors in the document. Default:
selective
How much the colors should be dithered. Range: 0 to
100. Default: 88
The horizontal scaling factor to apply to the resulting image. Range: 0.0 to 100.0. Default: 100.0
information loss integer
interlaced boolean
matte boolean
matte color RGB color info
saving as HTML boolean
The level of information loss during compression (as a percentage). Range: 0 to 100. Default: 0
If true, the resulting image should be interlaced. Default:
false
If true, the artboard should be matted with a color. Default:
true
The color to use when matting the artboard.
Default:
white
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
vertical scaling real
If true, the resulting image uses transparency. Default:
true
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 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)
end ExportFilesAsGIF
class property is specified in the record to ensure that Illustrator can determine the export
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
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
class
container
default type
entire gradient list of gradient
gradient type
index integer
type class Read-only. The best type for the gradient object’s value.
type class Read-only. The object’s class, which is gradient.
object reference Read-only. A reference to the document that contains this
type class Read-only. The default type for the gradient object’s
stop info
Valid values:
linear radial
Always returns
reference.
gradient.
value. Always returns
reference.
All gradient stops in the gradient.
The type of the gradient.
Read-only. The position of this gradient in the application.
name
properties record
Unicode text The gradient’s name.

gradient object commands

count delete duplicate exists make
All properties of this object returned as a record.
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
gradient
object reference A reference to the gradient object that defines the gradient to
The gradient vector angle (in degrees). Default: 0.0
use in this color definition.
hilite angle real
hilite length real
length real
matrix matrix
The gradient highlight vector angle in degrees. Default: 0.0
The gradient highlight vector length. Default: 0.0
The gradient vector length.
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
class
color color info
container
type class Read-only. The object’s class, which is gradient stop.
The color linked to this gradient stop.
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
index integer
midpoint real
Read-only. The position of this gradient stop in the gradient.
The midpoint of the blend between this stop’s and the next stop’s colors. Range: 13.0 to 87.0
properties record
ramp point real
stop opacity double
All properties of this object returned as a record.
The location of the color in the gradient. Range: 0.0 to 100.0
The opacity value for the gradient stop. Range: 0.0 to 100.0

gradient stop object commands

reference.
reference.
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
entire gradient property. The following applies when creating a gradient from a list of gradient
in the 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
midpoint real
ramp point real
stop opacity Double
The color linked to this gradient stop.
The midpoint of the blend between this stop’s and the next stop’s colors. Range: 13.0 to 87.0. Default: 50.0
The location of the color in the gradient as a percentage. Range: 0.0 to 100.0. Default: 0.0
The opacity value for the gradient stop. Range: 0.0 to 100.0. Default: 100.0
gradient stop info records

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 binding. Illustrator automatically sets the type to
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
content variable before
graph.
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 style object properties

Property Value type What it is
graphic styles.
best type
type class Read-only. The best type for the graphic style object’s value.
Always returns
class
container
default type
index integer
name
properties record
type class Read-only. The object’s class, which is graphic style.
object reference Read-only. A reference to the document that contains this
graphic style.
type class Read-only. The default type for the graphic style object, which is
reference.
Read-only. The index of this graphic style.
Unicode text The name of this graphic style.
All properties of this object returned as a record.

graphic style object commands

apply count delete exists

Applying a graphic style

reference.
-- 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 group item, group items 72

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 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
with data parameter of the make command. The resulting group will
compound path item
graph item
group item
legacy text item
mesh item
non native item
page item
path item
placed item
plugin item
raster item
symbol item
text frame
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
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
properties record
If true, the group item is clipped to the clipping mask.
All properties of this object returned as a record.
CHAPTER 1: AppleScript Objects group item, group items 73

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 74

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 75

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 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
AIPreferenceKeys.h header
AutoCAD file options AutoCAD options
best type
class type
default type
FreeHand file options FreeHand options
properties record
PDF file options PDF options
Photoshop file options Photoshop
type class Read-only. The best type for the object’s value.
type class Read-only. The object’s class.
type class Read-only. The default type for the object's value.
options
Read-only. Options to use when opening or placing an AutoCAD file.
Read-only. Options to use when opening or placing a FreeHand file.
All properties of this object returned as a record.
Read-only. Options to use when opening or placing a PDF file.
Read-only. Options to use when opening or placing a Photoshop file.
CHAPTER 1: AppleScript Objects Illustrator save options 76

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
compatibility
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
Valid values:
Illustrator 8 Illustrator 9 Illustrator 10 Illustrator 11 Illustrator 12 Illustrator 13 Illustrator 14 Illustrator 15 Illustrator 16 Illustrator17 Illustrator18 Japanese version 3
Specifies the version of the Illustrator file format to create. Default:
Illustrator 19
compressed boolean
embed ICC profile boolean
embed linked files boolean
flatten output
font subset threshold
Valid values:
preserve paths preserve appearance
real
If true, the saved file should be compressed. Only for Illustrator 10 or later. Default:
true
If true, the document’s ICC profile should be embedded in the saved file. Only for Illustrator 9 or later. Default:
false.
If true, include linked image files in the saved document. Only for Illustrator 7 or later. Default:
false.
How should transparency be flattened for file formats before Illustrator 9 or later. Default:
preserve appearance.
Include a subset of fonts when less than this 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 77
Property Value type What it is
PDF compatible boolean
save multiple artboards
boolean
If true, the file should be saved as a PDF compatible file. Only for Illustrator 10 or later.
If true, all artboards or range of the artboards are saved. Valid for Illustrator 13 or earlier.
CHAPTER 1: AppleScript Objects Illustrator save options 78

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 79

image capture options

Options for image capture, used with the hide perspective grid command. All properties are optional.

ImageCaptureOptions properties

Property Value type What it is
antialiasing boolean
matte boolean
matte color RGB color info
resolution real
transparency boolean
If true, the image result is anti-aliased. Default: false
If true, the artboard is matted with a color. Default: false
The color to use for the artboard matte. Default: white
The resolution of the captured image file in points-per-inch (PPI), in the range [72.0 ... 2400.0]. Default: 150
If true, the image result is transparent. Default: false
CHAPTER 1: AppleScript Objects ink 80
ink
Specifies the properties of the inks to be used in printing the document.

ink object properties

Property Value type What it is
name
properties ink properties
Unicode text The ink’s name.
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 81

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
custom color list of real
numbers
density real
dot shape
frequency real
kind
printing status
trapping
Unicode text The dot shape name.
Valid values:
black ink custom ink cyan ink magenta ink yellow ink
Valid values:
convert ink disable ink enable ink
Valid values:
ignore opaque normal opaque transparent
The ink’s screen angle in degrees. Range: -360 to 360
The custom color.
The neutral density. Minimum: 0.0
The ink’s frequency. Range: 0.0 to 1000.0
The ink type.
The ink printing status.
The trapping type.
trapping order integer
The order of trapping for the ink. Range: 1 to 4 for CMYK
CHAPTER 1: AppleScript Objects insertion point 82

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
character offset indicates the location of the insertion point and length is 0. This subclass does not
InsertionPoints collection. This is a text object in which
define any additional properties.

insertion point object elements

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

insertion point object properties

Property Value type What it is
best type
class
container reference
default type
index integer
type class Read-only. The best type for the object’s value.
type class Read-only.The object’s class.
Read-only.The object’s container.
type class Read-only.The default type for the object’s value.
Read-only.The index of this instance of the object.
CHAPTER 1: AppleScript Objects insertion point 83
Property Value type What it is
properties record
story story
All properties of this object returned as a record.
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 84

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
bitmap resolution real
collate boolean
copies integer
designation
file path
name
print all artboards
print area
Valid values:
all layers visible layers visible printable layers
file specification The file to which to print.
Unicode text The print job name.
boolean
Valid values:
artboard bounds artwork bounds
The artboard range to be printed if print all
artboards is false. Default: 1-
The bitmap resolution. Minimum: 0.0. Default: 0.0
If true, collate print pages are collated. Default:
false
The number of copies to print. Minimum: 1. Default: 1
The layers/objects to be printed. Default:
visible printable layers
Indicates whether to print all artboards. Default:
true
The printing bounds. Default:
artboard bounds
print as bitmap boolean
reverse pages boolean
If true, the job is printed as a bitmap image. Default:
false
If true, the pages are printed in reverse order. Default:
false
CHAPTER 1: AppleScript Objects job options 85

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 86

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. not possible to get or create a

JPEG export options object properties

Property Value type What it is
JPEG export options can only be supplied in conjunction with the export command. It is
JPEG export options object.
antialiasing boolean
artboard clipping boolean
blur real
horizontal scaling real
matte boolean
matte color RGB color info
optimization boolean
quality integer
saving as HTML boolean
If true, the resulting image should be anti-aliased. Default:
true
If true, the resulting image should be clipped to the artboard. Default:
false
The amount of blurring to apply to the resulting image. Range: 0.0 to 2.0. Default: 0.0
The percent horizontal scaling factor to apply to the resulting image. Range: 0.0 to 100.0. Default: 100.0
If true, the artboard should be matted with a color. Default:
true
The color to use when matting the artboard. Default:
white
If true, the resulting image should be optimized for web viewing. Default:
true
The quality of the resulting image. Range: 0 to 100. Default: 30
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 87

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 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"
end tell
end repeat end if
end ExportFilesAsJPEGMedium
class property is specified in the record to ensure that Illustrator can determine the
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
CHAPTER 1: AppleScript Objects Lab color info 88

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
b real
l real
The a (red-green) color value. Range -128.0–128.0. Default: 0.0
The b (yellow-blue) color value. Range -128.0–128.0. Default: 0.0
The l (lightness) color value. Range -128.0–128.0. Default: 0.0
CHAPTER 1: AppleScript Objects layer, layers 89

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 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
layer object or as elements of the document object. When accessing page
compound path item
graph item
group item
layer
legacy text item
mesh item
non native item
page item
path item
placed item
plugin item
raster item
symbol item
text frame
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
CHAPTER 1: AppleScript Objects layer, layers 90

layer object properties

Property Value type What it is
best type
blend mode
class
color RGB color info
container
type class Read-only. The best type for the layer object’s value. Always
Valid values:
color blend color burn color dodge darken difference exclusion hard light hue lighten luminosity multiply normal overlay saturation blend screen soft light
type class Read-only. The layer object’s class, which is layer.
object reference Read-only. A reference to the document that contains this
returns
reference.
The mode used when compositing an object. An object is considered composited when its opacity is set to less than
100.0 (100%).
The layer’s selection mark color.
layer.
default type
dim placed images
has selected artwork
index integer
isolated boolean
knockout
locked boolean
name
type class Read-only. The default type for the layer object’s value.
boolean
boolean
Valid values:
unknown disabled enabled inherited
Unicode text The name of this layer.
Always returns
reference.
If true, placed images are to be rendered as dimmed in this layer.
If true, one or more objects in this layer selected are selected; setting this property to
false deselects all
objects in the layer.
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.
If true, this object is isolated
Is this object used to create a knockout.
If true, the layer is editable.
CHAPTER 1: AppleScript Objects layer, layers 91
Property Value type What it is
opacity real
preview boolean
printable boolean
properties record
sliced boolean
visible boolean

layer object commands

count delete duplicate exists make move

Move layers

The opacity of this layer, where 100.0 is completely opaque and 0.0 is completely transparent.
If true, this layer should be displayed using preview mode.
If true, this layer should be printed when printing the document.
All properties of this object returned as a record.
If true, slices should be preserved. Default: false
If true, this layer is visible.
-- 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 92

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 93

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 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
properties record
When true, the item has been updated to the current text format (a
All properties of this object returned as a record.

legacy text item object commands

convert
"x" through its
text frame). Read-only.
CHAPTER 1: AppleScript Objects line 94

line

A line or lines of text in a text frame. A document’s text can be accessed using the character, insertion
, word, line, paragraph, and text classes.
point
Lines of text cannot be created. When the create text lines as it reflows the text within the text frame.

line object elements

Elements Refer to by
character style
character
insertion point
line
paragraph style
paragraph
text
word
name, numeric index, range of elements, before/after another element, satisfying a test
numeric index, range of elements, before/after another element, satisfying a test
numeric index, range of elements, before/after another element, satisfying a test
numeric index, range of elements, before/after another element, satisfying a test
name, numeric index, range of elements, before/after another element, satisfying a test
numeric index, range of elements, before/after another element, satisfying a test
numeric index, range of elements, before/after another element, satisfying a test
numeric index, range of elements, before/after another element, satisfying a test
contents property of a text frame is modified, Illustrator will

line object properties

Property Value type What it is
aki left real
aki right real
alignment
Valid values:
The amount of inter-glyph space added to the left side of each glyph in Japanese text (in thousandths of an em).
The amount of inter-glyph spacing added to the right side of each glyph in Japanese text (in thousandths of an em).
The character alignment type.
bottom center icf bottom icf top roman baseline top
CHAPTER 1: AppleScript Objects line 95
Property Value type What it is
alternate glyphs
alternate ligature boolean
auto leading boolean
baseline direction
baseline position
Valid values:
default expert full width half width jis78 jis83 proportional width quarter width third width traditional jis90 jis04
Valid values:
standard Tate Chu Yoko vertical rotated
Valid values:
normal subscript superscript
Specifies the type of alternate glyphs.
If true, use the alternate ligature.
If true, use automatic leading.
The Japanese text baseline direction.
The baseline position of text.
baseline shift real
best type
capitalization
character offset integer
class
connection forms boolean
container reference
contents
contextual ligature
default type
type class Read-only. The best type for the object’s
Valid values:
all caps all small caps normal small caps
type class Read-only. The object’s class.
Unicode text The text content.
boolean
type class Read-only. The default type for the
The amount of shift (in points) of the text baseline.
value.
The case of the text.
Offset of the first character.
If true, use the OpenType connection forms.
Read-only. The object’s container.
If true, use the contextual ligature.
object’s value.
discretionary ligature
boolean
If true, use the discretionary ligature.
CHAPTER 1: AppleScript Objects line 96
Property Value type What it is
figure style
fill color color info
fractions boolean
horizontal scale real
index integer
italics boolean
kerning integer
kerning method
Valid values:
default proportional proportional oldstyle tabular tabular oldstyle
Valid values:
auto none optical
Specifies which figure style to use in an OpenType font.
The color of the text fill.
If true, use the OpenType fractions.
The character horizontal scaling factor expressed as a percentage (100 = 100%).
Read-only. The index of this instance of the object
If true, the Japanese OpenType support supports the italic style.
Controls the spacing between two characters, in thousandths of an em.
The automatic kerning method to use.
CHAPTER 1: AppleScript Objects line 97
Property Value type What it is
language
Valid values:
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
The language.
leading real
length integer
ligature boolean
no break boolean
OpenType position
ordinals boolean
ornaments boolean
overprint fill boolean
Valid values:
default denominator numerator subscript superscript
The amount of space between two lines of text, in points.
The length in characters. Minimum: 0
If true, use the ligature.
Whether break is allowed.
The OpenType baseline position.
If true, use the OpenType ordinals.
If true, use the OpenType ornaments.
If true, overprint the fill of the text.
CHAPTER 1: AppleScript Objects line 98
Property Value type What it is
overprint stroke boolean
properties record
proportional metrics
rotation real
selection list of text
size real
story story
strike through boolean
stroke color color info
stroke weight real
stylistic alternates
boolean
boolean
If true, the stroke of the text may be overprinted.
All properties of this object returned as a record.
If true, the proportional metrics in Japanese OpenType may be used.
The character rotation angle.
Read-only. The selected text.
Font size in points.
Read-only. The story that contains the line.
If true, characters use strike-through style.
The color of the text stroke.
line width of stroke.
If true, use the OpenType stylistic alternates.
swash boolean
TCY horizontal integer
TCY vertical integer
text font text
titling boolean
tracking integer
Tsume real
underline boolean
vertical scale real
warichu characters after break
integer
If true, use the OpenType swash.
The Tate-Chu-Yoko horizontal adjustment in points.
The Tate-Chu-Yoko vertical adjustment in points.
The text font.
If true, use the OpenType titling alternates.
The tracking or range kerning amount in thousandths of an em.
The percentage of space reduction around a Japanese character.
If true, characters use underline style.
Character vertical scaling factor.
How the characters in Wari-Chu text (an inset note in Japanese text) are divided into two or more lines.
warichu characters before break
integer
How the characters in Wari-Chu text (an inset note in Japanese text) are divided into two or more lines.
CHAPTER 1: AppleScript Objects line 99
Property Value type What it is
warichu enabled boolean
warichu gap integer
warichu justification
warichu lines integer
warichu scale real
Valid values:

line object commands

apply character style apply paragraph style change case count delete deselect duplicate exists make move select
If true, Wari-Chu is enabled.
The Wari-Chu line gap.
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
The number of Wari-Chu (multiple text lines fit into a space meant for one) lines.
The Wari-Chu scale.

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 100

matrix

A transformation matrix specification, used to transform the geometry of objects.
Matrices are used in conjunction with the You can generate an original matrix using the
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
mvalue_b real
mvalue_c real
mvalue_d real
mvalue_tx real
mvalue_ty real
Matrix property a.
Matrix property b.
Matrix property c.
Matrix property d.
Matrix property tx.
Matrix property ty.
transform command and as a property of a number of objects.
get identity matrix, get translation matrix,

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
Loading...