Macromedia Illustrator - CS6 User Guide

ADOBE® ILLUSTRATOR® CS6
ADOBE ILLUSTRATOR CS6
SCRIPTING REFERENCE:
VBSCRIPT
© 2012 Adobe Systems Incorporated. All rights reserved.
Adobe Illustrator CS6 Scripting Reference: VBScript
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, Flash, Illustrator, Macromedia, and Photoshop are either registered trademarks or trademarks of Adobe Systems Incorporated in the United States and/or other countries.
Macintosh is a trademark of Apple Computer, Incorporated, registered in the United States and other countries. Windows is either a registered trademark or trademark of Microsoft Corporation in the United States and other countries. JavaScript and all Java-related marks are trademarks or registered trademarks of Sun Microsystems, Incorporated in the United States and other countries.
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 VBScript Object Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Artboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Artboards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
AutoCADFileOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Brush . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Brushes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
CharacterAttributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
CharacterStyle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
CharacterStyles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
CMYKColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Color info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
CompoundPathItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
CompoundPathItems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
DataSet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
DataSets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
DocumentPreset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
EPSSaveOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
ExportOptionsAutoCAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
ExportOptionsFlash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
ExportOptionsGIF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
ExportOptionsJPEG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
ExportOptionsPhotoshop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
ExportOptionsPNG8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
ExportOptionsPNG24 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
ExportOptionsSVG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
ExportOptionsTIFF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
FreeHandFileOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
FXGSaveOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Gradient . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
GradientColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
3
Contents 4
Gradients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
GradientStop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
GradientStops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
GraphicStyle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
GraphicStyles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
GraphItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
GraphItems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
GrayColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
GroupItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
GroupItems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
IllustratorSaveOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
ImageCaptureOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Ink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
InkInfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
InsertionPoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
InsertionPoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
LabColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
LegacyTextItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
LegacyTextItems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
MeshItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
MeshItems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
NoColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
NonNativeItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
NonNativeItems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
OpenOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
PageItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
PageItems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Paper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
PaperInfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
ParagraphAttributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
Paragraphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
ParagraphStyle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
ParagraphStyles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
PathItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
Contents 5
PathItems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
PathPoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
PathPoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
Pattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
PatternColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
PDFFileOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
PDFSaveOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
PhotoshopFileOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
PlacedItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
PlacedItems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
PluginItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
PluginItems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
PPDFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
PPDFileInfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
PrintColorManagementOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
PrintColorSeparationOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
PrintCoordinateOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
Printer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
PrinterInfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
PrintFlattenerOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
PrintFontOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
PrintJobOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
PrintOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
PrintPageMarksOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
PrintPaperOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
PrintPostScriptOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
RasterEffectOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
RasterItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
RasterItems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
RasterizeOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
RGBColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
ScreenInfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
ScreenSpotFunction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
Spot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
SpotColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
Contents 6
Spots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
Stories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
Story . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
Swatch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
Swatches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
SwatchGroup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
SwatchGroups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
Symbol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
SymbolItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
SymbolItems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
TabStopInfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
TextFont . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
TextFonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
TextFrame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
TextFrames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
TextPath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
TextRange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
TextRanges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
TracingObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
TracingOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
2 Enumerations Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
1

VBScript Object Reference

This reference section describes the objects and methods in the Illustrator VBScript type library. All of the classes in the type library are presented alphabetically. The chapter concludes with an enumerations reference which lists all of the enumerations in the Illustrator type library.
Each class listing includes the following:
Properties of the class — These include value type, read-only status, and an explanation.
Methods for the class — Value types needed by the method are shown in bold face. Enumerated
values are linked to the Chapter 2, “Enumerations Reference All items surrounded by brackets (
Script examples — These example are intended to illustrate concepts, and do not necessarily
represent the best or most efficient way to construct a VBScript script. They contain little error checking, and assume that the proper context exists for the scripts to execute in (for instance, that there is a document open or items selected).
Each script contains a single subroutine that can be pasted into any event in a VBScript form if you are using the VBScript development environment. A standard button click event is used for all examples. If you are using a built-in VBScript editor in a VBA application, you can paste the script into a macro routine. In either case, modify the
[ ]) are optional.
Sub statement in the example to work with your situation.
.” Required terms are shown in plain face.
For an overview of how the Illustrator object model is structured, see Adobe Illustrator CS6 Scripting Guide.
7
CHAPTER 1: VBScript Object Reference Application 8

Application

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

Application properties

Property Value type What it is
ActionIsRunning Boolean
ActiveDocument Document
Application Application
BrowserAvailable Boolean
BuildNumber String
ColorSettingsList Variant
CoordinateSystem
DefaultColorSettings String
Documents Documents
FlattenerPresetsList Variant
FreeMemory Long
Locale String
AiCoordinateSystem
Read-only. If true, an action is still running.
The active (frontmost) document in Illustrator.
Read-only. The Illustrator Application object.
Read-only. If true, a Web browser is available.
Read-only. The application’s build number.
Read-only. The list of color-settings files currently available for use.
The coordinate system currently in use, document or artboard.
Read-only. The default color-settings file for the current application locale.
Read-only. The documents in the application.
Read-only. The list of flattener style names currently available for use.
Read-only. The amount of unused memory (in bytes) within the Illustrator partition.
Read-only. The application’s locale.
Name String
Path String
PDFPresetsList
PPDFileList
Preferences Preferences
PrinterList Variant
PrintPresetsList Variant
ScriptingVersion String
Variant Array of String
Variant Array of Strings
Read-only. The application’s name (not related to the filename of the application file).
Read-only. The file path to the application.
Read-only. The list of preset PDF-options names available for use.
Read-only. The list of PPD files currently available for use.
Read-only. The application preferences.
Read-only. A list of available printers.
Read-only. The list of preset printing-options names currently available for use.
Read-only. The version of the Scripting plug-in.
CHAPTER 1: VBScript Object Reference Application 9
Property Value type What it is
Selection
StartupPresetsList Variant
TextFonts TextFonts
TracingPresetList
UserInteractionLevel AiUserInteractionL
Version String
Visible Boolean

Application methods

Method Returns What it does
ConcatenateMatrix
(matrix as Matrix,
secondMatrix as Matrix)
Variant
objects
Variant String
evel
Array of
Array of
All currently selected objects in the active (frontmost) document.
Read-only. The list of presets available for creating a new document.
Read-only. The installed fonts.
Read-only. The list of preset tracing-options names available for use.
The allowed level of interaction with users in the form of dialogs and message boxes.
Read-only. The version of the Illustrator application.
Read-only. If true, the application is visible.
Matrix
Concatenates two matrices.
ConcatenateRotationMatrix
(matrix as Matrix,
angle as Double)
ConcatenateScaleMatrix
(matrix as Matrix,
[, scaleX as Double] [, scaleY as Double])
ConcatenateTranslationMatrix
(matrix as Matrix,
[, deltaX as Double] [, deltaY as Double])
ConvertSampleColor
(SourceColorSpace as AiImageColorSpace
SourceColor as ColorComponents, DestColorSpace as AiImageColorSpace ColorConvertPurpose as AiColorConvertPurpose [,SourceHasAlpha as Boolean] [,DestHasAlpha as Boolean])
Copy
()
Cut
()
,
Matrix
Concatenates a rotation to a transformation matrix.
Matrix
Concatenates a scale to a transformation matrix.
Matrix
Concatenates a translation to a transformation matrix.
,
array of ColorCom ponents
Converts a sample-component color from one color space to another.
Nothing Copies the current
selection to the clipboard.
Nothing Cuts the current selection
to the clipboard.
CHAPTER 1: VBScript Object Reference Application 10
Method Returns What it does
DoJavaScript
(JavaScriptCode as String,
[, Arguments as Variant Array] [, ExecutionMode as AiJavaScriptExecutionMode
DoJavaScriptFile
(JavaScriptFile as File,
[, Arguments as Variant Array] [, ExecutionMode as AiJavaScriptExecutionMode
DoScript
(Action as String,
From as String [, dialogs as Boolean])
GetIdentityMatrix
()
String
Executes the specified JavaScript® code.
])
String
Executes the specified JavaScript file.
])
Nothing Plays an action from the
Actions palette.
OTE: Use DoScript only if
N
you intend to run your script from an application external to Illustrator, such as the Windows® Script Host. Calling
DoScript
when running a script from Illustrator’s File > Scripts menu may yield unexpected results.
Matrix
Returns an identity matrix.
GetPPDFileInfo
(Name as String)
GetPresetFileOfType
(PresetType as AiDocumentPresetType
GetPresetSettings
(Preset as String)
GetRotationMatrix
([Angle as Double])
PPDFileI nfo
Gets detailed file information for specified PPD file.
String
)
Returns the full path to the default document profile for the specified preset type.
Document Preset
Retrieves the tracing-option settings from the template with a given preset name.
Matrix
Returns a transformation matrix containing a single rotation.
OTE: Requires a value in
N
degrees. For example, 30 rotates the object 30 degrees counterclockwise;
-30 rotates the object 30 degrees clockwise.
CHAPTER 1: VBScript Object Reference Application 11
Method Returns What it does
GetScaleMatrix
([scaleX as Double]
[, scaleY as Double])
GetScriptableHelpGroup
()
GetTranslationMatrix
([deltaX as Double]
[, deltaY as Double])
Matrix
variant
Matrix
Returns a transformation matrix containing a single scale.
N
OTE: Requires a value in
percentage. For example, 60 scales the object to 60% of its original size; 200 doubles the object’s bounds.
Gets the scriptable help group object that represents the search widget in the app bar.
Returns a transformation matrix containing a single translation.
N
OTE: Requires a value in
points. For example, {100,200} moves the object 100 pt. to the right and 200 pt. up; a minus before each number moves the object left and down.
InvertMatrix
(matrix as Matrix)
IsEqualMatrix
(matrix as Matrix,
secondMatrix as Matrix)
IsSingularMatrix
(matrix as Matrix)
LoadColorSettings
(fileSpec as String)
Matrix
Boolean
Inverts a matrix.
Checks whether two matrices are equal.
Boolean
Checks whether a matrix is singular and cannot be inverted.
Nothing Loads color settings from
specified file, or, if file is empty, turns color management off.
CHAPTER 1: VBScript Object Reference Application 12
Method Returns What it does
Open
(file as String,
[documentColorSpace as AiDocumentColorSpace [options as Object])
Paste
()
Quit
Redo
()
Redraw
()
Document
Opens the specified file document.
],
If called to open a pre-Illustrator 9 document that contains both RGB and CMYK colors, supply
DocumentColorSpace in
order to convert all colors to the specified color space. If not supplied, Illustrator displays a dialog to the user.
Nothing Pastes the clipboard
content into the current document.
Nothing Quits Illustrator.
Nothing Redoes the most recently
undone transaction.
Nothing Forces Illustrator to redraw
all its windows.
ShowPresets
(fileSpec as String)
TranslatePlaceholderText
(text as String)
Undo
()
Nothing Gets the presets from the
file.
Nothing Translates the placeholder
text to regular text; a way to enter unicode points in hex values.
Nothing Undoes the most recent
transaction.
CHAPTER 1: VBScript Object Reference Application 13
Opening a document
' Open a document and get the reference to it Set appRef = CreateObject("Illustrator.Application") Set docRef = appRef.Open("C:\temp\aFile.ai")
Accessing the selection
In Illustrator, the application’s Selection can be accessed as well as modified. The selection will contain
Empty when there are no selected objects. To deselect all objects in the current document, set the
selection to
Set appRef = CreateObject("Illustrator.Application") appRef.activeDocument.Selection = Empty
Empty, as the following example shows.
A reference to a text range is returned when there is an active insertion point in the contents of a
TextFrame. Similarly, a reference to a range of text is returned when characters are selected in the
contents of a
TextFrame.
Executing an action
You can run an action from the Action Palette from a script by using the DoScript method. When you do this, the control returns to your script before the action has completed. Use the
ActionIsRunning
property to test for when the action has completed before executing any other VBScript methods (see the
Windows.DoAction example). You can also use the Sleep method defined on the WScript object to insert
a pause to test this property, as in the following example:
Set appRef = CreateObject("Illustrator.Application") appRef.DoScript "Opacity 60 (selection)", "Default Actions" WHILE(appRef.ActionIsRunning)
WScript.sleep 1000 WEND msgbox "Done"
Invoking JavaScript
DoJavaScript and DoJavaScriptFile can be used to invoke scripts written in JavaScript for Illustrator.
The first argument to example, the following script displays an alert using the JavaScript
appRef.DoJavaScript "alert( 'Number of open documents: ' + _documents.length);"
This example returns the number of open documents.
Set myNumberOfDocuments = appRef.DoJavaScript("documents.length;") MsgBox myNumberOfDocuments
DoJavaScript is a string that must evaluate to a valid JavaScript expression. For
alert method.
CHAPTER 1: VBScript Object Reference Application 14
Copy and paste between documents
This script uses the application property ActiveDocument to copy the current document’s selection to the clipboard before pasting it into our new document. This script also demonstrates how to create a new document with a specific color space and dimensions.
'Duplicates the selected item in the current document to a new document
Set appRef = CreateObject("Illustrator.Application")
If appRef.Documents.Count > 0 Then
If Not IsEmpty(appRef.ActiveDocument.selection) Then
appRef.ActiveDocument.Copy Set newDocument = appRef.Documents.Add(aiDocumentCMYKColor,250, 400) newDocument.Paste
End If End If
CHAPTER 1: VBScript Object Reference Artboard 15

Artboard

An Artboard object represents a single artboard in a document. There can be between 1 to 100 artboards in one document.

Artboard properties

Property Value type What it is
Application Application
ArtboardRect Rect
Name String
Parent Document
RulerOrigin Point
RulerPAR Double
ShowCenter Boolean
ShowCrossHairs Boolean
ShowSafeAreas Boolean

Artboard methods

Method Returns What it does
Read-only. The Illustrator Application object.
Size and position of the artboard.
The unique identifying name of the artboard.
Read-only. The name of the object that is this Artboard object’s parent.
Ruler origin of the artboard, relative to the left top 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 title and action safe areas (for video).
Delete
()
Nothing Deletes this artboard object. You cannot remove the last
artboard in a document.
CHAPTER 1: VBScript Object Reference Artboards 16

Artboards

A collection of artboards.

Artboards properties

Property Value type What it is
Application Application
Count Long
Parent Document

Artboards methods

Method Returns What it does
Add
(rect as ArtboardRect)
GetActiveArtboardIndex
()
GetByName
(artboardName as String)
Index
(item as DataSets)
Insert
(rect as ArtboardRect,
index as Long)
Read-only. The Illustrator Application object.
Read-only. The number of objects in the collection.
Read-only. The document that contains this object.
Artboard
Long
Creates a new Artboard object.
Retrieves the index position of the active artboard in the document's list. Returns the 0-based index.
Artboard
Retrieves an artboard object from the list by its unique identifying name.
Long
Returns the index position of the object within the collection.
Nothing Creates a new artboard object and inserts it at the given
index in the list.
Item
(itemKey)
Remove
(index as Long)
SetActiveArtboardIndex
(index as Long)
Artboard
Returns an object reference to the object identified by
itemKey (name or index).
Nothing Deletes an artboard object. You cannot remove the last
artboard in a document.
Nothing Makes a specific artboard active and makes it current in
the iteration order.
CHAPTER 1: VBScript Object Reference AutoCADFileOptions 17

AutoCADFileOptions

Options for opening an AutoCAD drawing, used with the Open method.

AutoCADFileOptions properties

Property Value type What it is
Application Application
CenterArtwork Boolean
GlobalScaleOption AiAutoCADGlobalScaleOption
GlobalScalePercent Double
MergeLayers Boolean
Parent Document
ScaleLineweights Boolean
SelectedLayoutName String
Read-only. The Illustrator Application object.
If true, center the artwork that is created on the artboard. Default is
true.
How to scale the drawing on import. Default is
1 ' aiFitArtboard
The value when globalScaleOption is
2 ' aiScaleByValue, expressed as a
percentage. Range: 0.0 to 100.0 Default is
100.0
If true, the layers of the artwork are merged. Default:
false
Read-only. The document that contains this object.
If true, scales line weights by the same factor as the rest of the drawing. Default is
false.
Name of the layout in the drawing to import.
Unit AiAutoCADUnit
UnitScaleRatio Double
The unit to map to. Default is
3 ' aiMillimeters.
The ratio by which to scale while mapping units. Default is
1.0
CHAPTER 1: VBScript Object Reference Brush 18

Brush

A brush in an Illustrator document. Illustrator brushes can be accessed, but not created or deleted, from a script.

Brush properties

Property Value type What it is
Application Application
Name String
Parent Object

Brush methods

Method Returns What it does
ApplyTo
(artItem as PageItem)
Applying a Brush
'Creates a new group, adds a duplicate of each selected item to the group 'then applies a brush to each item in the group
Set appRef = CreateObject("Illustrator.Application")
If appRef.Documents.Count > 0 Then
If Not IsEmpty(appRef.Selection) Then
selectedItems = appRef.Selection startIndex = LBound(selectedItems) endIndex = UBound(selectedItems)
Read-only. The Illustrator Application object.
The Brush name.
Read-only. The container object.
Nothing Applies the brush to a specific art item.
End If End If
Set newGroup = appRef.ActiveDocument.GroupItems.Add For i = startIndex To endIndex
Set artItem = selectedItems(i) Set dupItem = artItem.Duplicate(newGroup, aiPlaceAtEnd) appRef.ActiveDocument.Brushes(2).ApplyTo artItem
Next
CHAPTER 1: VBScript Object Reference Brushes 19

Brushes

A collection of brushes in a document.

Brushes properties

Property Value type What it is
Application Application
Count Long
Parent Object

Brushes methods

Method Returns What it does
Index
(item as Brush)
Item
(itemKey)
Get all brushes in a document
'Counts the number of brushes in the current document 'and stores in numBrushes
Set appRef = CreateObject("Illustrator.Application")
Long
Brush
Read-only. The Illustrator Application object.
Read-only. Long. The number of objects in the collection.
Read-only. The document that contains this object.
Returns the index position of the object within the collection.
Returns an object reference to the object identified by itemKey
name or index).
(
If appRef.Documents.Count > 0 Then
numBrushes = appRef.ActiveDocument.Brushes.Count End If
CHAPTER 1: VBScript Object Reference CharacterAttributes 20

CharacterAttributes

Specifies the properties of a character contained in a text frame. A CharacterStyle object associates attributes with a text range. See
OTE: Character attributes do not have default values and are undefined until explicitly set.
N

CharacterAttributes properties

Property Value Type What it is
CharacterStyle” on page 26.
AkiLeft Double
AkiRight Double
Alignment AiStyleRunAlignmentType
AlternateGlyphs AiAlternateGlyphsForm
Application Application
AutoLeading Boolean
BaselineDirection AiBaselineDirectionType
BaselinePosition AiFontBaselineOption
BaselineShift Double
The amount of inter-glyph space added to the left side of the glyph in Japanese text (in thousandths of an em).
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.
Specifies which kind of alternate glyphs are used.
Read-only. The Illustrator
Application object.
If true, automatic leading is used.
The Japanese text baseline direction.
The baseline position of text.
The amount of shift (in points) of the text baseline.
Capitalization AiFontCapsOption
ConnectionForms Boolean
ContextualLigature Boolean
DiscretionaryLigature Boolean
FigureStyle AiFigureStyleType
Specifies whether the text is normal, all uppercase, all small caps, or a mix of small caps and lowercase.
If true, OpenType® connection forms are used.
If true, contextual ligatures are used.
If true, discretionary ligatures are used.
The number style in an OpenType font.
CHAPTER 1: VBScript Object Reference CharacterAttributes 21
Property Value Type What it is
FillColor
Fractions Boolean
HorizontalScale Double
Italics Boolean
KerningMethod AiAutoKernType
Language AiLanguageType
Leading Double
Ligature Boolean
NoBreak Boolean
OpenTypePosition AiFontOpenTypePositionOption
Ordinals Boolean
Ornaments Boolean
Object The color of the text fill.
If true, OpenType fractions are used.
The horizontal scaling factor (as a percentage).
If true, the Japanese font supports italics.
The kerning method.
The language of the text.
The amount of space between two lines of text, in points.
If true, ligatures are used.
If true, no break is allowed.
The OpenType baseline position.
If true, OpenType ordinals are used.
If true, OpenType ornaments are used.
OverprintFill Boolean
OverprintStroke Boolean
Parent
ProportionalMetrics Boolean
Rotation Double
Size Double
StrikeThrough Boolean
StrokeColor
StrokeWeight Double
StylisticAlternates Boolean
Swash Boolean
Object Read-only. The object’s container.
Object The color of the text stroke.
If true, overprint the fill of the text.
If true, overprinting of the stroke of the text is allowed.
If true, proportional metrics in Japanese OpenType are used.
The character rotation angle.
The font size in points.
If true, characters are struck-through by a line.
Line width of stroke.
If true, OpenType stylistic alternates are used.
If true, OpenType swash characters are used.
CHAPTER 1: VBScript Object Reference CharacterAttributes 22
Property Value Type What it is
TateChuYokoHorizontal Long
TateChuYokoVertical Long
TextFont TextFont
Titling Boolean
Tracking Long
Tsume Double
Underline Boolean
VerticalScale Double
WariChuCharactersAfter Break
Long
The Tate-Chu-Yoko horizontal adjustment in points.
The Tate-Chu-Yoko vertical adjustment in points.
The font used for the character.
If true, OpenType titling alternates are used.
The tracking or range kerning amount in thousandths of an em.
The percentage of space reduction around a Japanese character.
If true, characters are underlined.
Character vertical scaling factor.
Specifies how the characters in Wari-Chu text (an inset note in Japanese text) are divided into two or more lines.
WariChuCharactersBeforeBr eak
WariChuEnabled Boolean
WariChuJustification AiWariChuJustificationType
WariChuLineGap Long
WariChuLines Long
WariChuScale Double
Long
Specifies how the characters in Wari-Chu text (an inset note in Japanese text) are divided into two or more lines.
If true, Wari-Chu is enabled.
The Wari-Chu justification.
The Wari-Chu line gap.
The number of Wari-Chu (multiple text lines fit into a space meant for one) lines.
The Wari-Chu scale.
CHAPTER 1: VBScript Object Reference CharacterAttributes 23
Setting character attributes
'Opens a document and adds a simple text frame, then 'uses the CharacterAttributes object to increment 'the horizontal and vertical scale of each character.
Set appRef = CreateObject("Illustrator.Application")
Set docRef = appRef.Documents.Add() Set textRef = docRef.TextFrames.Add() textRef.Contents = "I'd rather be scripting!" textRef.Top = 500 textRef.Left = 40
dSize = 100 iCount = textRef.Characters.Count i = 1 Dim charRef Do While (i < (iCount + 1))
dSize = dSize * 1.1
textRef.TextRange.Characters(i).CharacterAttributes.HorizontalScale = dSize
textRef.TextRange.Characters(i).CharacterAttributes.VerticalScale = dSize
i = i + 1 Loop
CHAPTER 1: VBScript Object Reference Characters 24

Characters

A collection of TextRange objects in which each represents a single character.

Characters properties

Property Value type What it is
Application Application
Count Long
Parent
Object Read-only. The object’s container.

Characters methods

Method Returns What it does
Add
(contents as String
[, relativeObject as TextFrame] [, insertionLocation as AiElementPlacement
AddBefore
(contents as String)
Read-only. Application that the collection belongs to.
Read-only. Number of elements in the collection.
TextRange
Adds a new character with specified text contents at
])
the specified location in the current document. If location is not specified, adds the new character to the containing text frame after the current text selection or insertion point.
TextRange
Adds a character before the current text selection or insertion point.
Index
(itemPtr as TextRange)
RemoveAll
()
Long
Returns the index position of the object within the collection.
Nothing Deletes every element in
the collection.
CHAPTER 1: VBScript Object Reference Characters 25
Counting characters
'Counts the number of characters in the current document 'and stores the result in numChars
Set appRef = CreateObject("Illustrator.Application")
If appRef.Documents.Count > 0 Then
numChars = 0
For Each textArt In appRef.ActiveDocument.TextFrames
Set textArtRange = textArt.TextRange numChars = numChars + textArtRange.length
Next End If
CHAPTER 1: VBScript Object Reference CharacterStyle 26

CharacterStyle

A named style that specifies character attributes. For an example, see CharacterStyles.

CharacterStyle properties

Property Value type What it is
Application Application
CharacterAttributes CharacterAttributes
Name String
Parent
Object Read-only. The object’s container.

CharacterStyle methods

Method Returns What it does
ApplyTo
(textItem as Object [, clearingOverrides as Boolean])
Delete
()
Read-only. Application to which the collection belongs.
Read-only. The character properties for the style.
The character style’s name.
Nothing Applies the character style to the text object or
objects.
Nothing Deletes the object.
CHAPTER 1: VBScript Object Reference CharacterStyles 27

CharacterStyles

A collection of character styles.

CharacterStyles properties

Property Value type What it is
Application Application
Count Long
Parent
Object Read-only. The object’s container.

CharacterStyles methods

Method Returns What it does
Add
(Name as String)
Index
(itemPtr as CharacterStyle)
Item
(itemKey)
RemoveAll
()
Read-only. Application to which the collection belongs.
Read-only. Number of elements in the collection.
CharacterStyle
Long
Creates a named character style.
Returns the index position of the object within the collection.
CharacterStyle
Returns an object reference to the object identified by
itemKey (name or index).
Nothing Deletes all objects in this collection.
CHAPTER 1: VBScript Object Reference CharacterStyles 28
Create and apply character styles
'Opens a document, adds 3 text frames, 'creates a new character style and applies it to 'each of the text frames
Set appRef = CreateObject("Illustrator.Application")
'Create a new document add a 3 simple text items Set docRef = appRef.Documents.Add() Set textRef1 = docRef.TextFrames.Add() textRef1.Contents = "Scripting is fun!" textRef1.Top = 700 textRef1.Left = 50
Set textRef2 = docRef.TextFrames.Add() textRef2.Contents = "Scripting is easy!" textRef2.Top = 625 textRef2.Left = 100
Set textRef3 = docRef.TextFrames.Add() textRef3.Contents = "Everyone should script!" textRef3.Top = 550 textRef3.Left = 150 appRef.Redraw
'Create a new character style Set charStyle = docRef.CharacterStyles.Add("BigRed")
'Create a red color Set colorRed = CreateObject("Illustrator.RGBColor") colorRed.Red = 255
'Set character attributes of the new style With charStyle.CharacterAttributes
.Size = 40
.Tracking = -50
.Capitalization = 0 'aiNormalCaps
.FillColor = colorRed End With
'Apply style to each textFrame in the document charStyle.ApplyTo textRef1.TextRange charStyle.ApplyTo textRef2.TextRange charStyle.ApplyTo textRef3.TextRange
CHAPTER 1: VBScript Object Reference CMYKColor 29

CMYKColor

A CMYK color specification, used to apply a CMYK color to a layer or art item.
If the color space of a document is RGB and you specify the color value for a page item in that document using CMYK, Illustrator translates the CMYK color specification into an RGB color specification. The same thing happens if the document’s color space is CMYK and you specify colors using RGB. Since this translation can lose information, you should specify colors using the class that matches the document’s actual color space.

CMYKColor properties

Property Value type What it is
Application Application
Black Double
Cyan Double
Magenta Double
Yellow Double
Read-only. The Illustrator Application object.
The black color value. Range: 0.0 to 100.0
The cyan color value. Range: 0.0 to 100.0
The magenta color value. Range: 0.0 to 100.0
The yellow color value. Range: 0.0 to 100.0
Setting CMYK colors
'Creates a new CMYK color and applies it to the first path item
Set appRef = CreateObject("Illustrator.Application") Set newCMYKColor = CreateObject("Illustrator.CMYKColor")
'Get a reference to the frontmost path in the document Set frontPath = appRef.ActiveDocument.PathItems(1)
'Set color values for the CMYK objects
newCMYKColor.Black = 0 newCMYKColor.Cyan = 30.4 newCMYKColor.Magenta = 32 newCMYKColor.Yellow = 0
frontPath.Filled = True frontPath.fillColor = newCMYKColor
CHAPTER 1: VBScript Object Reference Color info 30

Color info

An abstract parent class for all color classes used in Illustrator. Subclasses are:
CMYKColor GradientColor GrayColor LabColor NoColor PatternColor RGBColor SpotColor
CHAPTER 1: VBScript Object Reference CompoundPathItem 31

CompoundPathItem

Compound paths are objects composed of multiple intersecting paths, resulting in transparent interior spaces where the original paths overlapped. The make up the compound path.
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 paths’ 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.

CompoundPathItem properties

Property Value type What it is
PathItems property provides access to the paths that
Application Application
ArtworkKnockout AiKnockoutState
BlendingMode AiBlendModes
ControlBounds
Editable Boolean
GeometricBounds
Height Double
Hidden Boolean
IsIsolated Boolean
Layer Layer
Left Double
Locked Boolean
Variant
4
Doubles
Variant
4
Doubles
Array of
Array of
Read-only. The Illustrator Application object.
Is this object used to create a knockout? If so, what kind of knockout?
The mode used when compositing an object.
Read-only. The bounds of the object including stroke width and controls.
Read-only. If true, the object is editable.
Read-only. The bounds of the object excluding stroke width.
The height of the object, excluding stroke width, calculated from the
GeometricBounds.
If true, this object is hidden.
If true, this object is isolated.
Read-only. The layer to which this object belongs.
The position of the left side of the item (in points, measured from the left side of the page).
If true, the object is locked.
Name String
Note String
Opacity Double
Parent Document
PathItems PathItems
The name of this object.
The note assigned to this object.
The opacity of the object. Range: 0.0 to 100.0
Read-only. The document that contains this object.
Read-only. The path art items in this compound path.
CHAPTER 1: VBScript Object Reference CompoundPathItem 32
Property Value type What it is
Position
Selected Boolean
Sliced Boolean
Tags Tags
Top Double
URL String
VisibilityVariable Variable
VisibleBounds
Width Double
WrapInside Boolean
Variant
2
Doubles
Variant Array of
4
Doubles
Array of
The position (in points) of the top left corner of the item, in the format [x, y]. Does not include stroke weight.
If true, the object is selected.
If true, the CompoundPathItem is sliced. Default:
false
Read-only. The tags contained in this object.
The position of the top of the item (in points, measured from the bottom of the page).
The value of the Adobe URL tag assigned to this object.
The VisibilityVariable bound to this object.
Read-only. The visible bounds of the object including stroke width.
The width of the object, excluding stroke width, calculated from the
GeometricBounds.
If true, the text frame object are wrapped inside this object.
WrapOffset Double
Wrapped Boolean
ZOrderPosition Long

CompoundPathItem methods

Method Returns What it does
Copy
()
Cut
()
The offset to use when wrapping text around this object.
If true, wrap text frame objects around this object (text frame must be above the object).
Read-only. The position of this art item within the stacking order of the group or layer (
Parent) that
contains the art item.
Nothing Copies the compound path to the
clipboard. The associated document must be the frontmost document.
Nothing Cuts the compound path onto the
clipboard. The associated document must be the frontmost document.
Delete
()
Nothing Deletes the object.
CHAPTER 1: VBScript Object Reference CompoundPathItem 33
Method Returns What it does
Duplicate
([relativeObject as Object],
[insertionLocation as AiElementPlacement
Move
(relativeObject as Object,
insertionLocation as AiElementPlacement)
Resize
(scaleX as Double,
scaleY as Double, [, changePositions as Boolean] [, changeFillPatterns as Boolean] [, changeFillGradients as Boolean] [, changeStrokePattern as Boolean] [, changeLineWidths as Double] [, scaleAbout as AiTransformation
Rotate
(angle as Double,
[, changePositions as Boolean] [, changeFillPatterns as Boolean] [, changeFillGradients as Boolean] [, changeStrokePattern as Boolean] [, rotateAbout as AiTransformation
Transform
(transformationMatrix as Matrix,
[, changePositions as Boolean] [, changeFillPatterns as Boolean] [, changeFillGradients as Boolean] [, changeStrokePattern as Boolean] [, changeLineWidths as Double] [, transformAbout as AiTransformation
])
])
])
Object Duplicates the compound path,
optionally specifying the location
])
and position for the copy.
Nothing Moves the object, specifying the
new location and position.
Nothing Scales the compound path where
scaleX is the horizontal scaling
factor (as a percentage) and
scaleY is the vertical scaling
factor; 100.0 = 100%
Nothing Rotates the art item relative to the
current rotation. The object is rotated counter-clockwise if the
Angle value is positive, clockwise
if the value is negative.
Nothing Transforms the compound path by
applying the specified transformation matrix.
Translate
([deltaX as Double]
[, deltaY as Double] [, transformObjects as Boolean] [, transformFillPatterns as Boolean] [, transformFillGradients as Boolean] [, transformStrokePatterns as Boolean])
ZOrder
(zOrderCmd as AiZOrderMethod
)
Nothing Repositions the compound path
relative to the current position, where
deltaX is the horizontal
offset and
deltaY is the vertical
offset.
Nothing Arranges the compound path’s
position in the stacking order of the group or layer (
Parent) that
contains the object.
CHAPTER 1: VBScript Object Reference CompoundPathItem 34
Selecting paths in a document
This example demonstrates how to select all of the paths in a document that are not part of a compound path or a group by testing the type of the
'Selects path items in the current document that are not 'compound paths
Set appRef = CreateObject("Illustrator.Application") counter = 0 If appRef.Documents.Count > 0 Then
If appRef.ActiveDocument.PathItems.Count > 0 Then
For Each pathArt In appRef.ActiveDocument.PathItems
If (Not TypeName(pathArt.Parent) = "CompoundPathItem") Then
pathArt.Selected = True counter = counter + 1
Else
pathArt.Selected = False
End If
Next
End If End If
Parent property with a TypeName function.
CHAPTER 1: VBScript Object Reference CompoundPathItem 35
Creating a compound path
This example demonstrates how to create a new compound path containing three PathItems. The example then modifies the stroke of the paths in the compound path. Note that when you modify the properties of a The example also shows how to access swatches in a document by name.
'Creates a new compound path item, adds 3 new 'path items, then sets the stroke of the compound path
Set appRef = CreateObject("Illustrator.Application")
Set frontDocument = appRef.ActiveDocument Set activeLayer = frontDocument.activeLayer Set newCompoundPath = activeLayer.CompoundPathItems.Add
'Create the path items Set newPath = newCompoundPath.PathItems.Add newPath.SetEntirePath Array(Array(30, 50), Array(30, 100))
Set newPath = newCompoundPath.PathItems.Add newPath.SetEntirePath Array(Array(40, 100), Array(100, 100))
PathItem inside a compound path you affect all paths contained in the compound path.
Set newPath = newCompoundPath.PathItems.Add newPath.SetEntirePath Array(Array(100, 110), Array(100, 300))
'Set the stroke of the compound path newPath.Stroked = True newPath.StrokeWidth = 3.5 newPath.StrokeColor = frontDocument.Swatches(8).Color
CHAPTER 1: VBScript Object Reference CompoundPathItems 36

CompoundPathItems

A collection of compound paths.

CompoundPathItems properties

Property Value type What it is
Application Application
Count Long
Parent Document

CompoundPathItem methods

Method Returns What it does
Add
()
Index
(item as CompoundPathItem)
Item
(itemKey)
RemoveAll
()
Counting compound paths
CompoundPathItem
Long
CompoundPathItem
Nothing Deletes all objects in this collection.
Read-only. The Illustrator Application object.
Read-only. The number of objects in the collection.
Read-only. The document that contains this object.
Creates a new CompoundPathItem object.
Returns the index position of the object within the collection.
Returns an object reference to the object identified by
itemKey (name or index).
'Counts the compound path items in the current document and 'stores in numCPaths
Set appRef = CreateObject("Illustrator.Application")
If appRef.Documents.Count > 0 Then
numCPaths = appRef.ActiveDocument.Layers(1).CompoundPathItems.Count End If
CHAPTER 1: VBScript Object Reference DataSet 37

DataSet

A set of data used for dynamic publishing. A dataset allows you to collect a number of variables and their dynamic data into one object. To create a art item.
DataSet object, you must have at least one variable bound to an
For more information, see the Variable Adobe Illustrator CS6 Scripting Guide.
For a sample script that uses a

DataSet properties

Property Value type What it is
Application Application
Name String
Parent Document

DataSet methods

Method Returns What it does
Delete
()
Nothing Deletes the object.
class and the section on “Dynamic Objects and Symbols” in
DataSet object, see DataSets.
Read-only. The Illustrator Application object.
The name of the DataSet.
Read-only. The name of the object that is this DataSet object’s parent.
Display
()
Update
()
Nothing Displays the DataSet.
Nothing Updates the DataSet.
CHAPTER 1: VBScript Object Reference DataSets 38

DataSets

A collection of DataSet objects.

DataSets properties

Property Value type What it is
Application Application
Count Long
Parent Document

DataSets methods

Method Returns What it does
Add
()
Index
(item as DataSets)
Item
(itemKey)
RemoveAll
()
Read-only. The Illustrator Application object.
Read-only. The number of datasets in the collection.
Read-only. The name of the object that is this DataSet object’s parent.
DataSet
Long
DataSet
Creates a new DataSet object.
Returns the index position of the object within the collection.
Returns an object reference to the object identified by itemKey (name or index).
Nothing Deletes all objects in this collection.
CHAPTER 1: VBScript Object Reference DataSets 39
Creating datasets
'Creates two variables (visibility and text), 'creates two datasets using different variable 'values then displays each dataset
Set appRef = CreateObject("Illustrator.Application") Set docRef = appRef.Documents.Add()
'Create a visibility variable Set itemRef = docRef.PathItems.Rectangle(600, 200, 150, 150) Set colorRef = CreateObject("Illustrator.RGBColor") colorRef.Red = 255 itemRef.FillColor = colorRef Set visibilityVar = docRef.Variables.Add() visibilityVar.Kind = 2 'aiVisibility itemRef.VisibilityVariable = visibilityVar
'Create a text variable Set textRef = docRef.TextFrames.Add textRef.Contents = "Text Variable, dataset 1" textRef.Top = 400 textRef.Left = 200 Set textVar = docRef.Variables.Add textVar.Kind = 3 'aiTextual textRef.ContentVariable = textVar
'Create dataset 1 Set ds1 = docRef.DataSets.Add()
'Change data and create dataset 2 itemRef.Hidden = True textRef.Contents = "Text Variable, dataset 2" Set ds2 = docRef.DataSets.Add()
'Display datasets ds1.Display ds2.Display
CHAPTER 1: VBScript Object Reference Document 40

Document

An Illustrator document. 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.
FillColor and Stroked that
A document’s
DocumentColorSpace, Height, and Width can be set only when the document is created.
Once a document is created, these properties cannot be changed.
The frontmost document can be referred to as either

Document properties

Property Value type What it is
ActiveDataSet DataSet
ActiveLayer Layer
ActiveView View
Application Application
Artboards Artboards
Brushes Brushes
CharacterStyles CharacterStyles
AppRef.ActiveDocument or AppRef.Documents(1).
The active DataSet object in the document.
The active Layer in the document.
Read-only. The document’s current View.
Read-only. The Illustrator Application object.
Read-only. All artboards in the document.
Read-only. The Brushes contained in the document.
Read-only. The list of character styles in this document.
CompoundPathItems CompoundPathItems
CropBox
Variant
4
CropStyle AiCropOptions
DataSets DataSet
DefaultFillColor Color info
DefaultFilled Boolean
Array of
Doubles
Read-only. The CompoundPathItems contained in the document.
The boundary of the document’s cropping box for output.
A document does not have a default
CropBox. In order to read this property you
have to set the
CropBox first.
The style of the document’s cropping box.
Read-only. A DataSets collection in the document.
The Color to fill new paths if default filled is
true.
If true, a new path are filled.
CHAPTER 1: VBScript Object Reference Document 41
Property Value type What it is
DefaultFillOverprint Boolean
DefaultStrokeCap AiStrokeCap
DefaultStrokeColor Color info
DefaultStroked Boolean
DefaultStrokeDashes
DefaultStrokeDashOffset Double
DefaultStrokeJoin AiStrokeJoin
DefaultStrokeMiterLimit Double
Variant Doubles
Array of
If true, the art beneath a filled object are overprinted by default.
Default type of line capping for paths created.
The stroke color for new paths if default stroked is
true.
If true, the new path are stroked.
The default lengths for dashes and gaps in dashed lines, starting with the first dash length, followed by the first gap length, and so on.
The default distance into the dash pattern at which the pattern are started for new paths.
Default type of joints in new paths.
When a 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. Range: 1 to 500; a value of 1 specifies a bevel join.
DefaultStrokeOverprint Boolean
DefaultStrokeWidth Double
DocumentColorSpace AiDocumentColorSpace
FullName String
GeometricBounds
Gradients Gradients
GraphicStyles GraphicStyles
GraphItems GraphItems
Variant Array of
4
Doubles
If true, the art items beneath a stroked object are overprinted by default.
The default width of stroke for new paths.
Read-only. The color specification system to use for this document’s color space.
Read-only. The file associated with the document, which includes the complete path to the file.
Read-only. The bounds of the illustration excluding the stroke width of any objects in the document.
Read-only. The Gradients collection contained in the document.
Read-only. The GraphicStyles contained in the document.
Read-only. The GraphItems collection contained in the document.
CHAPTER 1: VBScript Object Reference Document 42
Property Value type What it is
GroupItems GroupItems
Height Double
InkList Variant Array
KinsokuSet Object
Layers Layers
LegacyTextItems LegacyTextItems
MeshItems MeshItems
MojikumiSet
Name String
Object Read-only. A list of predefined Mojikumi
Read-only. The GroupItems collection contained in the document.
Read-only. The height of the document, calculated from the
GeometricBounds.
Read-only. The list of inks in this document.
Read-only. The Kinsoku set of characters that cannot begin or end a line of Japanese text.
Read-only. The layers contained in the document.
Read-only. The legacy text items in the document.
Read-only. The mesh art items contained in the document.
sets that specify the spacing for the layout and composition of Japanese text.
Read-only. The document’s name (not the complete file path to the document).
NonNativeItems NonNativeItems
OutputResolution Double
PageItems PageItems
PageOrigin
Variant
2
ParagraphStyles ParagraphStyles
Parent Application
Path String
PathItems PathItems
Patterns Patterns
Array of
Doubles
Read-only. The non-native art items in this document.
Read-only. The current output resolution for the document in dots per inch (dpi).
Read-only. The PageItems (contains all art item classes) contained in the document.
The zero-point of the page in the document without margins, relative to the overall height and width.
Read-only. The list of paragraph styles in this document.
Read-only. The application that contains this document.
Read-only. The file associated with the document, which includes the complete path to the file.
Read-only. The PathItems contained in this document.
Read-only. The patterns contained in this document.
CHAPTER 1: VBScript Object Reference Document 43
Property Value type What it is
PlacedItems PlacedItems
PluginItems PluginItems
PrintTiles Boolean
RasterEffectSettings RasterEffectOptions
RasterItems RasterItems
RulerOrigin
Variant
2
RulerUnits AiRulerUnits
Saved Boolean
Selection
Variant
Array of
Doubles
Array of
objects
Read-only. The PlacedItems contained in this document.
Read-only. The PluginItems contained in this document.
Read-only. If true, this document is tiled when printed.
The document’s raster effect settings.
Read-only. The raster items contained in this document.
The zero-point of the rulers in the document relative to the bottom left corner.
Read-only. The default measurement units for the rulers in the document.
If true, the document has not been changed since the last time it was saved.
The array of references to the objects in this document’s current selection.
ShowPlacedImages Boolean
SplitLongPaths Boolean
Spots Spots
Stationery Boolean
Stories Stories
Swatches Swatches
SwatchGroups SwatchGroups
SymbolItems SymbolItems
Symbols Symbols
Tags Tags
Read-only. If true, placed images are displayed in the document.
Read-only. If true, long paths are split when printing.
Read-only. The SpotColors contained in this document.
Read-only. If true, the file is a stationery file.
Read-only. The story items in this document.
Read-only. The swatches in this document.
Read-only. The swatch groups in this document.
Read-only. The symbol items in this document.
Read-only. The symbols in this document.
Read-only. The tags in this document.
TextFrames TextFrames
Read-only. The text frames in this document.
CHAPTER 1: VBScript Object Reference Document 44
Property Value type What it is
TileFullPages Boolean
UseDefaultScreen Boolean
Variables Variables
VariablesLocked Boolean
Views Views
VisibleBounds
Width Double
XMPString String

Document methods

Variant
4
Doubles
Array of
Read-only. If true, full pages are tiled when printing this document.
Read-only. If true, the printer’s default screen is used when printing this document.
Read-only. The variables in this document.
If true, the Variables in this document are locked.
Read-only. The views in this document.
Read-only. The visible bounds of the document, including stroke width of any objects in the illustration.
Read-only. The width of this document, calculated from the
GeometricBounds.
The XMP metadata packet associated with this document.
Method Returns What it does
Activate
()
Nothing Brings the first window
associated with the document to the front.
Close
([Saving as AiSaveOptions
Capture
(ImageFile as File,
windowSize as Point)
ConvertCoordinate
(Coordinate as Point,
Source as AiCoordinateSystem Destination as AiCoordinateSystem
Copy
()
])
,
)
Nothing Closes the document.
Nothing Captures the current document
window to the target TIFF image file.
Nothing Converts the coordinate system
used for a single point between artboard and document coordinate systems.
Nothing Copies the current selection in
the document to the clipboard; the associated document must be the frontmost document.
Cut
()
Nothing Cuts the current selection in the
document to the clipboard; the associated document must be the frontmost document.
CHAPTER 1: VBScript Object Reference Document 45
Method Returns What it does
Export
(ExportFile as String,
ExportFormat as AiExportType [Options as Object])
ExportPDFPreset
(File as String)
ExportPerspectiveGridPreset
(File as String)
ExportPrintPreset
(File as String)
ExportVariables
(Filename as String)
FitArtboardToSelectedArt
([Index as Long])
Nothing Exports the document to the
specified file using one of the
,
export file formats. Options for various formats are collected in
ExportOptions
Format
objects. The appropriate file extension is automatically appended to the file name, except for Photoshop® documents. For these, you must include the file extension (
.psd)
in the file specification.
Nothing Exports the current PDF preset
values to the file.
Nothing Exports the current perspective
grid preset values to the file.
Nothing Exports the current print preset
values to the file.
Nothing Exports the current variables
from this document to the file.
boolean
Resizes the artboard at the given index to fit currently selected art. Index default is 0. Returns
true
on success.
GetPerspectiveActivePlane
()
HidePerspectiveGrid
()
ImageCapture
(ImageFile as File,
[ClipBounds as Rect], [Options as ImageCaptureOptions
ImportCharacterStyles
(FileSpec as String)
ImportParagraphStyles
(FileSpec as String)
])
AiPerspe ctiveGri dPlaneTy pe
boolean
Retrieves the active plane of the active perspective grid of the document.
Hides the current active grid for the document. If no grid is visible, does nothing. Returns
true if a
grid is hidden.
Nothing Captures the artwork content
within the clipping boundaries in this document as a raster image, and writes the image data to a specified file.
If the bounds parameter is omitted, captures the entire artwork.
Nothing Loads the character styles from
the Illustrator file.
Nothing Loads the paragraph styles from
the Illustrator file.
CHAPTER 1: VBScript Object Reference Document 46
Method Returns What it does
ImportPDFPreset
(FileSpec as String
[, ReplacingPreset as Boolean])
ImportPerspectiveGridPreset
(FileSpec as String
[, PerspectivePreset as String])
ImportPrintPreset
(PrintPreset as String
FileSpec as String)
ImportVariables
(Filename as String)
Paste
()
PrintOut
(Options as PrintOptions
Rasterize
(SourceArt as Variant,
[, ClipBounds as Rect,] [,Options as RasterizeOptions
)
])
Nothing Loads all PDF presets from a file.
Nothing Loads a named perspective-grid
preset from a file, or, if no name is given, all presets in the file.
Nothing Loads the named print preset
from the file.
Nothing Imports Variables from the
specified file into this document.
Nothing Pastes the contents of the
clipboard into the current layer of the document; if the document is the frontmost then all pasted objects remain selected after the paste.
Nothing Prints the document.
PageItem
Rasterizes the source art(s) within the specified clip bounds. The source art(s) is disposed of as a result of the rasterization.
RearrangeArtboards
([ArtboardLayout as AiDocumentArtboardLayout
ArtboardRowsOrCols as Long, ArtboardSpacing as Long, ArtboardMoveArtwork as Boolean])
Save
()
boolean
,
Rearranges artboards in the document. All arguments are optional. Default layout style is
aiGridByRow.
The second argument specifies the number of rows or columns, as appropriate for the chosen layout style, in the range
[1..DocNumArtboards-1], or 1
(the default) for single row/column layouts.
Spacing is a number of pixels, default 20.
When last argument is true (the default), artwork is moved with the artboards.
Nothing Saves the document in its current
location.
CHAPTER 1: VBScript Object Reference Document 47
Method Returns What it does
SaveAs
([SaveIn as String]
[, Options as:
EPSSaveOptions/ IllustratorSaveOptions/ PDFSaveOptions])
SelectObjectsOnActiveArtboard
()
SelectPerspectivePreset
(PresetPreset as String)
SetPerspectiveActivePlane
(PerspectiveGridPlane as
AiPerspectiveGridPlaneType)
ShowPerspectiveGrid
()
Nothing Saves the document in the
specified file as an Illustrator, EPS, or PDF file.
boolean
Selects the objects on the currently active artboard. Returns
true on success.
boolean
Selects a predefined preset to define grid for the current document. Returns
true on
success.
boolean
Sets the active plane of the active perspective grid of the document. Returns
true on
success.
boolean
Shows the current active grid for the document, or if no grid is active, shows the default grid. Returns
true on success.
WindowCapture
(ImageFile as String,
WindowSize as Point)
Nothing Captures the current document
to the target TIFF image file.
Closing documents
If you close the document, you should set your document reference to Nothing to prevent your script accidentally trying to access closed documents.
'Closes the frontmost document without saving
Set appRef = CreateObject("Illustrator.Application") Set docRef = appRef.Documents(1)
docRef.Close 2' aiDoNotSaveChanges Set docRef = Nothing
Creating a document with defaults
'Sets the default stroke and fill in the current document to false
Set appRef = CreateObject("Illustrator.Application")
If (appRef.Documents.Count = 0) Then
Set frontDocument = appRef.Documents.Add
Else
Set frontDocument = appRef.Documents(1)
End If
CHAPTER 1: VBScript Object Reference Document 48
frontDocument.DefaultFilled = False frontDocument.DefaultStroked = False
CHAPTER 1: VBScript Object Reference Documents 49

Documents

A collection of documents.

Documents properties

Property Value type What it is
Application Application
Count Long
Parent
Object Read-only. The parent of this object.

Documents methods

Method Returns What it does
Add
([documentColorSpace As AiDocumentColorSpace
[, width as Double] [, height as Double] [, numArtBoards as Long] [, artboardLayout as AiDocumentArtboardLayout [, artboardSpacing as Double] [, artboardRowsOrCols as Long])
AddDocument
(startupPreset as String,
presetSettings as DocumentPreset)
Index
(item as Document)
Read-only. The Illustrator Application object.
Read-only. The number of objects in the collection.
Document
]
Creates a new document using optional parameters and returns a reference to the new document.
]
Document
Creates a document from the preset, and returns a reference to the new document.
Long
Returns the index position of the object within the collection.
Item
(itemKey)
Creating a document with a color space
'Creates a new RGB document
Set appRef = CreateObject("Illustrator.Application") appRef.Documents.Add 1 'aiDocumentRGBColor
Document
Returns an object reference to the object identified by
itemKey (name or index).
CHAPTER 1: VBScript Object Reference DocumentPreset 50

DocumentPreset

A preset document template to use when creating a new document with AddDocument.

DocumentPreset properties

Property Value type What it is
ArtboardLayout AiDocumentArtboardLayout
ArtboardRowsOrCols Long
ArtboardSpacing Double
Application Application
DocumentColorSpace AiDocumentColorSpace
DocumentPreviewMode AiDocumentPreviewMode
DocumentRasterResolu tion
DocumentTitle String
DocumentTransparency Grid
DocumentUnits AiRulerUnits
AiDocumentRasterResolution
AiDocumentTransparencyGrid
The layout of artboards in the new document. Default:
AiGridByRow
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
Read-only. The Illustrator Application object.
The color space for the new document.
The preview mode for the new document.
The raster resolution for the new document.
The document title.
The transparency grid color for the new document.
The ruler units for the new document.
Height Double
NumArtboards Long
Width Double
The height in points. Default is 792.0
The number of artboards for the new document. Range: 1 to 100. Default: 1
The width in points. Default is 612.0
CHAPTER 1: VBScript Object Reference EPSSaveOptions 51

EPSSaveOptions

Options that may be supplied when saving a document as an Illustrator EPS file. EPSSaveOptions can be supplied only in conjunction with the

EPSSaveOptions properties

Property Value type What it is
document SaveAs method. All properties are optional.
Application Application
ArtboardRange string
CMYKPostScript Boolean
Compatibility AiCompatibility
CompatibleGradientPrinting Boolean
EmbedAllFonts Boolean
EmbedLinkedFiles Boolean
Read-only. The Illustrator
Application object.
If SaveMultipleArtboards is true, this is considered for multi-asset extraction, which specifies the artboard range. An empty string extracts all the artboards. Default: empty string
If true, CMYK PostScript® is used.
Illustrator version compatibility for the EPS file format. Default:
15 ' aiIllustrator15
If true, a raster item of the gradient or gradient mesh are created so the object can be printed on PostScript level 2 printers. Default:
false
If true, fonts are included in the EPS file.
If true, linked image files are included in the saved document.
FlattenOuput AiOutputFlattening
IncludeDocumentThumbnails Boolean
Overprint AiPDFOverprint
PostScript AiEPSPostScriptLevel
Enum
Preview AiEPSPreview
SaveMultipleArtboards boolean
How should transparency be flattened for file formats older than Illustrator 9 or greater.
If true, the thumbnail image of the EPS artwork is included.
The style of overprinting. Default:
1 ' aiPreservePDFOverprint
Specifies the PostScript level to use when saving the file.
Format for the EPS preview image.
If true, all artboards or range of artboards are saved. Default:
false
CHAPTER 1: VBScript Object Reference EPSSaveOptions 52
Saving to EPS
'Saves the current document to dest in EPS format 'dest contains the full path and file name to save to
Sub exportFileAsEPS (dest)
Set appRef = CreateObject("Illustrator.Application") Set newSaveOptions = CreateObject("Illustrator.EPSSaveOptions")
If appRef.Documents.Count > 0 Then
newSaveOptions.CMYKPostScript = True newSaveOptions.EmbedAllFonts = True Set frontDocument = appRef.ActiveDocument frontDocument.SaveAs dest, newSaveOptions
End If
End Sub
CHAPTER 1: VBScript Object Reference ExportOptionsAutoCAD 53

ExportOptionsAutoCAD

Options for exporting a document as an AutoCAD file, used with the Document Export method. All properties are optional.
When you export a document, the default file extension (DWG) is appended automatically. You should not include a file extension in the file specification. To override the default AutoCAD export format, use the
ExportFileFormat

ExportOptionsAutoCAD properties

Property Value type What it is
property.
AlterPathsForAppearance Boolean
Application Application
Colors AiAutoCADColors
ConvertTextToOutlines Boolean
ExportFileFormat AiAutoCADExportFileFormat
ExportOption AiAutoCADExportOption
ExportSelectedArtOnly Boolean
RasterFormat AiAutoCADRasterFormat
ScaleLineweights Boolean
If true, paths are altered (if needed) to maintain appearance. Default:
false
Read-only. The Illustrator
Application object.
The number of colors to export into the AutoCAD file.
If true, text is converted to outlines. Default:
false
The file format to which to export. Default:
1 'aiDWG
Whether to preserve appearance or editability during export. Default:
1 ' aiMaximumEditability
If true, only selected artwork is exported. Default:
false
The format in which to export raster art.
If true, line weights are scaled by the same scaling factor as the rest of the drawing. Default:
false
Unit AiAutoCADUnit
UnitScaleRatio Double
Version AiAutoCADCompatibility
Measurement units from which to map.
The ratio by which to scale output.
The release of AutoCAD to export to.
CHAPTER 1: VBScript Object Reference ExportOptionsFlash 54

ExportOptionsFlash

Specifies options that you can supply when exporting a document as Macromedia® Flash® (SWF) with the
Document Export method.
When you export a document, the appropriate file extension is appended automatically. You should not include a file extension in the file specification.
Allproperties are optional.

ExportOptionsFlash properties

Property Value type What it is
Application Application
ArtboardRange string
ArtClipping AiArtClippingOption
BackgroundColor RGBColor
BackgroundLayers
BlendAnimation AiBlendAnimationType
Compressed Boolean
ConvertTextToOutlines Boolean
Variant
Array of Layer A list of layers to be included as the static
Read-only. The Illustrator Application object.
If SaveMultipleArtboards is true, this is considered for multi-asset extraction, which specifies the artboard range. An empty string extracts all the artboards. Default: empyt string
How the art is clipped during the output. Default:
1 ' aiOutputArtBounds
The background color of the exported Flash frames.
background of the exported Flash frames.
How the blend art objects are animated when exported to Flash frames. Default:
0 ' aiNoBlendAnimation
If true, the exported file is compressed when exported. Default:
false
If true, all text is converted to outlines. Default:
false
CurveQuality Long
ExportAllSymbols Boolean
ExportStyle AiFlashExportStyle
ExportVersion AiFlashExportVersion
The amount of curve information that is preserved. Range: 0 to 10, Default:
7
If true, all symbols defined in the palette are exported. Default:
false
The style in which the exported data are created in Flash. Default:
2 ' aiAsFlashFile
The version of the exported SWF file. Default:
9 ' aiFlashVersion9
CHAPTER 1: VBScript Object Reference ExportOptionsFlash 55
Property Value type What it is
FrameRate Double
IgnoreTextKerning Boolean
ImageFormat AiFlashImageFormat
IncludeMetadata Boolean
JPEGMethod AiFlashJPEGMethod
JPEGQuality Long
LayerOrder AiLayerOrderType
Looping Boolean
PlaybackAccess AiFlashPlaybackSecurity
The display rate in frames per second. Range: 0.01 to 120.0; Default:
12.0
If true, kerning information is ignored in text objects. Default:
false
How the image in the exported Flash file is compressed. Default:
1 ' aiLossless
If true, includes minimal XMP metadata in the SWF file. Default:
false
The JPEG method to use. Default:
1 ' aiJPEGStandard
Level of compression to use. Range: 0 to 10. Default:
3
The order in which layers are exported to Flash frames. Default:
1 ' aiBottomUp
If true, the Flash file are set to loop when run. Default:
false
The access level for the exported SWF file. Default:
1 ' aiPlaybackLocal
PreserveAppearance Boolean
ReadOnly Boolean
Replacing AiSaveOptions
Resolution Double
SaveMultipleArtboards boolean
If true, preserve appearance. If false, preserve editability. Default:
false
If true, the file is exported as read-only. Default:
false
If a file with the same name already exists, should it be replaced. Default:
1 ' aiPromptToSaveChanges
The resolution in pixels per inch. Range: 72 to 2400. Default:
72
If true, all artboards or range of artboards are saved. Default:
false
CHAPTER 1: VBScript Object Reference ExportOptionsGIF 56

ExportOptionsGIF

Options that may be supplied when exporting a document as a GIF file. See the Document Export method for additional details.
When you export a document, the appropriate file extension is appended automatically. You should not include a file extension in the file specification.

ExportOptionsGIF properties

Property Value type What it is
AntiAliasing Boolean
Application Application
ArtBoardClipping Boolean
ColorCount Long
ColorDither AiColorDitherMethod
ColorReduction AiColorReductionMethod
DitherPercent Long
HorizontalScale Double
InfoLossPercent Long
If true, the exported image is anti-aliased. Default:
true
Read-only. The Illustrator Application object.
If true, the exported image is clipped to the art board. Default:
false
The number of colors in the exported image’s color table. Range: 2 to 256. Default:
128
The method used to dither colors in the exported image. Default:
&H4466736E ' aiDiffusion
The method used to reduce the number of colors in the exported image. Default:
&H536C7476 ' aiSelective
The amount that the colors of the exported image are dithered, where 100.0 is 100%
The horizontal scaling factor applied to the exported image, where 100.0 is 100%. Default:
100.0
The level of information loss allowed during compression, where 100.0 is 100%. Default:
0
Interlaced Boolean
Matte Boolean
MatteColor RGBColor
SaveAsHTML Boolean
Transparency Boolean
If true, the exported image is interlaced. Default:
false
If true, the art board is matted with a color. Default:
true
The color to use when matting the art board. Default:
white
If true, the exported image is saved with an accompanying HTML file. Default:
false
If true, the exported image uses transparency. Default:
true
CHAPTER 1: VBScript Object Reference ExportOptionsGIF 57
Property Value type What it is
VerticalScale Double
The vertical scaling factor applied to the exported image, where 100.0 is 100%. Default:
100.0
WebSnap Long
How much should the color table be changed to match the web palette, where 100 is maximum. Default:
0
Exporting as GIF
'Exports the current document as GIF to dest 'dest contains the full path and file name to save to
Sub exportFileAsGIF (dest)
Set appRef = CreateObject("Illustrator.Application") Set gifExportOptions = CreateObject("Illustrator.ExportOptionsGIF")
If appRef.Documents.Count > 0 Then
gifExportOptions.AntiAliasing = False gifExportOptions.ColorCount = 64 gifExportOptions.ColorDither = 1147564910'aiDiffusion Set docRef = appRef.ActiveDocument Call docRef.Export (dest, 6, gifEportOptions)' 6 = aiGIF
End If
End Sub
CHAPTER 1: VBScript Object Reference ExportOptionsJPEG 58

ExportOptionsJPEG

Options that may be supplied when exporting a document as a JPEG file. See the Document Export method for additional details.
When you export a document, the appropriate file extension is appended automatically. You should not include a file extension in the file specification.

ExportOptionsJPEG

Property Value type What it is
AntiAliasing Boolean
Application Application
ArtBoardClipping Boolean
BlurAmount Double
HorizontalScale Double
Matte Boolean
MatteColor RGBColor
Optimization Boolean
QualitySetting Long
SaveAsHTML Boolean
VerticalScale Double
If true, the exported image is anti-aliased. Default: true
Read-only. The Illustrator Application object.
If true, the exported image is clipped to the art board. Default:
false
The amount of blur to apply to the exported image. Range: 0.0 to 2.0. Default:
0.0
The horizontal scaling factor applied to the exported image, where 100.0 is 100%. Default:
100.0
If true, the art board is matted with a color. Default: true
The color to use when matting the art board. Default: white
If true, the exported image is optimized for web viewing. Default:
true
The quality of the exported image. Range: 0 to 100. Default: 30
If true, the exported image is saved with an accompanying HTML file. Default:
false
The vertical scaling factor applied to the exported image, where 100.0 is 100%. Default:
100.0
CHAPTER 1: VBScript Object Reference ExportOptionsJPEG 59
Exporting to JPEG
'Exports the current document as JPEG to dest 'dest contains the full path and file name to save to
Sub exportFileAsJPEG (dest)
Set appRef = CreateObject("Illustrator.Application") Set jpegExportOptions = CreateObject("Illustrator.ExportOptionsJPEG")
If appRef.Documents.Count > 0 Then
jpegExportOptions.AntiAliasing = False jpegExportOptions.QualitySetting = 70 Set docRef = appRef.ActiveDocument Call docRef.Export (dest, 1, jpegExportOptions) ' 1 = aiJPEG
End If
End Sub
CHAPTER 1: VBScript Object Reference ExportOptionsPhotoshop 60

ExportOptionsPhotoshop

Options that may be supplied when exporting a document as an Adobe Photoshop® file. See the
Document Export method for additional details.
When you export a document, the appropriate file extension is appended automatically. You should not include a file extension in the file specification.
All properties are optional.

ExportOptionsPhotoshop properties

Property Value type What it is
AntiAliasing Boolean
Application Application
ArtboardRange string
EditableText Boolean
EmbedICCProfile Boolean
ImageColorSpace AiImageColorSpace
MaximumEditability Boolean
Resolution Double
SaveMultipleArtboards boolean
If true, the exported image is anti-aliased. Default:
true
Read-only. The Illustrator Application object.
If SaveMultipleArtboards is true, this is considered for multi-asset extraction, which specifies the artboard range. An empty string extracts all the artboards. Default: empty string
If true, text objects are exported as editable text layers. Default:
true
If true, an ICC profile are embedded in the exported file. Default:
false
The color space of the exported file. Default:
aiImageRGB ' 2
If true, preserve as much of the original document’s structure as possible when exporting. Default:
true
The resolution of the exported file in dots per inch. Range: 72 to 2400. Default:
150
If true, all artboards or range of artboards are saved. Default:
false
Warnings Boolean
WriteLayers Boolean
If true, a warning dialog are displayed because of conflicts in the export settings. Default:
true
If true, the document layers are preserved in the exported file. Default:
true
CHAPTER 1: VBScript Object Reference ExportOptionsPhotoshop 61
Exporting to Photoshop
This example exports the current document as a Photoshop 5 file with layers.
'Exports the current document as PSD (Photoshop) to dest 'dest contains the full path and file name to save to
Sub exportFileAsPSD (dest)
Set appRef = CreateObject("Illustrator.Application") Set psdExportOptions = CreateObject("Illustrator.ExportOptionsPhotoshop")
If appRef.Documents.Count > 0 Then
psdExportOptions.Resolution = 150 Set docRef = appRef.ActiveDocument Call docRef.Export (dest, 2, psdExportOptions) ' 2 = aiPhotoshop
End If
End Sub
CHAPTER 1: VBScript Object Reference ExportOptionsPNG8 62

ExportOptionsPNG8

Options that may be supplied when exporting a document as an 8-bit PNG file. See the Document Export method for additional details.
When you export a document, the appropriate file extension is appended automatically. You should not include a file extension in the file specification.

ExportOptionsPNG8 properties

Property Value type What it is
AntiAliasing Boolean
Application Application
ArtBoardClipping Boolean
ColorCount Long
ColorDither AiColorDitherMethod
ColorReduction AiColorReductionMethod
DitherPercent Long
HorizontalScale Double
Interlaced Boolean
If true, the exported image is anti-aliased. Default:
true
Read-only. The Illustrator Application object.
If true, the exported image is clipped to the art board. Default:
false
The number of colors in the exported image’s color table. Range: 2 to 256. Default:
128
The method used to dither colors in the exported image. Default:
&H4466736E ' aiDiffusion
The method used to reduce the number of colors in the exported image. Default:
&H536C7476 ' aiSelective
Specifies how much the colors of the exported image are dithered, where 100.0 is 100%
The horizontal scaling factor applied to the exported image, where 100.0 is 100%. Default:
100.0
If true, the exported image are interlaced. Default:
false
Matte Boolean
MatteColor RGBColor
SaveAsHTML Boolean
Transparency Boolean
If true, the art board is matted with a color. Default:
true
The color to use when matting the art board. Default:
white
If true, the exported image is saved with an accompanying HTML file. Default:
false
If true, the exported image uses transparency. Default:
true
CHAPTER 1: VBScript Object Reference ExportOptionsPNG8 63
Property Value type What it is
VerticalScale Double
The vertical scaling factor applied to the exported image, where 100.0 is 100%. Default:
WebSnap Long
Specifies how much the color table are changed to match the Web palette, where 100 is maximum. Default:
0
Exporting to PNG8
This example exports the current document as a PNG8 file.
'Exports the current document as PNG8 to dest 'dest contains the full path and file name to save to
Sub exportFileAsPNG (dest)
Set appRef = CreateObject("Illustrator.Application") Set png8ExportOptions = CreateObject("Illustrator.ExportOptionsPNG8")
If appRef.Documents.Count > 0 Then
png8ExportOptions.AntiAliasing = False png8ExportOptions.Interlaced = True Set docRef = appRef.ActiveDocument Call docRef.Export (dest, 4, png8ExportOptions) ' 4 = aiPNG8
End If
End Sub
100.0
CHAPTER 1: VBScript Object Reference ExportOptionsPNG24 64

ExportOptionsPNG24

Options that may be supplied when exporting a document as a 24-bit PNG file. See the Document Export method for additional details.
When you export a document, the appropriate file extension is appended automatically. You should not include a file extension in the file specification.

ExportOptionsPNG24 properties

Property Value type What it is
AntiAliasing Boolean
Application Application
ArtBoardClipping Boolean
HorizontalScale Double
Matte Boolean
MatteColor RGBColor
SaveAsHTML Boolean
Transparency Boolean
VerticalScale Double
If true, the exported image is anti-aliased. Default: true
Read-only. The Illustrator Application object.
If true, the exported image is clipped to the art board. Default:
false
The horizontal scaling factor applied to the exported image, where 100.0 is 100%. Default:
100.0
If true, the art board is matted with a color. Default: true
The color to use when matting the art board. Default: white
If true, the exported image is saved with an accompanying HTML file. Default:
false
If true, the exported image uses transparency. Default: true
The vertical scaling factor applied to the exported image, where 100.0 is 100%. Default:
100.0
CHAPTER 1: VBScript Object Reference ExportOptionsPNG24 65
Exporting to PNG24
This example exports the current document as a PNG24 file with specific options.
'Exports current document as PNG24 to dest 'dest contains the full path and file name to save to
Sub exportFileAsPNG (dest)
Set appRef = CreateObject("Illustrator.Application") Set png24ExportOptions = CreateObject("Illustrator.ExportOptionsPNG24")
If appRef.Documents.Count > 0 Then
png24ExportOptions.AntiAliasing = False png24ExportOptions.Transparency = False Set docRef = appRef.ActiveDocument Call docRef.Export (dest, 5, png24ExportOptions) ' 5 = aiPNG24
End If
End Sub
CHAPTER 1: VBScript Object Reference ExportOptionsSVG 66

ExportOptionsSVG

Options that may be supplied when exporting a document as a SVG file. See the Document Export method for additional details.
When you export a document, the appropriate file extension is appended automatically. You should not include a file extension in the file specification.

ExportOptionsSVG properties

Property Value type What it is
Application Application
Compressed Boolean
CoordinatePrecision Long
CSSProperties AiSVGCSSPropertyLocation
DocumentEncoding AiSVGDocumentEncoding
DTD AiSVGDTDVersion
EmbedRasterImages Boolean
Read-only. The Illustrator
Application object.
If true, the exported file is compressed. Default:
false
The decimal precision for element coordinate values. Range: 1 to 7. Default:
3
Specifies how the CSS properties of the document are included in the exported file
Specifies how the text in the do cu me nt is e nc od ed . D e fa ul t:
' aiASCII
1
The SVG version to which the file should conform. Default:
2 ' aiSVG1_1
If true, all raster images contained in the document are embedded in the saved file.
FontSubsetting AiSVGFontSubsetting
FontType AiSVGFontType
IncludeFileInfo Boolean
IncludeVariablesAndDatasets Boolean
The font glyphs included in the export file.
The type of font included in the exported file. Default:
aiCEFFont
1 '
If true, the XMP (Extensible Metadata Platform) metadata are included in the output file. Default:
false
If true, Variables and
Datasets are included. Default: false
CHAPTER 1: VBScript Object Reference ExportOptionsSVG 67
Property Value type What it is
OptimizeForSVGViewer Boolean
PreserveEditability Boolean
Slices Boolean
SVGAutoKerning Boolean
SVGTextOnPath Boolean
Exporting to SVG
'Exports the current document as SVG to dest 'dest contains the full path and file name to save to
If true, the Adobe namespace is included. Default:
false
If true, preserve Illustrator editing capability when exporting the document. Default:
false
If true, preserve slice data in exported document. Default:
false
If true, SVG automatic kerning is allowed in the file. Default:
false
If true, the SVG text-on-path construct is allowed in the file. Default:
false
Sub exportFileAsSVG (dest)
Set appRef = CreateObject("Illustrator.Application") Set svgExportOptions = CreateObject("Illustrator.ExportOptionsSVG")
If appRef.Documents.Count > 0 Then
svgExportOptions.EmbedRasterImages = True svgExportOptions.FontSubsetting = 7 'aiAllGlyphs Set docRef = appRef.ActiveDocument Call docRef.Export (dest, 3, svgExportOptions) ' 3 = aiSVG
End If
End Sub
CHAPTER 1: VBScript Object Reference ExportOptionsTIFF 68

ExportOptionsTIFF

Options that may be supplied when exporting a document as a TIFF file. See the Document Export method for additional details.
When you export a document, the appropriate file extension is appended automatically. You should not include a file extension in the file specification.
All properties are optional.

ExportOptionsTIFF properties

Property Value type What it is
AntiAliasing boolean
If true, the exported image should be anti-aliased. Default:
ArtboardRange string
If SaveMultipleArtboards is true, this is considered for multi-asset extraction, which specifies the artboard range. An empty string extracts all the artboards. Default: empty string
ByteOrder AiTIFFByteOrder
ImageColorSpace AiImageColorSpace
The byte order to use in the new file.
The color space of the exported file. Default:
IZWCompression boolean
Resolution number (double)
If true, use IZW compression in the new file.
Resolution of the exported file in dots per inch (dpi). Range: 72.0 to 2400.0. Default: 150.0
SaveMultipleArtboards boolean
If true, all artboards or range of artboards are saved. Default:
Exporting to TIFF format
'Exports the current document as TIFF to dest 'dest contains the full path and file name to save to
true
aiImageRGB ' 2
false
Sub exportFileAsTIFF (dest)
Set appRef = CreateObject("Illustrator.Application") Set tiffExportOptions = CreateObject("Illustrator.ExportOptionsTIFF")
If appRef.Documents.Count > 0 Then
tiffExportOptions.imageColorSpace = 2 'aiImageRGB tiffExportOptions.resolution = 150 tiffExportOptions.lZWCompression = true
Set docRef = appRef.ActiveDocument Call docRef.Export (dest, 9, tiffExportOptions) ' 9 = aiTIFF
End If
End Sub
CHAPTER 1: VBScript Object Reference FreeHandFileOptions 69

FreeHandFileOptions

Options for opening a FreeHand file.

FreeHandFileOptions properties

Property Value type What it is
Application Applicatio
n
ConvertTextToOutlines Boolean
ImportSinglePage Boolean
PageToOpen Long
Parent Document
Read-only. The Illustrator Application object.
If true, converts all text to outlines. Default: false
If true, imports only the page specified in the
PageToOpen property. Default: true
The number of the page to import when opening a multipage document. Valid only when
ImportSinglePage is true.
Read-only. The document that contains this object.
CHAPTER 1: VBScript Object Reference FXGSaveOptions 70

FXGSaveOptions

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

FXGSaveOptions properties

Property Value type What it is
Application Application
ArtboardRange string
BlendsPolicy AiBlendsExpandPolicy
DownsampleLinkedImages boolean
FiltersPolicy AiFiltersPreservePolicy
GradientsPolicy AiGradientsPreservePolicy
Read-only. The Illustrator
Application object.
If SaveMultipleArtboards 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:
AiAutomaticallyConvertBlends
If true, linked images are downsampled (at 72 dpi). Default:
false
The policy used by FXG to preserve filters. Default:
3'aiKeepFiltersEditable
The policy used by FXG to preserve gradients. Default:
4'aiAutomaticallyConvertGrad ients
IncludeUnusedSymbols boolean
PreserveEditingCapabilities boolean
SaveMultipleArtboards boolean
TextPolicy AiTextPreservePolicy
Version AiFXGVersion
If true, unused symbols are included. Default:
false
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:
4'aiAutomaticallyConvertText
The version of the FXG file format to create. Default:
2'aiVersion2Pt0
CHAPTER 1: VBScript Object Reference Gradient 71

Gradient

A gradient definition contained in a document. A script can create new gradients.

Gradient properties

Property Value type What it is
Application Application
GradientStops GradientStops
Name String
Parent Document
Type AiGradientType

Gradient methods

Method Returns What it does
Delete
()
Creating and applying a gradient
'Creates a new gradient in the current document with 2 'gradient stops, then applies the gradient to the front­'most path item
Set appRef = CreateObject("Illustrator.Application") Set frontDocument = appRef.ActiveDocument
Read-only. The Illustrator Application object.
Read-only. The gradient stops contained in this gradient.
The gradient’s name.
Read-only. The document that contains this gradient.
The kind of the gradient, either radial or linear.
Nothing Deletes the object.
'Create a color for both ends of the gradient Set startColor = CreateObject("Illustrator.RGBColor") Set endColor = CreateObject("Illustrator.RGBColor")
startColor.Red = 0 startColor.Green = 100 startColor.Blue = 255 endColor.Red = 220 endColor.Green = 0 endColor.Blue = 100
'Create a new gradient 'new gradients always have 2 stops Set newGradient = frontDocument.Gradients.Add newGradient.Name = "Gradient created from script" newGradient.Type = 1 'aiLinearGradient
'Modify the first gradient stop. Set locationSpecification = newGradient.GradientStops(1)
CHAPTER 1: VBScript Object Reference Gradient 72
locationSpecification.RampPoint = 30 locationSpecification.MidPoint = 60 locationSpecification.Color = startColor
'Modify the last gradient stop. 'The MidPoint for the last gradient stop is ignored Set locationSpecification = newGradient.GradientStops(2) locationSpecification.RampPoint = 80 locationSpecification.Color = endColor
'construct an Illustrator.GradientColor object referring to the 'newly created gradient Set ColorOfGradient = CreateObject("Illustrator.GradientColor") ColorOfGradient.Gradient = newGradient
'now get the frontmost path item and 'apply the new gradient as its fill Set topPath = frontDocument.PathItems(1) topPath.Filled = True topPath.fillColor = ColorOfGradient
CHAPTER 1: VBScript Object Reference GradientColor 73

GradientColor

A gradient color specification, used in conjunction with the Gradient property of the Color specification.
A script can create a
GradientColor using a reference to an existing gradient in the application. If no
existing gradient object is referenced, a default gradient is supplied. An origin is used to specify the center point of the gradient in this specific gradient color. Single values are used to specify the gradient vector angles and lengths. A matrix may be specified to further transform the gradient color.

GradientColor properties

Property Value type What it is
Angle Double
Application Application
Gradient Gradient
HiliteAngle Double
HiliteLength Double
Length Double
Matrix Matrix
Origin
Variant Array of
2
Doubles
The gradient vector angle in degrees.
Read-only. The Illustrator Application object.
Reference to the object defining the gradient.
The gradient hilite vector angle in degrees.
The gradient hilite vector length.
The gradient vector length.
An additional transformation matrix to manipulate the gradient path.
The gradient vector origin.
Changing a gradient color
'Creates a new RGB color then applies it as the color 'at the first gradient stop of the first gradient
Set appRef = CreateObject("Illustrator.Application")
Set frontDocument = appRef.Documents.Add(1) ' aiDocumentRGBColor
'Get a reference to the gradient that you want to change Set firstGradient = frontDocument.Gradients(1)
'Create the new color Set startColor = CreateObject("Illustrator.RGBColor") startColor.Red = 0 startColor.Green = 255 startColor.Blue = 0
firstGradient.GradientStops(1).Color = startColor
CHAPTER 1: VBScript Object Reference Gradients 74

Gradients

A collection of Gradient objects in a document.

Gradients properties

Property Value type What it is
Application Application
Count Long
Parent Document

Gradients methods

Method Returns What it does
Add
()
Index
(item as Gradient)
Item
(itemKey)
RemoveAll
()
Removing a gradient
Read-only. The Illustrator Application object.
Read-only. The number of objects in the collection.
Read-only. The parent document of this object.
Gradient
Long
Gradient
Creates a new object
Returns the index position of the object within the collection.
Returns an object reference to the object identified by itemKey (name or index).
Nothing Deletes all objects in this collection.
'Deletes the first gradient in the current document
Set appRef = CreateObject("Illustrator.Application") Set frontDocument = appRef.ActiveDocument
'Get a reference to the gradient that you want to delete Set gradientToDelete = frontDocument.Gradients(1)
'Now delete the gradient using the collection frontDocument.Gradients.Remove gradientToDelete
CHAPTER 1: VBScript Object Reference GradientStop 75

GradientStop

A gradient stop definition contained in a specific gradient. Represents a point on a gradient that specifies a color change. For an example, see GradientColor

GradientStop properties

Property Value type What it is
.
Application Application
Color Color info
Midpoint Double
Opacity Double
Parent Document
RampPoint Double

GradientStop methods

Method Returns What it does
Delete
()
Read-only. The Illustrator Application object.
The color linked to this gradient stop.
The distance between two GradientStops, in percentage. Range: 13.0 to 87.0
The opacity value for the gradient stop. Range: 0.0 to 100.0
Read-only. The document that contains this gradient stop.
The location of the color in the blend. Range: 0.0 to 100.0, where 100.0 is 100%
Nothing Deletes the object.
CHAPTER 1: VBScript Object Reference GradientStops 76

GradientStops

A collection of GradientStop objects in a specific gradient.

GradientStops properties

Property Value type What it is
Application Application
Count Long
Parent Document

GradientStops methods

Method Returns What it does
Add
()
Index
(item as GradientStop)
Item
(itemKey)
RemoveAll
()
Read-only. The Illustrator Application object.
Read-only. The number of objects in the collection.
Read-only. The document that contains this object.
GradientStop
Long
Creates a new object
Returns the index position of the object within the collection.
GradientStop
Returns an object reference to the object identified by
itemKey (name or index).
Nothing Deletes all objects in this collection.
CHAPTER 1: VBScript Object Reference GradientStops 77
Adding a new gradient stop
'Adds a new gray gradient stop to an existing gradient
Set appRef = CreateObject("Illustrator.Application") Set frontDocument = appRef.ActiveDocument
'Get a reference to the gradient that you want to change Set changeGradient = frontDocument.Gradients(1)
'Get a reference to the gradient stop that is the last one 'before you add a new gradient stop originalCount = changeGradient.GradientStops.Count Set lastStop = changeGradient.GradientStops(originalCount)
'add the new gradient stop Set newStop = changeGradient.GradientStops.Add
'Set the values of the new gradient stop. move the original 'last gradient stop a bit to the left, and 'insert the new gradient stop at the old gradient stop's position newStop.RampPoint = lastStop.RampPoint lastStop.RampPoint = lastStop.RampPoint - 10
'Create a new color to apply to the newly created gradient stop 'choose a Gray tint value of 70% Set newStopColor = CreateObject("Illustrator.GrayColor") newStopColor.Gray = 70 newStop.Color = newStopColor
CHAPTER 1: VBScript Object Reference GraphicStyle 78

GraphicStyle

Each graphic style defines a set of appearance attributes that you can apply to PageItem objects. Graphic styles are contained in documents. Scripts cannot create new graphic styles.

GraphicStyle properties

Property Value type What it is
Application Application
Name String
Parent Document

GraphicStyle methods

Method Returns What it does
ApplyTo
(artItem as PageItem)
MergeTo
(artItem as PageItem)
Delete
()
Applying a graphic style
This example duplicates and groups the current selection, applying the second graphic style in the document to the items in the group.
Read-only. The Illustrator Application object.
The GraphicStyle name.
Read-only. The document that contains this object.
Nothing Applies the GraphicStyle to a specific art item.
Nothing Merges this style into the current styles of a specified art item.
Nothing Deletes the object.
'Creates a new group item, adds a duplicate of each 'selected item to the group then applies a graphic style 'to the group
Set appRef = CreateObject("Illustrator.Application")
If appRef.Documents.Count > 0 Then
If Not IsEmpty(appRef.Selection) Then
mySelection = appRef.Selection endIndex = UBound(mySelection) startIndex = LBound(mySelection) Set newGroup = appRef.ActiveDocument.GroupItems.Add For i = startIndex To endIndex
Set artItem = mySelection(i) Set dupItem = artItem.Duplicate(newGroup, aiPlaceAtEnd) appRef.ActiveDocument.GraphicStyles(2).ApplyTo dupItem
Next
End If
End If
CHAPTER 1: VBScript Object Reference GraphicStyles 79

GraphicStyles

A collection of graphic styles in a document.

GraphicStyles properties

Property Value type What it is
Application Application
Count Long
Parent Document

GraphicStyles methods

Method Returns What it does
Index
(item as GraphicStyle)
Item
(itemKey)
RemoveAll
()
Counting graphic styles
'Counts the number of graphic styles in the current document 'and stores in numStyles
Read-only. The Illustrator Application object.
Read-only. The number of objects in the collection.
Read-only. The document that contains this object.
Long
GraphicStyle
Nothing
Returns the index position of the object within the collection.
Returns an object reference to the object identified by
itemKey (name or index).
Deletes all objects in this collection.
Set appRef = CreateObject("Illustrator.Application")
If appRef.Documents.Count > 0 Then
numStyles = appRef.ActiveDocument.GraphicStyles.Count
End If
CHAPTER 1: VBScript Object Reference GraphItem 80

GraphItem

A graph artwork item. Scripts cannot create new graph items.

GraphItem properties

Property Value type What it is
Application Application
ArtworkKnockout AiKnockoutState
BlendingMode AiBlendModes
ContentVariable Variable
ControlBounds
Variant
4
Editable Boolean
GeometricBounds
Variant Array of
4
Height Double
Hidden Boolean
IsIsolated Boolean
Array of
Doubles
Doubles
Read-only. The Illustrator Application object.
Is this GraphItem used to create a knockout, and if so, what kind.
The mode used when compositing an object.
The content variable bound to this GraphItem.
It is not necessary to set the type of the
ContentVariable before binding. Illustrator
automatically sets the type to
AiGraph.
Read-only. The bounds of the object including stroke width and controls.
Read-only. If true, the GraphItem is editable.
Read-only. The bounds of the
GraphItem excluding
stroke width.
The height of the GraphItem, calculated on the
GeometricBounds.
If true, this GraphItem is hidden.
If true, this GraphItem is isolated.
Layer Layer
Left Double
Locked Boolean
Name String
Note String
Opacity Double
Parent Layer or
GroupItem
Position
Variant
2
Selected Boolean
Array of
Doubles
Read-only. The Layer to which this GraphItem belongs.
The position of the left side of the GraphItem (in points, measured from the left side of the page).
If true, this GraphItem is locked.
The name of this GraphItem.
The note assigned to this GraphItem.
The opacity of the GraphItem. Range: 0.0 to 100.0
Read-only. The parent of this GraphItem.
The position (in points) of the top left corner of the item in the format [x, y]. Does not include stroke weight.
If true, this GraphItem is selected.
CHAPTER 1: VBScript Object Reference GraphItem 81
Property Value type What it is
Sliced Boolean
Tags Tags
Top Double
URL String
VisibilityVariable Variable
VisibleBounds
Width Double
WrapInside Boolean
WrapOffset Double
Variant
4
Doubles
Array of
If true, this GraphItem is sliced. Default: false
Read-only. The collection of Tags contained in this
GraphItem.
The position of the top of the item (in points, measured from the bottom of the page).
The value of the Adobe URL tag assigned to this
GraphItem.
The visibility variable bound to this GraphItem.
It is not necessary to set the type of the
VisibilityVariable before binding. Illustrator
automatically sets the type to
Read-only. The visible bounds of the
AiVisibility.
GraphItem
including stroke width.
The width of the GraphItem, based on the
GeometricBounds.
If true, the text frame object is wrapped inside this object.
The offset to use when wrapping text around this object.
Wrapped Boolean
ZOrderPosition Long

GraphItem methods

Method Returns What it does
Copy
()
Cut
()
Delete
()
If true, wrap text frame objects around this object (text frame must be above the object).
Read-only. The position of this GraphItem within the stacking order of the that contains the
GroupItem or Layer (Parent)
GraphItem.
Nothing Copies the GraphItem to the
clipboard; the associated document must be the frontmost document.
Nothing Cuts the GraphItem to the clipboard;
the associated document must be the frontmost document.
Nothing Deletes the object.
CHAPTER 1: VBScript Object Reference GraphItem 82
Method Returns What it does
Duplicate
([relativeObject as Object],
[insertionLocation as
AiElementPlacement
Move
(relativeObject as Object,
insertionLocation as
AiElementPlacement
Resize
(scaleX as Double,
scaleY as Double, [, changePositions as Boolean] [, changeFillPatterns as Boolean] [, changeFillGradients as Boolean] [, changeStrokePattern as Boolean] [, changeLineWidths as Double] [,scaleAbout as AiTransformation
Rotate
(angle as Double,
[, changePositions as Boolean]
[, changeFillPatterns as Boolean]
[, changeFillGradients as Boolean] [, changeStrokePattern as Boolean] [, rotateAbout as AiTransformation
])
)
])
])
Object Duplicates the art item, optionally
specifying the location and position for the copy.
Nothing Moves the art item, specifying the
new location and position.
Nothing Scales the GraphItem where scaleX
is the horizontal scaling factor and
scaleY is the vertical scaling factor.
100.0 = 100%
Nothing Rotates the GraphItem relative to the
current rotation; counter-clockwise if the
Angle value is positive, clockwise
if the value is negative.
Transform
(transformationMatrix as Matrix,
[, changePositions as Boolean] [, changeFillPatterns as Boolean] [, changeFillGradients as Boolean] [, changeStrokePattern as Boolean] [, changeLineWidths as Double] [, transformAbout as AiTransformation
Translate
([deltaX as Double]
[, deltaY as Double] [, transformObjects as Boolean] [, transformFillPatterns as Boolean] [, transformFillGradients as Boolean] [, transformStrokePatterns as Boolean])
ZOrder
(zOrderCmd as AiZOrderMethod
)
Nothing Transforms the GraphItem by
applying a transformation matrix.
])
Nothing Repositions the GraphItem relative
to the current position, where
deltaX is the horizontal offset and deltaY is the vertical offset.
Nothing Arranges the GraphItem’s positi o n in
the stacking order of the group or layer (
Parent) of this object.
CHAPTER 1: VBScript Object Reference GraphItem 83
Rotating graph items
'Rotates each graph item in the current document 90 degrees.
Set appRef = CreateObject("Illustrator.Application")
'Rotate each graph item 90 degrees For Each graphRef In appRef.ActiveDocument.GraphItems
graphRef.Rotate 90 Next appRef.Redraw
CHAPTER 1: VBScript Object Reference GraphItems 84

GraphItems

A collection of GraphItem objects.

GraphItems properties

Property Value type What it is
Application Application
Count Long
Parent Document

GraphItems methods

Method Returns What it does
Index
(item as GraphItem)
Item
(itemKey)
RemoveAll
()
Long
GraphItem
Nothing
Read-only. The Illustrator Application object.
Read-only. The number of objects in the collection.
Read-only. The document that contains this object.
Returns the index position of the object within the collection.
Returns an object reference to the object identified by
itemKey (name or index).
Deletes all objects in this collection.
CHAPTER 1: VBScript Object Reference GrayColor 85

GrayColor

A grayscale color specification used to apply a gray color to a layer or art item.

GrayColor properties

Property Value type What it is
Application Application
Gray Double
Read-only. The Illustrator Application object.
The tint of the gray. Range: 0.0 to 100.0, where 0.0 is black and
100.0 is white.
Changing word color to gray
'Sets the fill color of the first word in the document to gray
Set appRef = CreateObject("Illustrator.Application") Set textColor = CreateObject("Illustrator.GrayColor")
'Get a reference to the first word in the active document Set text = appRef.ActiveDocument.TextFrames(1).TextRange Set firstWord = text.Words(1)
'Create the new color textColor.Gray = 45
firstWord.CharacterAttributes.fillColor = textColor
CHAPTER 1: VBScript Object Reference GroupItem 86

GroupItem

A grouped set of art items. Group items can contain all of 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.

GroupItem properties

Property Value type What it is
Application Application
ArtworkKnockout AiKnockoutState
BlendingMode AiBlendModes
Clipped Boolean
CompoundPathItems CompoundPathItems
ControlBounds
Editable Boolean
GeometricBounds
GraphItems GraphItems
GroupItems GroupItems
Variant Array of
4
Doubles
Variant
4
Array of
Doubles
Read-only. The Illustrator Application object.
Is this object used to create a knockout, and if so, what kind.
The mode used when compositing an object.
If true, the GroupItem is clipped to the clipping mask.
Read-only. The CompoundPathItems contained in
GroupItem.
this
Read-only. The bounds of the object including stroke width and controls.
Read-only. If true, this GroupItem is editable.
Read-only. The bounds of the object excluding stroke width.
Read-only. The raster items contained in this
GroupItem.
Read-only. The GroupItems contained in this
GroupItem.
Height Double
Hidden Boolean
IsIsolated Boolean
Layer Layer
Left Double
LegacyTextItems LegacyTextItems
Locked Boolean
The height of the GroupItem, based on the
GeometricBounds.
If true, this GroupItem is hidden.
If true, this object is isolated.
Read-only. The layer to which this GroupItem belongs.
The position of the left side of the GroupItem (in points, measured from the left side of the page).
Read-only. The legacy text items in the group.
If true, this GroupItem is locked.
CHAPTER 1: VBScript Object Reference GroupItem 87
Property Value type What it is
MeshItems MeshItems
Name String
NonNativeItems NonNativeItems
Note String
Opacity Double
PageItems PageItems
Parent Document
PathItems PathItems
PlacedItems PlacedItems
PluginItems PluginItems
Position
Variant
2
Array of
Doubles
Read-only. The MeshItems contained in this
GroupItem.
The name of this GroupItem.
Read-only. The non-native art items in this group.
The note assigned to this GroupItem.
The opacity of the object. Range: 0.0 to 100.0
Read-only. The PageItems contained in this
GroupItem.
Read-only. The document that contains this
GroupItem.
Read-only. The PathItems contained in this
GroupItem.
Read-only. The PlacedItems contained in this
GroupItem.
Read-only. The PluginItems contained in this
GroupItem.
The position (in points) of the top left corner of the item in the format [x, y]. Does not include stroke weight.
RasterItems RasterItems
Selected Boolean
Sliced Boolean
SymbolItems SymbolItems
Tags Tags
TextFrames TextFrames
Top Double
URL String
VisibilityVariable Variable
VisibleBounds
Variant
4
Width Double
Array of
Doubles
Read-only. The RasterItems contained in this
GroupItem.
If true, this GroupItem is selected.
If true, this GroupItem is sliced. Default: false
Read-only. The SymbolItems contained in this
GroupItem.
Read-only. The tags contained in this GroupItem.
Read-only. The TextFrame objects contained in this
GroupItem.
The position of the top of the item (in points, measured from the bottom of the page).
The value of the Adobe URL tag assigned to this
GroupItem.
The Variable bound to this GroupItem.
Read-only. The visible bounds of the
GroupItem
including stroke width.
The width of the GroupItem, based on the
GeometricBounds.
CHAPTER 1: VBScript Object Reference GroupItem 88
Property Value type What it is
WrapInside Boolean
WrapOffset Double
Wrapped Boolean
ZOrderPosition Long

GroupItem methods

Method Returns What it does
Copy
()
Cut
()
If true, the text frame object are wrapped inside this object.
The offset to use when wrapping text around this object.
If true, wrap text frame objects around this object (text frame must be above the object).
Read-only. The position of this group item within the stacking order of the group or layer (
Parent)
that contains this group item.
Nothing Copies the GroupItem to the
clipboard; the associated document must be the frontmost document.
Nothing Cuts the GroupItem to the
clipboard; the associated document must be the frontmost document.
Delete
()
Duplicate
([relativeObject as Object],
[insertionLocation as AiElementPlacement])
Move
(relativeObject as Object,
insertionLocation as AiElementPlacement
Paste
()
Resize
(scaleX as Double,
scaleY as Double, [, changePositions as Boolean] [, changeFillPatterns as Boolean] [, changeFillGradients as Boolean] [, changeStrokePattern as Boolean] [, changeLineWidths as Double] [, scaleAbout as AiTransformation
Nothing Deletes the object.
Object Duplicates the art item, optionally
specifying the location and position for the copy.
Nothing Moves the art item, specifying the
new location and position.
)
Nothing Inserts the contents of the
clipboard at the beginning of the
GroupItem. You may only paste
into a group that is contained in the active document.
Nothing Scales the art item where scaleX
is the horizontal scaling factor and
scaleY is the vertical scaling
factor; 100.0 = 100%
])
CHAPTER 1: VBScript Object Reference GroupItem 89
Method Returns What it does
Rotate
(angle as Double,
[, changePositions as Boolean] [, changeFillPatterns as Boolean] [, changeFillGradients as Boolean] [, changeStrokePattern as Boolean] [, rotateAbout as AiTransformation
Transform
(transformationMatrix as Matrix
[, changePositions as Boolean] [, changeFillPatterns as Boolean] [, changeFillGradients as Boolean] [, changeStrokePattern as Boolean] [, changeLineWidths as Double] [, transformAbout as AiTransformation
Translate
([deltaX as Double]
[, deltaY as Double] [, transformObjects as Boolean] [, transformFillPatterns as Boolean] [, transformFillGradients as Boolean] [, transformStrokePatterns as Boolean])
ZOrder
(zOrderCmd as AiZOrderMethod
)
])
])
Nothing Rotates the art item relative to the
current rotation. The object is rotated counter-clockwise if the
Angle value is positive, clockwise
if the value is negative.
Nothing Transforms the art item by
applying a transformation matrix.
Nothing Repositions the art item relative to
the current position, where
deltaX is the horizontal offset and deltaY is the vertical offset.
Nothing Arranges the art item’s position in
the stacking order of the group or layer (
Parent) of this object.
Creating a group
It is easy to modify all of the objects contained in a group. This example demonstrates how to simplify your operations on multiple objects by creating a group to contain them.
'Creates a new group in the current document, containing 'a path item, and a text item
Set appRef = CreateObject("Illustrator.Application")
'Create a new group in the active document. 'This will be the group that holds the new triangle art Set triangleGroup = appRef.ActiveDocument.GroupItems.Add
'Create a triangle and add text inside the group Set trianglePath = triangleGroup.PathItems.Add trianglePath.SetEntirePath Array(Array(100, 100), Array(300, 100), Array(200, Tan(1.0471975) * 100 + 100))
Set captionText = triangleGroup.TextFrames.Add captionText.Position = Array(100, 100) captionText.Contents = "A triangle"
CHAPTER 1: VBScript Object Reference GroupItems 90

GroupItems

A collection of GroupItem objects.

GroupItems properties

Property Value type What it is
Application Application
Count Long
Parent Document

GroupItems methods

Method Returns What it does
Add
()
CreateFromFile
(imagefile as String)
Index
(item as GroupItem)
Item
(itemkey)
RemoveAll
()
GroupItem
GroupItem
Long
GroupItem
Nothing
Read-only. The Illustrator Application object.
Read-only. The number of objects in the collection.
Read-only. The document that contains this object.
Creates a new object.
Creates a GroupItem from a vector graphics file.
Returns the index position of the object within the collection.
Returns an object reference to the object identified by
itemkey (name or index).
Deletes all objects in this collection.
Importing a file using GroupItems
The following script shows how you can import a JPEG document using the CreateFromFile function. Before running this script you have to create a one-page PDF file and put it in the location.
C:\temp\AiExport.jpg.
'Adds a new group item to the document from a file (dest) 'dest contains the full path and file name of the file
Sub embedPDF (dest)
Set appRef = CreateObject("Illustrator.Application")
Set importedGroup = appRef.ActiveDocument.GroupItems.CreateFromFile (dest) End Sub
CHAPTER 1: VBScript Object Reference IllustratorSaveOptions 91

IllustratorSaveOptions

Options that can be supplied when saving a document as an Illustrator file with the document SaveAs method.

IllustratorSaveOptions properties

Property Value type What it is
Application Application
ArtboardRange string
Compatibility AiCompatibility
Compressed Boolean
EmbedICCProfile Boolean
EmbedLinkedFiles Boolean
FlattenOutput AiOutputFlattening
FontSubsetThreshold Double
Read-only. The Illustrator Application object.
If SaveMultipleArtboards 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
Version of the Illustrator file format to create. Default:
15 ’ aiIllustrator15
(Illustrator version 10 or later) If true, the saved file is compressed. Default:
true
If true, an ICC profile is embedded in the saved file.
If true, linked image files are included in the saved document (only valid for
SaveOptions that specify
an Illustrator compatibility of version 7 or later).
Specifies how transparency is flattened for file formats older than Illustrator 9.
Include a subset of fonts when less than this percentage of characters is used in the document (valid for Illustrator 9 or newer file format).
PDFCompatible Boolean
SaveMultipleArtboards boolean
If true, save as a PDF compatible file (version 10 or later). Default:
true
If true, all artboards or range of the artboards are saved. Valid for Illustrator 13 or earlier.
CHAPTER 1: VBScript Object Reference IllustratorSaveOptions 92
Saving to Illustrator 8 format
This example illustrates how to save the frontmost document as Illustrator 8 format. Because the document is saved as a version earlier than 9, the example specifies how to convert opacity by breaking paths up in to sub-paths to preserve the appearance of the illustration.
'Saves current document in Illustrator format to dest with certain options 'specified in the script, dest contains the full path and file name to save to
Sub exportfileToAi (dest)
Set appRef = CreateObject("Illustrator.Application")
Set saveOptions = CreateObject("Illustrator.IllustratorSaveOptions")
saveOptions.Compatibility = 8'aiIllustrator8
saveOptions.FlattenOutput = 1'aiPreserveAppearance
appRef.Documents(1).SaveAs dest, saveOptions End Sub
CHAPTER 1: VBScript Object Reference ImageCaptureOptions 93

ImageCaptureOptions

Options for image capture, used with the ImageCapture method. All properties are optional.

ImageCaptureOptions properties

Property Value type What it is
AntiAliasing Boolean
Application Application
Matte Boolean
MatteColor RGBColor
Resolution Double
Transparency Boolean
If true, the image result is anti-aliased. Default: false
Read-only. The Illustrator Application object.
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 to 2400.0. Default:
If true, the image result is transparent. Default: false
150
CHAPTER 1: VBScript Object Reference Ink 94
Ink
Provides information about the ink name and related information.

Ink properties

Property Value type What it is
Application Application
InkInfo InkInfo
Name String
Read-only. The Illustrator Application object.
The ink information.
The ink’s name.
CHAPTER 1: VBScript Object Reference InkInfo 95

InkInfo

Specifies ink properties.

InkInfo properties

Property Value type What it is
Angle Double
Application Application
CustomColor
Density Double
DotShape String
Frequency Double
Kind AiInkType
PrintingStatus AiInkPrintStatus
Trapping AiTrappingType
TrappingOrder Long
Object The color of the custom ink.
The ink’s screen angle in degrees. Range: -360 to 360
Read-only. The Illustrator Application object.
The neutral density. Minimum: 0.0
The dot shape name.
The ink’s frequency. Range: 0.0 to 1000.0
The ink type.
The ink printing status.
The trapping type.
The order of trapping for the ink. Range: 1 to 4 for CMYK
CHAPTER 1: VBScript Object Reference InkInfo 96
List inks in a document
'Gets the details of each ink in this document 'and displays them in a text frame
Set appRef = CreateObject("Illustrator.Application")
'create a new document and simple text frame Set docRef = appRef.Documents.Add() Set textRef = docRef.TextFrames.Add() textRef.Top = docRef.Height - 100 textRef.Left = 100
'collect data from each Ink and InkInfo object For Each inkRef In appRef.ActiveDocument.InkList
sInks = sInks & inkRef.Name
sInks = sInks & vbCrLf & vbTab
sInks = sInks & "Frequency = " & inkRef.InkInfo.Frequency
sInks = sInks & vbCrLf & vbTab
sInks = sInks & "Density = " & inkRef.InkInfo.Density
sInks = sInks & vbCrLf Next textRef.Contents = sInks appRef.Redraw
CHAPTER 1: VBScript Object Reference InsertionPoint 97

InsertionPoint

A location between characters, used to insert new text objects. An insertion point is contained in an
InsertionPoints collection.

InsertionPoint properties

Property Value type What it is
Application Application
Characters Characters
Lines Lines
Paragraphs Paragraphs
Parent
Story Story
TextRanges TextRanges
Words Words
Object Read-only. The object’s container.
Read-only. The Illustrator Application object.
Read-only. All of the characters in the text range.
Read-only. All the lines in this text range.
Read-only. All of the paragraphs in this text range.
Read-only. The story of the text range.
Read-only. All of the text in this text range.
Read-only. All of the words in this text range.
CHAPTER 1: VBScript Object Reference InsertionPoints 98

InsertionPoints

A collection of InsertionPoint objects.

InsertionPoints properties

Property Value type What it is
Application Application
Count Long
Parent TextFrame

InsertionPoints methods

Method Returns What it does
Index
(itemPtr as TextRange)
Item
(itemKey)
Using insertion point to add spaces
'Creates a new document, adds a text frame then 'uses insertion points to add a space between all characters
Set appRef = CreateObject("Illustrator.Application")
Read-only. The Illustrator Application object.
Read-only. Number of elements in the collection.
Read-only. The object’s container.
Long
InsertionPoint
Returns the index position of the object within the collection.
Gets an element from the collection by itemKey (name or index).
'create a new document and text frame Set docRef = appRef.Documents.Add() Set textRef = docRef.TextFrames.Add() textRef.Contents = "Wouldn't you rather be scripting?" textRef.Top = 400 textRef.Left = 100 textRef.TextRange.CharacterAttributes.Size = 20 appRef.Redraw
i = 2 Do While (i < textRef.InsertionPoints.Count)
textRef.InsertionPoints(i).Characters.Add (" ")
i = i + 2 Loop
CHAPTER 1: VBScript Object Reference LabColor 99

LabColor

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

LabColor properties

Property Value type What it is
Application Application
A Double
B Double
L Double
Read-only. The Illustrator Application object.
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: VBScript Object Reference Layer 100

Layer

A layer in an Illustrator document. Layers may contain nested layers, which are called sublayers in the user interface.
Layer object contains all of the page items in the layer as elements. Your script can access PageItems as
elements of either the layer can be accessed through the the document.

Layer properties

Property Value type What it is
Layer object or as elements of the Document object. Only those page items in that
Layer object. To see page items in different layers, access them through
Application Application
ArtworkKnockout AiKnockoutState
BlendingMode AiBlendModes
Color RGBColor
CompoundPathItems CompoundPathItems
DimPlacedImages Boolean
GraphItems GraphItems
GroupItems GroupItems
HasSelectedArtwork Boolean
IsIsolated Boolean
Layers Layers
Read-only. The Illustrator Application object.
Is this Layer used to create a knockout, and if so, what kind.
The mode used when compositing an object.
The Layer’s selection mark color.
Read-only. The CompoundPathItems contained in this layer.
If true, placed images are rendered as dimmed in this layer.
Read-only. The GraphItems collection contained in this layer.
Read-only. The GroupItems contained in this layer.
If true, an object in this Layer has been selected; setting this property to
false deselects all objects in
the layer.
If true, this Layer is isolated.
Read-only. The Layers contained in this layer.
LegacyTextItems LegacyTextItems
Locked Boolean
MeshItems MeshItems
Name String
NonNativeItems NonNativeItems
Opacity Double
PageItems PageItems
Read-only. The legacy text items contained in this layer.
If true, this layer is editable.
Read-only. The MeshItems contained in this layer.
The name of this layer.
The non-native art items in this layer.
The opacity of the layer. Range: 0.0 to 100.0
Read-only. The PageItems contained in this layer.
Loading...