Adobe Illustrator CS2 Visual Basic Scripting Reference AICS2 VBScript 007
AICS2-VBScriptGuide
AICS2-VBScriptGuide
User Manual: adobe Illustrator - CS2 - Visual Basic Scripting Reference Free User Guide for Adobe Illustrator Software, Manual
Open the PDF directly: View PDF
.
Page Count: 294
| Download | |
| Open PDF In Browser | View PDF |
®
®
Adobe Illustrator cs2
Visual Basic Scripting Reference
bc
© 2005 Adobe Systems Incorporated. All rights reserved.
AdobeÆ Illustrator® CS2 Visual Basic Scripting Reference for Windows®.
NOTICE: All information contained herein is the property of Adobe Systems Incorporated. No part of this publication (whether in hardcopy or
electronic form) may be reproduced or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or
otherwise, without the prior written consent of Adobe Systems Incorporated. The software described in this document is furnished under
license and may only be used or copied in accordance with the terms of such license.
This publication and the information herein is furnished AS IS, 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, makes no warranty of any kind (express, implied, or statutory) with respect to this publication, and expressly disclaims any and
all warranties of merchantability, fitness for particular purposes, and noninfringement of third party rights.
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, and Illustrator are either registered trademarks or trademarks of Adobe Systems Incorporated in the United
States and/or other countries.
Apple, Mac, Macintosh, and Mac OS are trademarks of Apple Computer, Inc., registered in the United States and other countries. Microsoft,
Windows, and Visual Basic are either registered trademarks or trademarks of Microsoft Corporation in the United States and other countries.
JavaScript and all Java-related marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other
countries. UNIX is a registered trademark of The Open Group.
All other trademarks are the property of their respective owners.
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.
Adobe Systems Incorporated, 345 Park Avenue, San Jose, California 95110, USA.
Contents
1
Introduction ............................................................................................................................... 44
About this Manual........................................................................................................................................................................44
What is Scripting?.........................................................................................................................................................................44
Why use scripting?.................................................................................................................................................................44
What about actions? .............................................................................................................................................................45
Script Support in Adobe Illustrator CS2 ...............................................................................................................................45
Executing scripts ....................................................................................................................................................................46
Installing scripts ...............................................................................................................................................................46
Executing other scripts ..................................................................................................................................................46
System requirements for Windows and Visual Basic ................................................................................................46
Changes to Visual Basic and VBA support in Adobe Illustrator CS2 ....................................................................47
2
Scripting Basics .......................................................................................................................... 48
Object Model Concepts .............................................................................................................................................................48
Object classes ..........................................................................................................................................................................49
Object inheritance .................................................................................................................................................................49
Object elements or collections .........................................................................................................................................49
Object references...................................................................................................................................................................49
Scripting Concepts.......................................................................................................................................................................50
Comments ................................................................................................................................................................................50
Long script lines......................................................................................................................................................................50
Value types ...............................................................................................................................................................................50
Variables ....................................................................................................................................................................................51
Declaring variables..........................................................................................................................................................51
Assigning variable values .............................................................................................................................................51
Variable naming ...............................................................................................................................................................51
Script properties...............................................................................................................................................................52
Operators ..................................................................................................................................................................................52
Methods ....................................................................................................................................................................................52
Conditional statements .......................................................................................................................................................52
Control structures ..................................................................................................................................................................53
Subroutines..............................................................................................................................................................................53
Testing and Troubleshooting ..................................................................................................................................................54
About error handling............................................................................................................................................................54
Visual Basic Resources ................................................................................................................................................................55
3
Scripting Illustrator ................................................................................................................... 56
The Illustrator Object Model ....................................................................................................................................................56
Looking at Illustrator objects and commands.............................................................................................................57
Your First Illustrator Script.........................................................................................................................................................57
VBScript .....................................................................................................................................................................................58
Adding features to “Hello World”.....................................................................................................................................59
Object References ........................................................................................................................................................................60
Creating objects in Visual Basic ........................................................................................................................................60
Objects that must be created ............................................................................................................................................61
Objects that cannot be created by a script...................................................................................................................61
3
Adobe Illustrator CS2
Visual Basic Scripting Reference
4
Object containment: document vs. layer......................................................................................................................62
Syntax Differences Between Sub and Function Methods .............................................................................................62
Working with Document Contents........................................................................................................................................63
Working with selections ......................................................................................................................................................63
Working with paths...............................................................................................................................................................64
Working with color ................................................................................................................................................................64
Working with symbols and symbol items.....................................................................................................................65
Working with text art............................................................................................................................................................65
Content of a text range..................................................................................................................................................66
Character style, character attributes, local character attributes.....................................................................66
Measurement Units .....................................................................................................................................................................66
Unit conversion to points....................................................................................................................................................67
Em Space Units .......................................................................................................................................................................67
Coordinates..............................................................................................................................................................................67
Fixed points..............................................................................................................................................................................68
Zero point .................................................................................................................................................................................68
Fixed rectangle .......................................................................................................................................................................68
Page item positioning and dimensions .........................................................................................................................68
Printing Illustrator Documents................................................................................................................................................69
Transformation Matrices............................................................................................................................................................70
Working with Variables and Datasets ...................................................................................................................................71
Launching and Quitting Illustrator from a Script..............................................................................................................71
User Interaction Levels ...............................................................................................................................................................72
4
Visual Basic Object Reference................................................................................................... 73
Application .....................................................................................................................................................................................74
Application properties .........................................................................................................................................................74
ActionIsRunning .....................................................................................................................................................................74
ActiveDocument ....................................................................................................................................................................74
Application ...............................................................................................................................................................................74
BrowserAvailable....................................................................................................................................................................74
Documents ...............................................................................................................................................................................74
FlattenerPresetsList...............................................................................................................................................................74
FreeMemory.............................................................................................................................................................................74
Name ..........................................................................................................................................................................................74
Path .............................................................................................................................................................................................74
PDFPresetsList.........................................................................................................................................................................74
PPDFileList ................................................................................................................................................................................74
Preferences...............................................................................................................................................................................74
PrinterList..................................................................................................................................................................................74
PrintPresetsList .......................................................................................................................................................................74
ScriptingVersion .....................................................................................................................................................................74
Selection....................................................................................................................................................................................74
TextFonts ..................................................................................................................................................................................75
TracingPresetList....................................................................................................................................................................75
UserInteractionLevel.............................................................................................................................................................75
Version .......................................................................................................................................................................................75
Visible .........................................................................................................................................................................................75
Application methods ............................................................................................................................................................75
ConcatenateMatrix................................................................................................................................................................75
ConcatenateRotationMatrix...............................................................................................................................................75
Adobe Illustrator CS2
Visual Basic Scripting Reference
5
ConcatenateScaleMatrix .....................................................................................................................................................75
ConcatenateTranslationMatrix .........................................................................................................................................75
DoJavaScript ............................................................................................................................................................................75
DoJavaScriptFile .....................................................................................................................................................................75
DoScript.....................................................................................................................................................................................75
GetIdentityMatrix...................................................................................................................................................................75
GetRotationMatrix .................................................................................................................................................................75
GetScaleMatrix ........................................................................................................................................................................76
GetTranslationMatrix ............................................................................................................................................................76
InvertMatrix..............................................................................................................................................................................76
IsEqualMatrix ...........................................................................................................................................................................76
IsSingularMatrix......................................................................................................................................................................76
Open ...........................................................................................................................................................................................76
Quit..............................................................................................................................................................................................76
Redraw .......................................................................................................................................................................................76
ShowPresets.............................................................................................................................................................................76
TranslatePlaceholderText ...................................................................................................................................................76
Brush .................................................................................................................................................................................................79
Brush properties .....................................................................................................................................................................79
Application ...............................................................................................................................................................................79
Name ..........................................................................................................................................................................................79
Parent .........................................................................................................................................................................................79
Brush methods........................................................................................................................................................................79
ApplyTo .....................................................................................................................................................................................79
Brushes.............................................................................................................................................................................................80
Brushes properties.................................................................................................................................................................80
Application ...............................................................................................................................................................................80
Count..........................................................................................................................................................................................80
Parent .........................................................................................................................................................................................80
Brushes methods....................................................................................................................................................................80
Index ...........................................................................................................................................................................................80
Item .............................................................................................................................................................................................80
CharacterAttributes.....................................................................................................................................................................81
CharacterAttributes properties.........................................................................................................................................81
AkiLeft ........................................................................................................................................................................................81
AkiRight .....................................................................................................................................................................................81
Alignment .................................................................................................................................................................................81
AlternateGlyphs......................................................................................................................................................................81
Application ...............................................................................................................................................................................81
AutoLeading ............................................................................................................................................................................81
BaselineDirection ...................................................................................................................................................................81
BaselinePosition .....................................................................................................................................................................81
BaselineShift ............................................................................................................................................................................81
Capitalization...........................................................................................................................................................................81
ConnectionForms ..................................................................................................................................................................81
ContextualLigature................................................................................................................................................................81
DiscretionaryLigature ...........................................................................................................................................................81
FigureStyle................................................................................................................................................................................81
FillColor......................................................................................................................................................................................81
Fractions....................................................................................................................................................................................82
HorizontalScale.......................................................................................................................................................................82
Adobe Illustrator CS2
Visual Basic Scripting Reference
6
Italics...........................................................................................................................................................................................82
KerningMethod.......................................................................................................................................................................82
Language ..................................................................................................................................................................................82
Leading ......................................................................................................................................................................................82
Ligature......................................................................................................................................................................................82
NoBreak .....................................................................................................................................................................................82
OpenTypePosition .................................................................................................................................................................82
Ordinals......................................................................................................................................................................................82
Ornaments................................................................................................................................................................................82
OverprintFill .............................................................................................................................................................................82
OverprintStroke ......................................................................................................................................................................82
Parent .........................................................................................................................................................................................82
ProportionalMetrics ..............................................................................................................................................................82
Rotation .....................................................................................................................................................................................82
Size ..............................................................................................................................................................................................82
StrikeThrough..........................................................................................................................................................................82
StrokeColor...............................................................................................................................................................................82
StrokeWeight...........................................................................................................................................................................82
StylisticAlternates ..................................................................................................................................................................82
Swash .........................................................................................................................................................................................82
TateChuYokoHorizontal ......................................................................................................................................................82
TateChuYokoVertical ............................................................................................................................................................83
TextFont ....................................................................................................................................................................................83
Titling..........................................................................................................................................................................................83
Tracking .....................................................................................................................................................................................83
Tsume.........................................................................................................................................................................................83
Underline ..................................................................................................................................................................................83
VerticalScale.............................................................................................................................................................................83
WariChuCharactersAfter Break .........................................................................................................................................83
WariChuCharactersBeforeBreak .......................................................................................................................................83
WariChuEnabled.....................................................................................................................................................................83
WariChuJustification.............................................................................................................................................................83
WariChuLineGap ....................................................................................................................................................................83
WariChuLines...........................................................................................................................................................................83
WariChuScale...........................................................................................................................................................................83
Characters .......................................................................................................................................................................................85
Characters properties ...........................................................................................................................................................85
Application ...............................................................................................................................................................................85
Count..........................................................................................................................................................................................85
Parent .........................................................................................................................................................................................85
Characters methods..............................................................................................................................................................85
Add ..............................................................................................................................................................................................85
AddBefore.................................................................................................................................................................................85
Index ...........................................................................................................................................................................................85
RemoveAll.................................................................................................................................................................................85
CharacterStyle ...............................................................................................................................................................................86
CharacterStyle properties ...................................................................................................................................................86
Application ...............................................................................................................................................................................86
CharacterAttributes...............................................................................................................................................................86
Name ..........................................................................................................................................................................................86
Parent .........................................................................................................................................................................................86
Adobe Illustrator CS2
Visual Basic Scripting Reference
7
CharacterStyle methods ......................................................................................................................................................86
ApplyTo .....................................................................................................................................................................................86
Delete .........................................................................................................................................................................................86
CharacterStyles .............................................................................................................................................................................87
CharacterStyles properties .................................................................................................................................................87
Application ...............................................................................................................................................................................87
Count..........................................................................................................................................................................................87
Parent .........................................................................................................................................................................................87
CharacterStyles methods ....................................................................................................................................................87
Add ..............................................................................................................................................................................................87
Index ...........................................................................................................................................................................................87
Item .............................................................................................................................................................................................87
RemoveAll.................................................................................................................................................................................87
CMYKColor......................................................................................................................................................................................89
CMYKColor properties..........................................................................................................................................................89
Application ...............................................................................................................................................................................89
Black............................................................................................................................................................................................89
Cyan ............................................................................................................................................................................................89
Magenta ....................................................................................................................................................................................89
Yellow.........................................................................................................................................................................................89
CompoundPathItem ...................................................................................................................................................................90
CompoundPathItem properties .......................................................................................................................................90
Application ...............................................................................................................................................................................90
ArtworkKnockout...................................................................................................................................................................90
BlendingMode.........................................................................................................................................................................90
ControlBounds........................................................................................................................................................................90
Editable......................................................................................................................................................................................90
GeometricBounds..................................................................................................................................................................90
Height.........................................................................................................................................................................................90
Hidden........................................................................................................................................................................................90
IsIsolated ...................................................................................................................................................................................90
Layer ...........................................................................................................................................................................................90
Left...............................................................................................................................................................................................90
Locked........................................................................................................................................................................................90
Name ..........................................................................................................................................................................................90
Opacity.......................................................................................................................................................................................90
Parent .........................................................................................................................................................................................90
PathItems ..................................................................................................................................................................................90
Position ......................................................................................................................................................................................91
Selected .....................................................................................................................................................................................91
Sliced ..........................................................................................................................................................................................91
Tags.............................................................................................................................................................................................91
Top...............................................................................................................................................................................................91
URL ..............................................................................................................................................................................................91
VisibilityVariable .....................................................................................................................................................................91
VisibleBounds..........................................................................................................................................................................91
Width ..........................................................................................................................................................................................91
WrapInside................................................................................................................................................................................91
WrapOffset................................................................................................................................................................................91
Wrapped....................................................................................................................................................................................91
ZOrderPosition........................................................................................................................................................................91
Adobe Illustrator CS2
Visual Basic Scripting Reference
8
CompoundPathItem methods..........................................................................................................................................91
Copy............................................................................................................................................................................................91
Cut ...............................................................................................................................................................................................91
Delete .........................................................................................................................................................................................91
Duplicate...................................................................................................................................................................................91
Move ...........................................................................................................................................................................................91
Resize..........................................................................................................................................................................................92
Rotate .........................................................................................................................................................................................92
Transform..................................................................................................................................................................................92
Translate ....................................................................................................................................................................................92
ZOrder ........................................................................................................................................................................................92
CompoundPathItems .................................................................................................................................................................94
CompoundPathItems properties .....................................................................................................................................94
Application ...............................................................................................................................................................................94
Count..........................................................................................................................................................................................94
Parent .........................................................................................................................................................................................94
CompoundPathItem methods..........................................................................................................................................94
Add ..............................................................................................................................................................................................94
Index ...........................................................................................................................................................................................94
Item .............................................................................................................................................................................................94
RemoveAll.................................................................................................................................................................................94
DataSet.............................................................................................................................................................................................95
DataSet properties.................................................................................................................................................................95
Application ...............................................................................................................................................................................95
Name ..........................................................................................................................................................................................95
Parent .........................................................................................................................................................................................95
DataSet methods ...................................................................................................................................................................95
Delete .........................................................................................................................................................................................95
Display........................................................................................................................................................................................95
Update .......................................................................................................................................................................................95
DataSets...........................................................................................................................................................................................96
DataSets properties...............................................................................................................................................................96
Application ...............................................................................................................................................................................96
Count..........................................................................................................................................................................................96
Parent .........................................................................................................................................................................................96
DataSets methods..................................................................................................................................................................96
Add ..............................................................................................................................................................................................96
Index ...........................................................................................................................................................................................96
Item .............................................................................................................................................................................................96
RemoveAll.................................................................................................................................................................................96
Document .......................................................................................................................................................................................98
Document properties ...........................................................................................................................................................98
ActiveDataSet..........................................................................................................................................................................98
ActiveLayer...............................................................................................................................................................................98
ActiveView................................................................................................................................................................................98
Application ...............................................................................................................................................................................98
Brushes.......................................................................................................................................................................................98
CharacterStyles .......................................................................................................................................................................98
CompoundPathItems ...........................................................................................................................................................98
CropBox .....................................................................................................................................................................................98
CropStyle...................................................................................................................................................................................98
Adobe Illustrator CS2
Visual Basic Scripting Reference
9
DataSets.....................................................................................................................................................................................98
DefaultFillColor .......................................................................................................................................................................98
DefaultFilled.............................................................................................................................................................................98
DefaultFillOverprint ..............................................................................................................................................................98
DefaultStrokeCap...................................................................................................................................................................98
DefaultStrokeColor................................................................................................................................................................99
DefaultStroked........................................................................................................................................................................99
DefaultStrokeDashes ............................................................................................................................................................99
DefaultStrokeDashOffset ....................................................................................................................................................99
DefaultStrokeJoin ..................................................................................................................................................................99
DefaultStrokeMiterLimit......................................................................................................................................................99
DefaultStrokeOverprint .......................................................................................................................................................99
DefaultStrokeWidth ..............................................................................................................................................................99
DocumentColorSpace ..........................................................................................................................................................99
FullName ...................................................................................................................................................................................99
GeometricBounds..................................................................................................................................................................99
Gradients...................................................................................................................................................................................99
GraphicStyles...........................................................................................................................................................................99
GraphItems...............................................................................................................................................................................99
GroupItems ..............................................................................................................................................................................99
Height.........................................................................................................................................................................................99
InkList ...................................................................................................................................................................................... 100
KinsokuSet ............................................................................................................................................................................. 100
Layers....................................................................................................................................................................................... 100
LegacyTextItems ................................................................................................................................................................. 100
MeshItems ............................................................................................................................................................................. 100
MojikumiSet .......................................................................................................................................................................... 100
Name ....................................................................................................................................................................................... 100
OutputResolution ............................................................................................................................................................... 100
PageItems .............................................................................................................................................................................. 100
PageOrigin............................................................................................................................................................................. 100
ParagraphStyles................................................................................................................................................................... 100
Parent ...................................................................................................................................................................................... 100
Path .......................................................................................................................................................................................... 100
PathItems ............................................................................................................................................................................... 100
Patterns................................................................................................................................................................................... 100
PlacedItems........................................................................................................................................................................... 100
PluginItems ........................................................................................................................................................................... 100
PrintTiles................................................................................................................................................................................. 100
RasterItems............................................................................................................................................................................ 100
RulerOrigin ............................................................................................................................................................................ 101
RulerUnits .............................................................................................................................................................................. 101
Saved ....................................................................................................................................................................................... 101
Selection................................................................................................................................................................................. 101
ShowPlacedImages ............................................................................................................................................................ 101
SplitLongPaths..................................................................................................................................................................... 101
Spots ........................................................................................................................................................................................ 101
Stationary............................................................................................................................................................................... 101
Stories...................................................................................................................................................................................... 101
Swatches ................................................................................................................................................................................ 101
SymbolItems ......................................................................................................................................................................... 101
Adobe Illustrator CS2
Visual Basic Scripting Reference
10
Symbols .................................................................................................................................................................................. 101
Tags.......................................................................................................................................................................................... 101
TextFrames ............................................................................................................................................................................ 101
TileFullPages ......................................................................................................................................................................... 101
UseDefaultScreen ............................................................................................................................................................... 101
Variables ................................................................................................................................................................................. 101
VariablesLocked................................................................................................................................................................... 101
Views........................................................................................................................................................................................ 101
VisibleBounds....................................................................................................................................................................... 102
Width ....................................................................................................................................................................................... 102
Document methods........................................................................................................................................................... 102
Activate................................................................................................................................................................................... 102
Close ........................................................................................................................................................................................ 102
Copy......................................................................................................................................................................................... 102
Cut ............................................................................................................................................................................................ 102
ExportPDFPreset.................................................................................................................................................................. 102
Export ...................................................................................................................................................................................... 102
ExportPDFPreset.................................................................................................................................................................. 102
ExportPrintPreset ................................................................................................................................................................ 102
ExportVariables.................................................................................................................................................................... 102
ImportCharacterStyles ...................................................................................................................................................... 102
ImportParagraphStyles ..................................................................................................................................................... 102
ImportPDFPreset................................................................................................................................................................. 103
ImportPrintPreset................................................................................................................................................................ 103
ImportVariables(.................................................................................................................................................................. 103
Paste......................................................................................................................................................................................... 103
PrintOut .................................................................................................................................................................................. 103
Save.......................................................................................................................................................................................... 103
SaveAs ..................................................................................................................................................................................... 103
Documents .................................................................................................................................................................................. 104
Documents properties ...................................................................................................................................................... 104
Application ............................................................................................................................................................................ 104
Count....................................................................................................................................................................................... 104
Parent ...................................................................................................................................................................................... 104
Documents methods......................................................................................................................................................... 104
Add ........................................................................................................................................................................................... 104
Index ........................................................................................................................................................................................ 104
Item .......................................................................................................................................................................................... 104
EPSSaveOptions......................................................................................................................................................................... 105
EPSSaveOptions properties............................................................................................................................................. 105
Application ............................................................................................................................................................................ 105
CMYKPostScript ................................................................................................................................................................... 105
Compatibility ........................................................................................................................................................................ 105
CompatibleGradientPrinting .......................................................................................................................................... 105
EmbedAllFonts..................................................................................................................................................................... 105
EmbedLinkedFiles............................................................................................................................................................... 105
FlattenOuput ........................................................................................................................................................................ 105
IncludeDocumentThumbnails ....................................................................................................................................... 105
Overprint................................................................................................................................................................................ 105
PostScript ............................................................................................................................................................................... 105
Preview ................................................................................................................................................................................... 105
Adobe Illustrator CS2
Visual Basic Scripting Reference
11
ExportOptionsFlash .................................................................................................................................................................. 107
ExportOptionsFlash properties...................................................................................................................................... 107
Application ............................................................................................................................................................................ 107
ArtBoardClipping ................................................................................................................................................................ 107
BackgroundColor ................................................................................................................................................................ 107
BackgroundLayers .............................................................................................................................................................. 107
BlendAnimation................................................................................................................................................................... 107
Compressed .......................................................................................................................................................................... 107
ConvertTextToOutlines..................................................................................................................................................... 107
CurveQuality ......................................................................................................................................................................... 107
ExportStyle ............................................................................................................................................................................ 107
FlattenOutput....................................................................................................................................................................... 107
FrameRate.............................................................................................................................................................................. 107
GenerateHTML ..................................................................................................................................................................... 107
ImageFormat ........................................................................................................................................................................ 107
JPEGMethod.......................................................................................................................................................................... 107
JPEGQuality ........................................................................................................................................................................... 107
LayerOrder............................................................................................................................................................................. 108
Looping .................................................................................................................................................................................. 108
ReadOnly................................................................................................................................................................................ 108
Replacing ............................................................................................................................................................................... 108
Resolution.............................................................................................................................................................................. 108
ExportOptionsGIF...................................................................................................................................................................... 109
ExportOptionsGIF properties.......................................................................................................................................... 109
AntiAliasing ........................................................................................................................................................................... 109
Application ............................................................................................................................................................................ 109
ArtBoardClipping ................................................................................................................................................................ 109
ColorCount ............................................................................................................................................................................ 109
ColorDither............................................................................................................................................................................ 109
ColorReduction.................................................................................................................................................................... 109
DitherPercent ....................................................................................................................................................................... 109
HorizontalScale.................................................................................................................................................................... 109
InfoLossPercent ................................................................................................................................................................... 109
Interlaced ............................................................................................................................................................................... 109
Matte........................................................................................................................................................................................ 109
MatteColor............................................................................................................................................................................. 109
SaveAsHTML ......................................................................................................................................................................... 109
Transparency ........................................................................................................................................................................ 109
VerticalScale.......................................................................................................................................................................... 110
WebSnap ................................................................................................................................................................................ 110
ExportOptionsJPEG................................................................................................................................................................... 111
ExportOptionsJPEG ............................................................................................................................................................ 111
AntiAliasing ........................................................................................................................................................................... 111
Application ............................................................................................................................................................................ 111
ArtBoardClipping ................................................................................................................................................................ 111
BlurAmount........................................................................................................................................................................... 111
HorizontalScale.................................................................................................................................................................... 111
Matte........................................................................................................................................................................................ 111
MatteColor............................................................................................................................................................................. 111
Optimization......................................................................................................................................................................... 111
QualitySetting ...................................................................................................................................................................... 111
Adobe Illustrator CS2
Visual Basic Scripting Reference
12
SaveAsHTML ......................................................................................................................................................................... 111
VerticalScale.......................................................................................................................................................................... 111
ExportOptionsPhotoshop ...................................................................................................................................................... 112
ExportOptionsPhotoshop properties .......................................................................................................................... 112
AntiAliasing ........................................................................................................................................................................... 112
Application ............................................................................................................................................................................ 112
Compatibility ........................................................................................................................................................................ 112
EditableText .......................................................................................................................................................................... 112
EmbedICCProfile ................................................................................................................................................................. 112
ImageColorSpace................................................................................................................................................................ 112
MaximumEditability........................................................................................................................................................... 112
Resolution.............................................................................................................................................................................. 112
Warnings ................................................................................................................................................................................ 112
WriteLayers............................................................................................................................................................................ 112
ExportOptionsPNG8 ................................................................................................................................................................. 113
ExportOptionsPNG8 properties..................................................................................................................................... 113
AntiAliasing ........................................................................................................................................................................... 113
Application ............................................................................................................................................................................ 113
ArtBoardClipping ................................................................................................................................................................ 113
ColorCount ............................................................................................................................................................................ 113
ColorDither............................................................................................................................................................................ 113
ColorReduction.................................................................................................................................................................... 113
DitherPercent ....................................................................................................................................................................... 113
HorizontalScale.................................................................................................................................................................... 113
Interlaced ............................................................................................................................................................................... 113
Matte........................................................................................................................................................................................ 113
MatteColor............................................................................................................................................................................. 113
SaveAsHTML ......................................................................................................................................................................... 113
Transparency ........................................................................................................................................................................ 113
VerticalScale.......................................................................................................................................................................... 113
WebSnap ................................................................................................................................................................................ 113
ExportOptionsPNG24............................................................................................................................................................... 115
ExportOptionsPNG24 properties .................................................................................................................................. 115
AntiAliasing ........................................................................................................................................................................... 115
Application ............................................................................................................................................................................ 115
ArtBoardClipping ................................................................................................................................................................ 115
HorizontalScale.................................................................................................................................................................... 115
Matte........................................................................................................................................................................................ 115
MatteColor............................................................................................................................................................................. 115
SaveAsHTML ......................................................................................................................................................................... 115
Transparency ........................................................................................................................................................................ 115
VerticalScale.......................................................................................................................................................................... 115
ExportOptionsSVG .................................................................................................................................................................... 116
ExportOptionsSVG properties ........................................................................................................................................ 116
Application ............................................................................................................................................................................ 116
Compressed .......................................................................................................................................................................... 116
CoordinatePrecision........................................................................................................................................................... 116
CSSProperties ....................................................................................................................................................................... 116
DocumentEncoding........................................................................................................................................................... 116
DTD........................................................................................................................................................................................... 116
EmbedRasterImages .......................................................................................................................................................... 116
Adobe Illustrator CS2
Visual Basic Scripting Reference
13
FontSubsetting .................................................................................................................................................................... 116
FontType ................................................................................................................................................................................ 116
IncludeFileInfo ..................................................................................................................................................................... 116
IncludeVariablesAndDatasets ........................................................................................................................................ 116
OptimizeForSVGViewer .................................................................................................................................................... 116
PreserveEditability.............................................................................................................................................................. 116
Slices ........................................................................................................................................................................................ 117
SVGAutoKerning ................................................................................................................................................................. 117
SVGTextOnPath ................................................................................................................................................................... 117
Gradient ........................................................................................................................................................................................ 118
Gradient properties............................................................................................................................................................ 118
Application ............................................................................................................................................................................ 118
GradientStops ...................................................................................................................................................................... 118
Name ....................................................................................................................................................................................... 118
Parent ...................................................................................................................................................................................... 118
Type ......................................................................................................................................................................................... 118
Gradient methods............................................................................................................................................................... 118
Delete ...................................................................................................................................................................................... 118
GradientColor ............................................................................................................................................................................. 120
GradientColor properties ................................................................................................................................................. 120
Angle ....................................................................................................................................................................................... 120
Application ............................................................................................................................................................................ 120
Gradient.................................................................................................................................................................................. 120
HiliteAngle............................................................................................................................................................................. 120
HiliteLength .......................................................................................................................................................................... 120
Length ..................................................................................................................................................................................... 120
Matrix....................................................................................................................................................................................... 120
Origin....................................................................................................................................................................................... 120
Gradients ...................................................................................................................................................................................... 121
Gradients properties .......................................................................................................................................................... 121
Application ............................................................................................................................................................................ 121
Count....................................................................................................................................................................................... 121
Parent ...................................................................................................................................................................................... 121
Gradients methods............................................................................................................................................................. 121
Add ........................................................................................................................................................................................... 121
Index ........................................................................................................................................................................................ 121
Item .......................................................................................................................................................................................... 121
RemoveAll.............................................................................................................................................................................. 121
GradientStop............................................................................................................................................................................... 122
GradientStop properties................................................................................................................................................... 122
Application ............................................................................................................................................................................ 122
Color......................................................................................................................................................................................... 122
Midpoint................................................................................................................................................................................. 122
Parent ...................................................................................................................................................................................... 122
RampPoint ............................................................................................................................................................................. 122
GradientStop methods ..................................................................................................................................................... 122
Delete ...................................................................................................................................................................................... 122
GradientStops............................................................................................................................................................................. 123
GradientStops properties................................................................................................................................................. 123
Application ............................................................................................................................................................................ 123
Count....................................................................................................................................................................................... 123
Adobe Illustrator CS2
Visual Basic Scripting Reference
14
Parent ...................................................................................................................................................................................... 123
GradientStops methods ................................................................................................................................................... 123
Add ........................................................................................................................................................................................... 123
Index ........................................................................................................................................................................................ 123
Item .......................................................................................................................................................................................... 123
RemoveAll.............................................................................................................................................................................. 123
GraphicStyle ................................................................................................................................................................................ 125
GraphicStyle properties.................................................................................................................................................... 125
Application ............................................................................................................................................................................ 125
Name ....................................................................................................................................................................................... 125
Parent ...................................................................................................................................................................................... 125
GraphicStyle methods....................................................................................................................................................... 125
ApplyTo .................................................................................................................................................................................. 125
Delete ...................................................................................................................................................................................... 125
GraphicStyles .............................................................................................................................................................................. 126
GraphicStyles properties .................................................................................................................................................. 126
Application ............................................................................................................................................................................ 126
Count....................................................................................................................................................................................... 126
Parent ...................................................................................................................................................................................... 126
GraphicStyles methods..................................................................................................................................................... 126
Index ........................................................................................................................................................................................ 126
Item .......................................................................................................................................................................................... 126
RemoveAll.............................................................................................................................................................................. 126
GraphItem .................................................................................................................................................................................... 127
GraphItem properties........................................................................................................................................................ 127
Application ............................................................................................................................................................................ 127
ArtworkKnockout................................................................................................................................................................ 127
BlendingMode...................................................................................................................................................................... 127
ContentVariable................................................................................................................................................................... 127
ControlBounds..................................................................................................................................................................... 127
Editable................................................................................................................................................................................... 127
GeometricBounds............................................................................................................................................................... 127
Height...................................................................................................................................................................................... 127
Hidden..................................................................................................................................................................................... 127
IsIsolated ................................................................................................................................................................................ 127
Layer ........................................................................................................................................................................................ 127
Left............................................................................................................................................................................................ 127
Locked..................................................................................................................................................................................... 127
Name ....................................................................................................................................................................................... 127
Opacity.................................................................................................................................................................................... 127
Parent ...................................................................................................................................................................................... 127
Position ................................................................................................................................................................................... 127
Selected .................................................................................................................................................................................. 127
Sliced ....................................................................................................................................................................................... 127
Tags.......................................................................................................................................................................................... 128
Top............................................................................................................................................................................................ 128
URL ........................................................................................................................................................................................... 128
VisibilityVariable .................................................................................................................................................................. 128
VisibleBounds....................................................................................................................................................................... 128
Width ....................................................................................................................................................................................... 128
WrapInside............................................................................................................................................................................. 128
Adobe Illustrator CS2
Visual Basic Scripting Reference
15
WrapOffset............................................................................................................................................................................. 128
Wrapped................................................................................................................................................................................. 128
ZOrderPosition..................................................................................................................................................................... 128
GraphItem methods........................................................................................................................................................... 128
Copy......................................................................................................................................................................................... 128
Cut ............................................................................................................................................................................................ 128
Delete ...................................................................................................................................................................................... 128
Duplicate................................................................................................................................................................................ 128
Move ........................................................................................................................................................................................ 128
Resize....................................................................................................................................................................................... 129
Rotate ...................................................................................................................................................................................... 129
Transform............................................................................................................................................................................... 129
Translate ................................................................................................................................................................................. 129
ZOrder ..................................................................................................................................................................................... 129
GraphItems .................................................................................................................................................................................. 131
GraphItems properties...................................................................................................................................................... 131
Application ............................................................................................................................................................................ 131
Count....................................................................................................................................................................................... 131
Parent ...................................................................................................................................................................................... 131
GraphItems methods......................................................................................................................................................... 131
Index ........................................................................................................................................................................................ 131
Item .......................................................................................................................................................................................... 131
RemoveAll.............................................................................................................................................................................. 131
GrayColor...................................................................................................................................................................................... 132
GrayColor properties ......................................................................................................................................................... 132
Application ............................................................................................................................................................................ 132
Gray .......................................................................................................................................................................................... 132
GroupItem.................................................................................................................................................................................... 133
GroupItem properties........................................................................................................................................................ 133
Application ............................................................................................................................................................................ 133
ArtworkKnockout................................................................................................................................................................ 133
BlendingMode...................................................................................................................................................................... 133
Clipped.................................................................................................................................................................................... 133
CompoundPathItems ........................................................................................................................................................ 133
ControlBounds..................................................................................................................................................................... 133
Editable................................................................................................................................................................................... 133
GeometricBounds............................................................................................................................................................... 133
GraphItems............................................................................................................................................................................ 133
GroupItems ........................................................................................................................................................................... 133
Height...................................................................................................................................................................................... 133
Hidden..................................................................................................................................................................................... 133
IsIsolated ................................................................................................................................................................................ 133
Layer ........................................................................................................................................................................................ 133
Left............................................................................................................................................................................................ 133
LegacyTextItems ................................................................................................................................................................. 133
Locked..................................................................................................................................................................................... 133
MeshItems ............................................................................................................................................................................. 134
Name ....................................................................................................................................................................................... 134
Opacity.................................................................................................................................................................................... 134
PageItems .............................................................................................................................................................................. 134
Parent ...................................................................................................................................................................................... 134
Adobe Illustrator CS2
Visual Basic Scripting Reference
16
PathItems ............................................................................................................................................................................... 134
PlacedItems........................................................................................................................................................................... 134
PluginItems ........................................................................................................................................................................... 134
Position ................................................................................................................................................................................... 134
RasterItems............................................................................................................................................................................ 134
Selected .................................................................................................................................................................................. 134
Sliced ....................................................................................................................................................................................... 134
SymbolItems ......................................................................................................................................................................... 134
Tags.......................................................................................................................................................................................... 134
TextFrames ............................................................................................................................................................................ 134
Top............................................................................................................................................................................................ 134
URL ........................................................................................................................................................................................... 134
VisibilityVariable .................................................................................................................................................................. 134
VisibleBounds....................................................................................................................................................................... 134
Width ....................................................................................................................................................................................... 134
WrapInside............................................................................................................................................................................. 134
WrapOffset............................................................................................................................................................................. 135
Wrapped................................................................................................................................................................................. 135
ZOrderPosition..................................................................................................................................................................... 135
GroupItem methods .......................................................................................................................................................... 135
Copy......................................................................................................................................................................................... 135
Cut ............................................................................................................................................................................................ 135
Delete ...................................................................................................................................................................................... 135
Duplicate................................................................................................................................................................................ 135
Move ........................................................................................................................................................................................ 135
Paste......................................................................................................................................................................................... 135
Resize....................................................................................................................................................................................... 135
Rotate ...................................................................................................................................................................................... 135
Transform............................................................................................................................................................................... 136
Translate ................................................................................................................................................................................. 136
ZOrder ..................................................................................................................................................................................... 136
GroupItems.................................................................................................................................................................................. 137
GroupItems properties...................................................................................................................................................... 137
Application ............................................................................................................................................................................ 137
Count....................................................................................................................................................................................... 137
Parent ...................................................................................................................................................................................... 137
GroupItems methods ........................................................................................................................................................ 137
Add ........................................................................................................................................................................................... 137
CreateFromFile..................................................................................................................................................................... 137
Index ........................................................................................................................................................................................ 137
Item .......................................................................................................................................................................................... 137
RemoveAll.............................................................................................................................................................................. 137
IllustratorSaveOptions............................................................................................................................................................. 138
IllustratorSaveOptions properties................................................................................................................................. 138
Application ............................................................................................................................................................................ 138
Compatibility ........................................................................................................................................................................ 138
Compressed .......................................................................................................................................................................... 138
EmbedICCProfile ................................................................................................................................................................. 138
EmbedLinkedFiles............................................................................................................................................................... 138
FlattenOutput....................................................................................................................................................................... 138
FontSubsetThreshold ........................................................................................................................................................ 138
Adobe Illustrator CS2
Visual Basic Scripting Reference
17
Overprint................................................................................................................................................................................ 138
PDFCompatible.................................................................................................................................................................... 138
Ink.................................................................................................................................................................................................... 139
Ink properties ....................................................................................................................................................................... 139
Application ............................................................................................................................................................................ 139
InkInfo ..................................................................................................................................................................................... 139
Name ....................................................................................................................................................................................... 139
InkInfo............................................................................................................................................................................................ 139
InkInfo properties................................................................................................................................................................ 139
Angle ....................................................................................................................................................................................... 139
Application ............................................................................................................................................................................ 139
CustomColor......................................................................................................................................................................... 139
Density .................................................................................................................................................................................... 139
DotShape ............................................................................................................................................................................... 139
Frequency .............................................................................................................................................................................. 139
Kind .......................................................................................................................................................................................... 139
PrintingStatus....................................................................................................................................................................... 139
Trapping ................................................................................................................................................................................. 139
TrappingOrder ..................................................................................................................................................................... 139
InsertionPoint ............................................................................................................................................................................. 141
InsertionPoints ........................................................................................................................................................................... 141
InsertionPoints properties ............................................................................................................................................... 141
Application ............................................................................................................................................................................ 141
Count....................................................................................................................................................................................... 141
Parent ...................................................................................................................................................................................... 141
InsertionPoints methods.................................................................................................................................................. 141
Index ........................................................................................................................................................................................ 141
Item .......................................................................................................................................................................................... 141
LabColor ....................................................................................................................................................................................... 143
LabColor properties ........................................................................................................................................................... 143
A ................................................................................................................................................................................................ 143
B................................................................................................................................................................................................. 143
L ................................................................................................................................................................................................. 143
Name ....................................................................................................................................................................................... 143
Layer............................................................................................................................................................................................... 144
Layer properties................................................................................................................................................................... 144
Application ............................................................................................................................................................................ 144
ArtworkKnockout................................................................................................................................................................ 144
BlendingMode...................................................................................................................................................................... 144
Color......................................................................................................................................................................................... 144
CompoundPathItems ........................................................................................................................................................ 144
DimPlacedImages ............................................................................................................................................................... 144
GraphItems............................................................................................................................................................................ 144
GroupItems ........................................................................................................................................................................... 144
HasSelectedArtwork .......................................................................................................................................................... 144
IsIsolated ................................................................................................................................................................................ 144
Layers....................................................................................................................................................................................... 144
LegacyTextItems ................................................................................................................................................................. 144
Locked..................................................................................................................................................................................... 144
MeshItems ............................................................................................................................................................................. 144
Name ....................................................................................................................................................................................... 144
Adobe Illustrator CS2
Visual Basic Scripting Reference
18
Opacity.................................................................................................................................................................................... 144
PageItems .............................................................................................................................................................................. 144
Parent ...................................................................................................................................................................................... 144
PathItems ............................................................................................................................................................................... 145
PlacedItems........................................................................................................................................................................... 145
PluginItems ........................................................................................................................................................................... 145
Preview ................................................................................................................................................................................... 145
Printable ................................................................................................................................................................................. 145
RasterItems............................................................................................................................................................................ 145
Sliced ....................................................................................................................................................................................... 145
SymbolItems ......................................................................................................................................................................... 145
TextFrames ............................................................................................................................................................................ 145
Visible ...................................................................................................................................................................................... 145
ZOrderPosition..................................................................................................................................................................... 145
Layer methods ..................................................................................................................................................................... 145
Delete ...................................................................................................................................................................................... 145
Move ........................................................................................................................................................................................ 145
Paste......................................................................................................................................................................................... 145
ZOrder ..................................................................................................................................................................................... 145
Layers............................................................................................................................................................................................. 147
Layers properties................................................................................................................................................................. 147
Application ............................................................................................................................................................................ 147
Count....................................................................................................................................................................................... 147
Parent ...................................................................................................................................................................................... 147
Layers methods.................................................................................................................................................................... 147
Add ........................................................................................................................................................................................... 147
Index ........................................................................................................................................................................................ 147
RemoveAll.............................................................................................................................................................................. 147
LegacyTextItem.......................................................................................................................................................................... 149
LegacyTextItem properties ............................................................................................................................................. 149
Application ............................................................................................................................................................................ 149
ArtworkKnockout................................................................................................................................................................ 149
BlendingMode...................................................................................................................................................................... 149
ControlBounds..................................................................................................................................................................... 149
Converted .............................................................................................................................................................................. 149
Editable................................................................................................................................................................................... 149
GeometricBounds............................................................................................................................................................... 149
Height...................................................................................................................................................................................... 149
Hidden..................................................................................................................................................................................... 149
IsIsolated ................................................................................................................................................................................ 149
Layer ........................................................................................................................................................................................ 149
Left............................................................................................................................................................................................ 149
Locked..................................................................................................................................................................................... 149
Name ....................................................................................................................................................................................... 149
Opacity.................................................................................................................................................................................... 149
Parent ...................................................................................................................................................................................... 149
Position ................................................................................................................................................................................... 149
Selected .................................................................................................................................................................................. 149
Sliced ....................................................................................................................................................................................... 149
Tags.......................................................................................................................................................................................... 149
Top............................................................................................................................................................................................ 149
Adobe Illustrator CS2
Visual Basic Scripting Reference
19
URL ........................................................................................................................................................................................... 150
VisibilityVariable .................................................................................................................................................................. 150
VisibleBounds....................................................................................................................................................................... 150
Width ....................................................................................................................................................................................... 150
WrapInside............................................................................................................................................................................. 150
WrapOffset............................................................................................................................................................................. 150
Wrapped................................................................................................................................................................................. 150
ZOrderPosition..................................................................................................................................................................... 150
LegacyTextItem methods ................................................................................................................................................ 150
ConvertToNative ................................................................................................................................................................. 150
Copy......................................................................................................................................................................................... 150
Cut ............................................................................................................................................................................................ 150
Duplicate................................................................................................................................................................................ 150
Delete ...................................................................................................................................................................................... 150
Move ........................................................................................................................................................................................ 150
Resize....................................................................................................................................................................................... 151
Rotate ...................................................................................................................................................................................... 151
Transform............................................................................................................................................................................... 151
Translate ................................................................................................................................................................................. 151
ZOrder ..................................................................................................................................................................................... 151
LegacyTextItems........................................................................................................................................................................ 152
LegacyTextItems properties............................................................................................................................................ 152
Application ............................................................................................................................................................................ 152
Count....................................................................................................................................................................................... 152
Parent ...................................................................................................................................................................................... 152
LegacyTextItems methods .............................................................................................................................................. 152
ConvertToNative ................................................................................................................................................................. 152
Index ........................................................................................................................................................................................ 152
Item .......................................................................................................................................................................................... 152
RemoveAll.............................................................................................................................................................................. 152
Lines ............................................................................................................................................................................................... 153
Lines properties ................................................................................................................................................................... 153
Application ............................................................................................................................................................................ 153
Count....................................................................................................................................................................................... 153
Parent ...................................................................................................................................................................................... 153
Lines methods...................................................................................................................................................................... 153
Index ........................................................................................................................................................................................ 153
Item .......................................................................................................................................................................................... 153
RemoveAll.............................................................................................................................................................................. 153
Matrix............................................................................................................................................................................................. 154
Matrix properties................................................................................................................................................................. 154
Application ............................................................................................................................................................................ 154
MValueA ................................................................................................................................................................................. 154
MValueB.................................................................................................................................................................................. 154
MValueC ................................................................................................................................................................................. 154
MValueD ................................................................................................................................................................................. 154
MValueTX ............................................................................................................................................................................... 154
MValueTY ............................................................................................................................................................................... 154
MeshItem...................................................................................................................................................................................... 155
MeshItem properties ......................................................................................................................................................... 155
Application ............................................................................................................................................................................ 155
Adobe Illustrator CS2
Visual Basic Scripting Reference
20
ArtworkKnockout................................................................................................................................................................ 155
BlendingMode...................................................................................................................................................................... 155
ControlBounds..................................................................................................................................................................... 155
Editable................................................................................................................................................................................... 155
GeometricBounds............................................................................................................................................................... 155
Height...................................................................................................................................................................................... 155
Hidden..................................................................................................................................................................................... 155
IsIsolated ................................................................................................................................................................................ 155
Layer ........................................................................................................................................................................................ 155
Left............................................................................................................................................................................................ 155
Locked..................................................................................................................................................................................... 155
Name ....................................................................................................................................................................................... 155
Opacity.................................................................................................................................................................................... 155
Parent ...................................................................................................................................................................................... 155
Position ................................................................................................................................................................................... 155
Selected .................................................................................................................................................................................. 155
Sliced ....................................................................................................................................................................................... 155
Tags.......................................................................................................................................................................................... 155
Top............................................................................................................................................................................................ 155
URL ........................................................................................................................................................................................... 155
VisibilityVariable .................................................................................................................................................................. 155
VisibleBounds....................................................................................................................................................................... 155
Width ....................................................................................................................................................................................... 156
WrapInside............................................................................................................................................................................. 156
WrapOffset............................................................................................................................................................................. 156
Wrapped................................................................................................................................................................................. 156
ZOrderPosition..................................................................................................................................................................... 156
MeshItem methods ............................................................................................................................................................ 156
Copy......................................................................................................................................................................................... 156
Cut ............................................................................................................................................................................................ 156
Delete ...................................................................................................................................................................................... 156
Duplicate................................................................................................................................................................................ 156
Move ........................................................................................................................................................................................ 156
Resize....................................................................................................................................................................................... 156
Rotate ...................................................................................................................................................................................... 156
Transform............................................................................................................................................................................... 157
Translate ................................................................................................................................................................................. 157
ZOrder ..................................................................................................................................................................................... 157
MeshItems.................................................................................................................................................................................... 158
MeshItems properties........................................................................................................................................................ 158
Application ............................................................................................................................................................................ 158
Count....................................................................................................................................................................................... 158
Parent ...................................................................................................................................................................................... 158
MeshItems methods .......................................................................................................................................................... 158
Index ........................................................................................................................................................................................ 158
Item .......................................................................................................................................................................................... 158
RemoveAll.............................................................................................................................................................................. 158
NoColor ......................................................................................................................................................................................... 160
NoColor properties............................................................................................................................................................. 160
Application ............................................................................................................................................................................ 160
OpenOptions .............................................................................................................................................................................. 161
Adobe Illustrator CS2
Visual Basic Scripting Reference
21
OpenOptions properties .................................................................................................................................................. 161
Application ............................................................................................................................................................................ 161
UpdateLegacyText.............................................................................................................................................................. 161
PageItems..................................................................................................................................................................................... 162
PageItems properties ........................................................................................................................................................ 162
Application ............................................................................................................................................................................ 162
Count....................................................................................................................................................................................... 162
Parent ...................................................................................................................................................................................... 162
PageItems methods ........................................................................................................................................................... 162
Index ........................................................................................................................................................................................ 162
Item .......................................................................................................................................................................................... 162
RemoveAll.............................................................................................................................................................................. 162
Paper .............................................................................................................................................................................................. 164
Paper properties.................................................................................................................................................................. 164
Application ............................................................................................................................................................................ 164
Name ....................................................................................................................................................................................... 164
PaperInfo................................................................................................................................................................................ 164
PaperInfo ...................................................................................................................................................................................... 164
PaperInfo properties .......................................................................................................................................................... 164
Application ............................................................................................................................................................................ 164
CustomPaper ........................................................................................................................................................................ 164
Height...................................................................................................................................................................................... 164
ImageableArea..................................................................................................................................................................... 164
Width ....................................................................................................................................................................................... 164
ParagraphAttributes................................................................................................................................................................. 166
ParagraphAttributes properties .................................................................................................................................... 166
Application ............................................................................................................................................................................ 166
AutoLeadingAmount......................................................................................................................................................... 166
BunriKinshi............................................................................................................................................................................. 166
BurasagariType .................................................................................................................................................................... 166
DesiredGlyphScaling ......................................................................................................................................................... 166
DesiredLetterSpacing........................................................................................................................................................ 166
DesiredWordSpacing......................................................................................................................................................... 166
EveryLineComposer ........................................................................................................................................................... 166
FirstLineIndent..................................................................................................................................................................... 166
HyphenateCapitalizedWords.......................................................................................................................................... 166
Hyphenation ......................................................................................................................................................................... 166
HyphenationPreference ................................................................................................................................................... 166
HyphenationZone............................................................................................................................................................... 166
Justification ........................................................................................................................................................................... 166
Kinsoku ................................................................................................................................................................................... 166
KinsokuOrder........................................................................................................................................................................ 166
KurikaeshiMojiShori ........................................................................................................................................................... 167
LeadingType ......................................................................................................................................................................... 167
LeftIndent .............................................................................................................................................................................. 167
MaximumConsecutiveHyphens .................................................................................................................................... 167
MaximumGlyphScaling..................................................................................................................................................... 167
MaximumLetterSpacing ................................................................................................................................................... 167
MaximumWordSpacing.................................................................................................................................................... 167
MinimumAfterHyphen...................................................................................................................................................... 167
MinimumBeforeHyphen................................................................................................................................................... 167
Adobe Illustrator CS2
Visual Basic Scripting Reference
22
MinimumGlyphScaling ..................................................................................................................................................... 167
MinimumHyphenatedWordSize.................................................................................................................................... 167
MinimumLetterSpacing.................................................................................................................................................... 167
MinimumWordSpacing..................................................................................................................................................... 167
Mojikumi ................................................................................................................................................................................ 167
Parent ...................................................................................................................................................................................... 167
RightIndent ........................................................................................................................................................................... 167
RomanHanging.................................................................................................................................................................... 167
SingleWordJustification.................................................................................................................................................... 167
SpaceAfter ............................................................................................................................................................................. 167
SpaceBefore .......................................................................................................................................................................... 167
TabStops................................................................................................................................................................................. 167
Paragraphs................................................................................................................................................................................... 169
Paragraphs properties....................................................................................................................................................... 169
Application ............................................................................................................................................................................ 169
Count....................................................................................................................................................................................... 169
Parent ...................................................................................................................................................................................... 169
Paragraphs methods.......................................................................................................................................................... 169
Add ........................................................................................................................................................................................... 169
AddBefore.............................................................................................................................................................................. 169
Index ........................................................................................................................................................................................ 169
Item .......................................................................................................................................................................................... 169
RemoveAll.............................................................................................................................................................................. 169
ParagraphStyle ........................................................................................................................................................................... 171
ParagraphStyle properties............................................................................................................................................... 171
Application ............................................................................................................................................................................ 171
CharacterAttributes............................................................................................................................................................ 171
Name ....................................................................................................................................................................................... 171
ParagraphAttributes .......................................................................................................................................................... 171
Parent ...................................................................................................................................................................................... 171
ParagraphStyle methods.................................................................................................................................................. 171
ApplyTo .................................................................................................................................................................................. 171
Delete ...................................................................................................................................................................................... 171
ParagraphStyles ......................................................................................................................................................................... 173
ParagraphStyles properties............................................................................................................................................. 173
Application ............................................................................................................................................................................ 173
Count....................................................................................................................................................................................... 173
Parent ...................................................................................................................................................................................... 173
ParagraphStyles methods................................................................................................................................................ 173
Add ........................................................................................................................................................................................... 173
Index ........................................................................................................................................................................................ 173
Item .......................................................................................................................................................................................... 173
RemoveAll.............................................................................................................................................................................. 173
PathItem ....................................................................................................................................................................................... 174
PathItem properties ........................................................................................................................................................... 174
Application ............................................................................................................................................................................ 174
Area .......................................................................................................................................................................................... 174
ArtworkKnockout................................................................................................................................................................ 174
BlendingMode...................................................................................................................................................................... 174
Clipping .................................................................................................................................................................................. 174
Closed...................................................................................................................................................................................... 174
Adobe Illustrator CS2
Visual Basic Scripting Reference
23
ControlBounds..................................................................................................................................................................... 174
Editable................................................................................................................................................................................... 174
Evenodd ................................................................................................................................................................................. 174
FillColor................................................................................................................................................................................... 174
Filled ........................................................................................................................................................................................ 174
FillOverprint .......................................................................................................................................................................... 174
GeometricBounds............................................................................................................................................................... 174
Guides ..................................................................................................................................................................................... 174
Height...................................................................................................................................................................................... 174
Hidden..................................................................................................................................................................................... 174
IsIsolated ................................................................................................................................................................................ 174
Layer ........................................................................................................................................................................................ 174
Left............................................................................................................................................................................................ 174
Locked..................................................................................................................................................................................... 174
Name ....................................................................................................................................................................................... 175
Note ......................................................................................................................................................................................... 175
Opacity.................................................................................................................................................................................... 175
Parent ...................................................................................................................................................................................... 175
PathPoints.............................................................................................................................................................................. 175
Polarity .................................................................................................................................................................................... 175
Position ................................................................................................................................................................................... 175
Resolution.............................................................................................................................................................................. 175
Selected .................................................................................................................................................................................. 175
SelectedPathPoints ............................................................................................................................................................ 175
Sliced ....................................................................................................................................................................................... 175
StrokeCap............................................................................................................................................................................... 175
StrokeColor............................................................................................................................................................................ 175
Stroked.................................................................................................................................................................................... 175
StrokeDashes ........................................................................................................................................................................ 175
StrokeDashOffset ................................................................................................................................................................ 175
StrokeJoin .............................................................................................................................................................................. 175
StrokeMiterLimit.................................................................................................................................................................. 175
StrokeOverprint ................................................................................................................................................................... 175
StrokeWidth .......................................................................................................................................................................... 175
Tags.......................................................................................................................................................................................... 175
Top............................................................................................................................................................................................ 175
URL ........................................................................................................................................................................................... 175
VisibilityVariable .................................................................................................................................................................. 176
VisibleBounds....................................................................................................................................................................... 176
Width ....................................................................................................................................................................................... 176
WrapInside............................................................................................................................................................................. 176
WrapOffset............................................................................................................................................................................. 176
Wrapped................................................................................................................................................................................. 176
ZOrderPosition..................................................................................................................................................................... 176
PathItem methods.............................................................................................................................................................. 176
Copy......................................................................................................................................................................................... 176
Cut ............................................................................................................................................................................................ 176
Delete ...................................................................................................................................................................................... 176
Duplicate................................................................................................................................................................................ 176
Move ........................................................................................................................................................................................ 176
Resize....................................................................................................................................................................................... 176
Adobe Illustrator CS2
Visual Basic Scripting Reference
24
Rotate ...................................................................................................................................................................................... 177
SetEntirePath ........................................................................................................................................................................ 177
Transform............................................................................................................................................................................... 177
Translate ................................................................................................................................................................................. 177
ZOrder ..................................................................................................................................................................................... 177
PathItems ..................................................................................................................................................................................... 179
PathItems properties ......................................................................................................................................................... 179
Application ............................................................................................................................................................................ 179
Count....................................................................................................................................................................................... 179
Parent ...................................................................................................................................................................................... 179
PathItems methods ............................................................................................................................................................ 179
Add ........................................................................................................................................................................................... 179
Ellipse ...................................................................................................................................................................................... 179
Index ........................................................................................................................................................................................ 179
Item .......................................................................................................................................................................................... 179
Polygon................................................................................................................................................................................... 179
Rectangle ............................................................................................................................................................................... 179
RemoveAll.............................................................................................................................................................................. 179
RoundedRectangle............................................................................................................................................................. 180
Star ........................................................................................................................................................................................... 180
PathPoint...................................................................................................................................................................................... 181
PathPoint properties.......................................................................................................................................................... 181
Anchor..................................................................................................................................................................................... 181
Application ............................................................................................................................................................................ 181
LeftDirection ......................................................................................................................................................................... 181
Parent ...................................................................................................................................................................................... 181
PointType............................................................................................................................................................................... 181
RightDirection ...................................................................................................................................................................... 181
Selected .................................................................................................................................................................................. 181
PathPoint methods ............................................................................................................................................................ 181
Delete ...................................................................................................................................................................................... 181
PathPoints.................................................................................................................................................................................... 183
PathPoints properties........................................................................................................................................................ 183
Application ............................................................................................................................................................................ 183
Count....................................................................................................................................................................................... 183
Parent ...................................................................................................................................................................................... 183
PathPoints methods........................................................................................................................................................... 183
Add ........................................................................................................................................................................................... 183
Index ........................................................................................................................................................................................ 183
Item .......................................................................................................................................................................................... 183
RemoveAll.............................................................................................................................................................................. 183
Pattern........................................................................................................................................................................................... 184
Pattern properties............................................................................................................................................................... 184
Application ............................................................................................................................................................................ 184
Name ....................................................................................................................................................................................... 184
Parent ...................................................................................................................................................................................... 184
Pattern methods.................................................................................................................................................................. 184
Delete ...................................................................................................................................................................................... 184
PatternColor ................................................................................................................................................................................ 185
PatternColor properties.................................................................................................................................................... 185
Application ............................................................................................................................................................................ 185
Adobe Illustrator CS2
Visual Basic Scripting Reference
25
Matrix....................................................................................................................................................................................... 185
Pattern..................................................................................................................................................................................... 185
Reflect...................................................................................................................................................................................... 185
ReflectAngle.......................................................................................................................................................................... 185
Rotation .................................................................................................................................................................................. 185
ScaleFactor ............................................................................................................................................................................ 185
ShearAngle ............................................................................................................................................................................ 185
ShearAxis................................................................................................................................................................................ 185
ShiftAngle .............................................................................................................................................................................. 185
ShiftDistance......................................................................................................................................................................... 185
Patterns......................................................................................................................................................................................... 187
Patterns properties............................................................................................................................................................. 187
Application ............................................................................................................................................................................ 187
Count....................................................................................................................................................................................... 187
Parent ...................................................................................................................................................................................... 187
Patterns methods................................................................................................................................................................ 187
Add ........................................................................................................................................................................................... 187
Index ........................................................................................................................................................................................ 187
Item .......................................................................................................................................................................................... 187
RemoveAll.............................................................................................................................................................................. 187
PDFFileOptions .......................................................................................................................................................................... 188
PDFFileOptions properties .............................................................................................................................................. 188
Application ............................................................................................................................................................................ 188
PageToOpen ......................................................................................................................................................................... 188
Parent ...................................................................................................................................................................................... 188
PDFCropToBox..................................................................................................................................................................... 188
PDFSaveOptions ........................................................................................................................................................................ 189
PDFSaveOptions properties............................................................................................................................................ 189
AcrobatLayers....................................................................................................................................................................... 189
Application ............................................................................................................................................................................ 189
BleedLink................................................................................................................................................................................ 189
BleedOffsetRect ................................................................................................................................................................... 189
ColorBars ................................................................................................................................................................................ 189
ColorCompression .............................................................................................................................................................. 189
ColorConversionID ............................................................................................................................................................. 189
ColorDestinationID............................................................................................................................................................. 189
ColorDownsampling.......................................................................................................................................................... 189
ColorDownsamplingImage- Threshold ...................................................................................................................... 189
ColorDownsamplingMethod.......................................................................................................................................... 189
ColorProfileID ....................................................................................................................................................................... 189
ColorTileSize ......................................................................................................................................................................... 189
Compatibility ........................................................................................................................................................................ 189
CompressArt ......................................................................................................................................................................... 189
DocumentPassword........................................................................................................................................................... 189
EnableAccess ........................................................................................................................................................................ 190
EnableCopy ........................................................................................................................................................................... 190
EnableCopyAccess.............................................................................................................................................................. 190
EnablePlainText ................................................................................................................................................................... 190
FlattenerOptions ................................................................................................................................................................. 190
FlattenerPreset..................................................................................................................................................................... 190
FontSubsetThreshold ........................................................................................................................................................ 190
Adobe Illustrator CS2
Visual Basic Scripting Reference
26
GenerateThumbnails ......................................................................................................................................................... 190
GrayscaleCompression...................................................................................................................................................... 190
GrayscaleDownsampling ................................................................................................................................................. 190
GrayscaleDownsampling- ImageThreshold .............................................................................................................. 190
GrayscaleDownsampling- Method............................................................................................................................... 190
GrayscaleTileSize ................................................................................................................................................................. 190
MonochromeCompression ............................................................................................................................................. 190
MonochromeDownsampling ......................................................................................................................................... 190
MonochromeDownsampling- ImageThreshold...................................................................................................... 190
MonochromeDownsampling- Method....................................................................................................................... 190
Offset ....................................................................................................................................................................................... 191
Optimization......................................................................................................................................................................... 191
OutputCondition................................................................................................................................................................. 191
OutputConditionID ............................................................................................................................................................ 191
PageInformation ................................................................................................................................................................. 191
PageMarksType.................................................................................................................................................................... 191
PDFAllowPrinting................................................................................................................................................................ 191
PDFChangesAllowed ......................................................................................................................................................... 191
PDFPreset............................................................................................................................................................................... 191
PDFXStandard ...................................................................................................................................................................... 191
PDFXStandardDescription............................................................................................................................................... 191
PermissionPassword .......................................................................................................................................................... 191
PreserveEditability.............................................................................................................................................................. 191
PrinterResolution ................................................................................................................................................................ 191
RegistrationMarks ............................................................................................................................................................... 191
RequireDocumentPassword ........................................................................................................................................... 191
RequirePermissionPassword........................................................................................................................................... 191
Trapped .................................................................................................................................................................................. 191
TrimMarks .............................................................................................................................................................................. 192
TrimMarkWeight.................................................................................................................................................................. 192
ViewAfterSaving .................................................................................................................................................................. 192
PhotoshopFileOptions ............................................................................................................................................................ 193
PhotoshopFileOptions properties ................................................................................................................................ 193
Application ............................................................................................................................................................................ 193
Parent ...................................................................................................................................................................................... 193
PixelAspectRatioCorrection ............................................................................................................................................ 193
PreserveImageMaps........................................................................................................................................................... 193
PreserveLayers ..................................................................................................................................................................... 193
PreserveSlices ....................................................................................................................................................................... 193
PlacedItem ................................................................................................................................................................................... 194
PlacedItem properties ....................................................................................................................................................... 194
Application ............................................................................................................................................................................ 194
ArtworkKnockout................................................................................................................................................................ 194
BlendingMode...................................................................................................................................................................... 194
BoundingBox ........................................................................................................................................................................ 194
ContentVariable................................................................................................................................................................... 194
ControlBounds..................................................................................................................................................................... 194
Editable................................................................................................................................................................................... 194
File ............................................................................................................................................................................................ 194
GeometricBounds............................................................................................................................................................... 194
Height...................................................................................................................................................................................... 194
Adobe Illustrator CS2
Visual Basic Scripting Reference
27
Hidden..................................................................................................................................................................................... 194
IsIsolated ................................................................................................................................................................................ 194
Layer ........................................................................................................................................................................................ 194
Left............................................................................................................................................................................................ 194
Locked..................................................................................................................................................................................... 194
Matrix....................................................................................................................................................................................... 194
Name ....................................................................................................................................................................................... 195
Opacity.................................................................................................................................................................................... 195
Parent ...................................................................................................................................................................................... 195
Position ................................................................................................................................................................................... 195
Selected .................................................................................................................................................................................. 195
Sliced ....................................................................................................................................................................................... 195
Tags.......................................................................................................................................................................................... 195
Top............................................................................................................................................................................................ 195
URL ........................................................................................................................................................................................... 195
VisibilityVariable .................................................................................................................................................................. 195
VisibleBounds....................................................................................................................................................................... 195
Width ....................................................................................................................................................................................... 195
WrapInside............................................................................................................................................................................. 195
WrapOffset............................................................................................................................................................................. 195
Wrapped................................................................................................................................................................................. 195
ZOrderPosition..................................................................................................................................................................... 195
PlacedItem methods.......................................................................................................................................................... 195
Copy......................................................................................................................................................................................... 195
Cut ............................................................................................................................................................................................ 195
Delete ...................................................................................................................................................................................... 195
Duplicate................................................................................................................................................................................ 196
Embed ..................................................................................................................................................................................... 196
Resize....................................................................................................................................................................................... 196
Rotate ...................................................................................................................................................................................... 196
Transform............................................................................................................................................................................... 196
Translate ................................................................................................................................................................................. 196
ZOrder ..................................................................................................................................................................................... 196
PlacedItems ................................................................................................................................................................................. 197
PlacedItems properties ..................................................................................................................................................... 197
Application ............................................................................................................................................................................ 197
Count....................................................................................................................................................................................... 197
Parent ...................................................................................................................................................................................... 197
PlacedItems methods........................................................................................................................................................ 197
Add ........................................................................................................................................................................................... 197
Index ........................................................................................................................................................................................ 197
Item .......................................................................................................................................................................................... 197
RemoveAll.............................................................................................................................................................................. 197
PluginItem.................................................................................................................................................................................... 198
PluginItem properties ....................................................................................................................................................... 198
Application ............................................................................................................................................................................ 198
ArtworkKnockout................................................................................................................................................................ 198
BlendingMode...................................................................................................................................................................... 198
ControlBounds..................................................................................................................................................................... 198
Editable................................................................................................................................................................................... 198
GeometricBounds............................................................................................................................................................... 198
Adobe Illustrator CS2
Visual Basic Scripting Reference
28
Height...................................................................................................................................................................................... 198
Hidden..................................................................................................................................................................................... 198
IsIsolated ................................................................................................................................................................................ 198
IsTracing ................................................................................................................................................................................. 198
Layer ........................................................................................................................................................................................ 198
Left............................................................................................................................................................................................ 198
Locked..................................................................................................................................................................................... 198
Name ....................................................................................................................................................................................... 198
Opacity.................................................................................................................................................................................... 198
Parent ...................................................................................................................................................................................... 198
Position ................................................................................................................................................................................... 198
Selected .................................................................................................................................................................................. 198
Sliced ....................................................................................................................................................................................... 198
Tags.......................................................................................................................................................................................... 198
Top............................................................................................................................................................................................ 198
Tracing .................................................................................................................................................................................... 199
URL ........................................................................................................................................................................................... 199
VisibilityVariable .................................................................................................................................................................. 199
VisibleBounds....................................................................................................................................................................... 199
Width ....................................................................................................................................................................................... 199
WrapInside............................................................................................................................................................................. 199
WrapOffset............................................................................................................................................................................. 199
Wrapped................................................................................................................................................................................. 199
ZOrderPosition..................................................................................................................................................................... 199
PluginItem methods .......................................................................................................................................................... 199
Copy......................................................................................................................................................................................... 199
Cut ............................................................................................................................................................................................ 199
Delete ...................................................................................................................................................................................... 199
Duplicate................................................................................................................................................................................ 199
Move ........................................................................................................................................................................................ 199
Resize....................................................................................................................................................................................... 200
Rotate ...................................................................................................................................................................................... 200
Trace ........................................................................................................................................................................................ 200
Transform............................................................................................................................................................................... 200
Translate ................................................................................................................................................................................. 200
ZOrder ..................................................................................................................................................................................... 200
PluginItems.................................................................................................................................................................................. 202
PluginItems properties...................................................................................................................................................... 202
Application ............................................................................................................................................................................ 202
Count....................................................................................................................................................................................... 202
Parent ...................................................................................................................................................................................... 202
PluginItems methods ........................................................................................................................................................ 202
Index ........................................................................................................................................................................................ 202
Item .......................................................................................................................................................................................... 202
RemoveAll.............................................................................................................................................................................. 202
PPDFile .......................................................................................................................................................................................... 203
PPDFile properties .............................................................................................................................................................. 203
Application ............................................................................................................................................................................ 203
Name ....................................................................................................................................................................................... 203
PPDInfo ................................................................................................................................................................................... 203
PPDFileInfo .................................................................................................................................................................................. 203
Adobe Illustrator CS2
Visual Basic Scripting Reference
29
PPDFileInfo properties ...................................................................................................................................................... 203
Application ............................................................................................................................................................................ 203
LanguageLevel..................................................................................................................................................................... 203
PPDFilePath........................................................................................................................................................................... 203
ScreenList............................................................................................................................................................................... 203
ScreenSpotFunctionList ................................................................................................................................................... 203
Preferences .................................................................................................................................................................................. 205
Preferences properties...................................................................................................................................................... 205
Application ............................................................................................................................................................................ 205
Parent ...................................................................................................................................................................................... 205
PDFFileOptions .................................................................................................................................................................... 205
PhotoshopFileOptions ...................................................................................................................................................... 205
PrintColorManagementOptions .......................................................................................................................................... 206
PrintColorManagementOptions properties .............................................................................................................. 206
Application ............................................................................................................................................................................ 206
ColorProfileMode................................................................................................................................................................ 206
Intent ....................................................................................................................................................................................... 206
Name ....................................................................................................................................................................................... 206
PrintColorSeparationOptions ............................................................................................................................................... 207
PrintColorSeparationOptions properties ................................................................................................................... 207
Application ............................................................................................................................................................................ 207
ColorSeparationMode ....................................................................................................................................................... 207
ConvertSpotColors ............................................................................................................................................................. 207
InkList ...................................................................................................................................................................................... 207
OverPrintBlack...................................................................................................................................................................... 207
PrintCoordinateOptions ......................................................................................................................................................... 209
PrintCoordinateOptions properties ............................................................................................................................. 209
Application ............................................................................................................................................................................ 209
Emulsion................................................................................................................................................................................. 209
FitToPage ............................................................................................................................................................................... 209
HorizontalScale.................................................................................................................................................................... 209
Orientation ............................................................................................................................................................................ 209
Position ................................................................................................................................................................................... 209
Tiling ........................................................................................................................................................................................ 209
VerticalScale.......................................................................................................................................................................... 209
Printer ............................................................................................................................................................................................ 211
Printer properties................................................................................................................................................................ 211
Application ............................................................................................................................................................................ 211
Name ....................................................................................................................................................................................... 211
PrinterInfo.............................................................................................................................................................................. 211
PrinterInfo .................................................................................................................................................................................... 211
PrinterInfo properties ........................................................................................................................................................ 211
Application ............................................................................................................................................................................ 211
BinaryPrintingSupport ...................................................................................................................................................... 211
ColorSupport ........................................................................................................................................................................ 211
CustomPaperSupport........................................................................................................................................................ 211
CustomPaperTransverse-Support................................................................................................................................. 211
DeviceResolution ................................................................................................................................................................ 211
InRIPSeparationSupport ................................................................................................................................................... 211
MaxDeviceResolution........................................................................................................................................................ 211
MaxPaperHeight.................................................................................................................................................................. 211
Adobe Illustrator CS2
Visual Basic Scripting Reference
30
MaxPaperHeightOffset ..................................................................................................................................................... 211
MaxPaperWidth ................................................................................................................................................................... 211
MaxPaperWidthOffset....................................................................................................................................................... 211
MinPaperHeight .................................................................................................................................................................. 211
MinPaperHeightOffset ...................................................................................................................................................... 211
MinPaperWidth.................................................................................................................................................................... 211
MinPaperWidthOffset........................................................................................................................................................ 211
PaperSizes.............................................................................................................................................................................. 212
PostScriptLevel .................................................................................................................................................................... 212
PrinterType............................................................................................................................................................................ 212
PrintFlattenerOptions.............................................................................................................................................................. 214
PrintFlattenerOptions properties.................................................................................................................................. 214
Application ............................................................................................................................................................................ 214
ClipComplexRegions ......................................................................................................................................................... 214
ConvertStrokesToOutlines............................................................................................................................................... 214
ConvertTextToOutlines..................................................................................................................................................... 214
FlatteningBalance ............................................................................................................................................................... 214
GradientResolution ............................................................................................................................................................ 214
Overprint................................................................................................................................................................................ 214
RasterizationResolution.................................................................................................................................................... 214
PrintFontOptions....................................................................................................................................................................... 216
PrintFontOptions properties........................................................................................................................................... 216
Application ............................................................................................................................................................................ 216
DownloadFonts ................................................................................................................................................................... 216
FontSubstitution ................................................................................................................................................................. 216
PrintJobOptions......................................................................................................................................................................... 217
PrintJobOptions properties............................................................................................................................................. 217
Application ............................................................................................................................................................................ 217
BitmapResolution ............................................................................................................................................................... 217
Collate ..................................................................................................................................................................................... 217
Copies...................................................................................................................................................................................... 217
Designation........................................................................................................................................................................... 217
File ............................................................................................................................................................................................ 217
Name ....................................................................................................................................................................................... 217
PrintArea ................................................................................................................................................................................ 217
PrintAsBitmap ...................................................................................................................................................................... 217
ReversePages........................................................................................................................................................................ 217
PrintOptions ................................................................................................................................................................................ 219
PrintOptions properties.................................................................................................................................................... 219
Application ............................................................................................................................................................................ 219
ColorManagementOptions ............................................................................................................................................. 219
ColorSeparationOptions................................................................................................................................................... 219
CoordinateOptions............................................................................................................................................................. 219
FlattenerOptions ................................................................................................................................................................. 219
FlattenerPreset..................................................................................................................................................................... 219
FontOptions .......................................................................................................................................................................... 219
JobOptions ............................................................................................................................................................................ 219
PageMarksOptions ............................................................................................................................................................. 219
PaperOptions........................................................................................................................................................................ 219
PostScriptOptions............................................................................................................................................................... 219
PPDName ............................................................................................................................................................................... 219
Adobe Illustrator CS2
Visual Basic Scripting Reference
31
PrinterName.......................................................................................................................................................................... 219
PrintPreset ............................................................................................................................................................................. 219
PrintPageMarksOptions .......................................................................................................................................................... 221
PrintPageMarksOptions properties.............................................................................................................................. 221
Application ............................................................................................................................................................................ 221
BleedOffsetRect ................................................................................................................................................................... 221
ColorBars ................................................................................................................................................................................ 221
MarksOffsetRect................................................................................................................................................................... 221
PageInfoMarks ..................................................................................................................................................................... 221
PageMarksType.................................................................................................................................................................... 221
RegistrationMarks ............................................................................................................................................................... 221
TrimMarks .............................................................................................................................................................................. 221
TrimMarksWeight................................................................................................................................................................ 221
PrintPaperOptions .................................................................................................................................................................... 223
PrintPaperOptions properties ........................................................................................................................................ 223
Application ............................................................................................................................................................................ 223
Height...................................................................................................................................................................................... 223
Name ....................................................................................................................................................................................... 223
Offset ....................................................................................................................................................................................... 223
Transverse.............................................................................................................................................................................. 223
Width ....................................................................................................................................................................................... 223
PrintPostScriptOptions............................................................................................................................................................ 224
PrintPostScriptOptions properties................................................................................................................................ 224
Application ............................................................................................................................................................................ 224
BinaryPrinting....................................................................................................................................................................... 224
CompatibleShading ........................................................................................................................................................... 224
ForceContinuousTone....................................................................................................................................................... 224
ImageCompression ............................................................................................................................................................ 224
NegativePrinting ................................................................................................................................................................. 224
PostScriptLevel .................................................................................................................................................................... 224
ShadingResolution ............................................................................................................................................................. 224
RasterItem .................................................................................................................................................................................... 226
RasterItem properties........................................................................................................................................................ 226
Application ............................................................................................................................................................................ 226
ArtworkKnockout................................................................................................................................................................ 226
BlendingMode...................................................................................................................................................................... 226
BoundingBox ........................................................................................................................................................................ 226
ContentVariable................................................................................................................................................................... 226
ControlBounds..................................................................................................................................................................... 226
Editable................................................................................................................................................................................... 226
Embedded ............................................................................................................................................................................. 226
File ............................................................................................................................................................................................ 226
GeometricBounds............................................................................................................................................................... 226
Height...................................................................................................................................................................................... 226
Hidden..................................................................................................................................................................................... 226
ImageColorSpace................................................................................................................................................................ 226
IsIsolated ................................................................................................................................................................................ 226
Layer ........................................................................................................................................................................................ 226
Left............................................................................................................................................................................................ 226
Locked..................................................................................................................................................................................... 226
Matrix....................................................................................................................................................................................... 226
Adobe Illustrator CS2
Visual Basic Scripting Reference
32
Name ....................................................................................................................................................................................... 226
Opacity.................................................................................................................................................................................... 226
Parent ...................................................................................................................................................................................... 226
Position ................................................................................................................................................................................... 226
Selected .................................................................................................................................................................................. 227
Sliced ....................................................................................................................................................................................... 227
Status....................................................................................................................................................................................... 227
Tags.......................................................................................................................................................................................... 227
Top............................................................................................................................................................................................ 227
URL ........................................................................................................................................................................................... 227
VisibilityVariable .................................................................................................................................................................. 227
VisibleBounds....................................................................................................................................................................... 227
Width ....................................................................................................................................................................................... 227
WrapInside............................................................................................................................................................................. 227
WrapOffset............................................................................................................................................................................. 227
Wrapped................................................................................................................................................................................. 227
ZOrderPosition..................................................................................................................................................................... 227
RasterItem methods........................................................................................................................................................... 227
Colorize................................................................................................................................................................................... 227
Copy......................................................................................................................................................................................... 227
Cut ............................................................................................................................................................................................ 227
Delete ...................................................................................................................................................................................... 227
Duplicate................................................................................................................................................................................ 227
Move ........................................................................................................................................................................................ 228
Resize....................................................................................................................................................................................... 228
Rotate ...................................................................................................................................................................................... 228
Trace ........................................................................................................................................................................................ 228
Transform............................................................................................................................................................................... 228
Translate ................................................................................................................................................................................. 228
ZOrder ..................................................................................................................................................................................... 228
RasterItems .................................................................................................................................................................................. 229
RasterItems properties ...................................................................................................................................................... 229
Application ............................................................................................................................................................................ 229
Count....................................................................................................................................................................................... 229
Parent ...................................................................................................................................................................................... 229
RasterItems methods......................................................................................................................................................... 229
Add ........................................................................................................................................................................................... 229
Index ........................................................................................................................................................................................ 229
Item .......................................................................................................................................................................................... 229
RemoveAll.............................................................................................................................................................................. 229
RGBColor....................................................................................................................................................................................... 230
RGBColor properties .......................................................................................................................................................... 230
Application ............................................................................................................................................................................ 230
Blue........................................................................................................................................................................................... 230
Green ....................................................................................................................................................................................... 230
Red............................................................................................................................................................................................ 230
Screen ............................................................................................................................................................................................ 231
Screen properties................................................................................................................................................................ 231
Application ............................................................................................................................................................................ 231
Name ....................................................................................................................................................................................... 231
ScreenInfo.............................................................................................................................................................................. 231
Adobe Illustrator CS2
Visual Basic Scripting Reference
33
ScreenInfo .................................................................................................................................................................................... 231
ScreenInfo properties ........................................................................................................................................................ 231
Angle ....................................................................................................................................................................................... 231
Application ............................................................................................................................................................................ 231
DefaultScreen....................................................................................................................................................................... 231
Frequency .............................................................................................................................................................................. 231
ScreenSpotFunction................................................................................................................................................................. 233
ScreenSpotFunction properties..................................................................................................................................... 233
Application ............................................................................................................................................................................ 233
Name ....................................................................................................................................................................................... 233
SpotFunction ........................................................................................................................................................................ 233
Spot ................................................................................................................................................................................................ 234
Spot properties .................................................................................................................................................................... 234
Application ............................................................................................................................................................................ 234
Color......................................................................................................................................................................................... 234
ColorType............................................................................................................................................................................... 234
Name ....................................................................................................................................................................................... 234
Parent ...................................................................................................................................................................................... 234
Spot methods....................................................................................................................................................................... 234
Delete ...................................................................................................................................................................................... 234
SpotColor ..................................................................................................................................................................................... 235
SpotColor properties ......................................................................................................................................................... 235
Application ............................................................................................................................................................................ 235
Spot.......................................................................................................................................................................................... 235
Tint............................................................................................................................................................................................ 235
Spots .............................................................................................................................................................................................. 236
Spots properties .................................................................................................................................................................. 236
Application ............................................................................................................................................................................ 236
Count....................................................................................................................................................................................... 236
Parent ...................................................................................................................................................................................... 236
Spots methods ..................................................................................................................................................................... 236
Add ........................................................................................................................................................................................... 236
Index ........................................................................................................................................................................................ 236
Item .......................................................................................................................................................................................... 236
RemoveAll.............................................................................................................................................................................. 236
Story ............................................................................................................................................................................................... 237
Story properties ................................................................................................................................................................... 237
Application ............................................................................................................................................................................ 237
Characters.............................................................................................................................................................................. 237
InsertionPoints..................................................................................................................................................................... 237
Length ..................................................................................................................................................................................... 237
Lines......................................................................................................................................................................................... 237
Paragraphs............................................................................................................................................................................. 237
Parent ...................................................................................................................................................................................... 237
TextFrames ............................................................................................................................................................................ 237
TextRange .............................................................................................................................................................................. 237
TextRanges ............................................................................................................................................................................ 237
TextSelection ........................................................................................................................................................................ 237
Words ...................................................................................................................................................................................... 237
Stories ............................................................................................................................................................................................ 239
Stories properties................................................................................................................................................................ 239
Adobe Illustrator CS2
Visual Basic Scripting Reference
34
Application ............................................................................................................................................................................ 239
Count....................................................................................................................................................................................... 239
Parent ...................................................................................................................................................................................... 239
Stories methods................................................................................................................................................................... 239
Index ........................................................................................................................................................................................ 239
Item .......................................................................................................................................................................................... 239
Swatch ........................................................................................................................................................................................... 240
Swatch properties............................................................................................................................................................... 240
Application ............................................................................................................................................................................ 240
Color......................................................................................................................................................................................... 240
Name ....................................................................................................................................................................................... 240
Parent ...................................................................................................................................................................................... 240
Swatch methods.................................................................................................................................................................. 240
Delete ...................................................................................................................................................................................... 240
Swatches....................................................................................................................................................................................... 241
Swatches properties .......................................................................................................................................................... 241
Application ............................................................................................................................................................................ 241
Count....................................................................................................................................................................................... 241
Parent ...................................................................................................................................................................................... 241
Swatches methods ............................................................................................................................................................. 241
Add ........................................................................................................................................................................................... 241
Index ........................................................................................................................................................................................ 241
Item .......................................................................................................................................................................................... 241
RemoveAll.............................................................................................................................................................................. 241
Symbol .......................................................................................................................................................................................... 242
Symbol properties .............................................................................................................................................................. 242
Application ............................................................................................................................................................................ 242
Name ....................................................................................................................................................................................... 242
Parent ...................................................................................................................................................................................... 242
Symbol methods ................................................................................................................................................................. 242
Delete ...................................................................................................................................................................................... 242
Duplicate................................................................................................................................................................................ 242
Symbols......................................................................................................................................................................................... 243
Symbols properties ............................................................................................................................................................ 243
Application ............................................................................................................................................................................ 243
Count....................................................................................................................................................................................... 243
Parent ...................................................................................................................................................................................... 243
Symbols methods ............................................................................................................................................................... 243
Add ........................................................................................................................................................................................... 243
Index ........................................................................................................................................................................................ 243
Item .......................................................................................................................................................................................... 243
RemoveAll.............................................................................................................................................................................. 243
SymbolItem ................................................................................................................................................................................. 245
SymbolItem properties ..................................................................................................................................................... 245
Application ............................................................................................................................................................................ 245
ArtworkKnockout................................................................................................................................................................ 245
BlendingMode...................................................................................................................................................................... 245
ControlBounds..................................................................................................................................................................... 245
Editable................................................................................................................................................................................... 245
GeometricBounds............................................................................................................................................................... 245
Height...................................................................................................................................................................................... 245
Adobe Illustrator CS2
Visual Basic Scripting Reference
35
Hidden..................................................................................................................................................................................... 245
IsIsolated ................................................................................................................................................................................ 245
Layer ........................................................................................................................................................................................ 245
Left............................................................................................................................................................................................ 245
Locked..................................................................................................................................................................................... 245
Name ....................................................................................................................................................................................... 245
Opacity.................................................................................................................................................................................... 245
Parent ...................................................................................................................................................................................... 245
Position ................................................................................................................................................................................... 245
Selected .................................................................................................................................................................................. 245
Sliced ....................................................................................................................................................................................... 245
Symbol .................................................................................................................................................................................... 245
Tags.......................................................................................................................................................................................... 245
Top............................................................................................................................................................................................ 245
URL ........................................................................................................................................................................................... 245
VisibilityVariable .................................................................................................................................................................. 245
VisibleBounds....................................................................................................................................................................... 246
Width ....................................................................................................................................................................................... 246
WrapInside............................................................................................................................................................................. 246
WrapOffset............................................................................................................................................................................. 246
Wrapped................................................................................................................................................................................. 246
ZOrderPosition..................................................................................................................................................................... 246
SymbolItem methods........................................................................................................................................................ 246
Copy......................................................................................................................................................................................... 246
Cut ............................................................................................................................................................................................ 246
Delete ...................................................................................................................................................................................... 246
Duplicate................................................................................................................................................................................ 246
Move ........................................................................................................................................................................................ 246
Resize....................................................................................................................................................................................... 246
Rotate ...................................................................................................................................................................................... 247
Transform............................................................................................................................................................................... 247
Translate ................................................................................................................................................................................. 247
ZOrder ..................................................................................................................................................................................... 247
SymbolItems ............................................................................................................................................................................... 249
SymbolItems properties ................................................................................................................................................... 249
Application ............................................................................................................................................................................ 249
Count....................................................................................................................................................................................... 249
Parent ...................................................................................................................................................................................... 249
SymbolItems methods...................................................................................................................................................... 249
Add ........................................................................................................................................................................................... 249
Index ........................................................................................................................................................................................ 249
Item .......................................................................................................................................................................................... 249
RemoveAll.............................................................................................................................................................................. 249
TabStopInfo................................................................................................................................................................................. 250
TabStopInfo properties..................................................................................................................................................... 250
Alignment .............................................................................................................................................................................. 250
Application ............................................................................................................................................................................ 250
DecimalCharacter ............................................................................................................................................................... 250
Leader...................................................................................................................................................................................... 250
Position ................................................................................................................................................................................... 250
Tag .................................................................................................................................................................................................. 251
Adobe Illustrator CS2
Visual Basic Scripting Reference
36
Tag properties ...................................................................................................................................................................... 251
Application ............................................................................................................................................................................ 251
Name ....................................................................................................................................................................................... 251
Parent ...................................................................................................................................................................................... 251
Value ........................................................................................................................................................................................ 251
Tag methods......................................................................................................................................................................... 251
Delete ...................................................................................................................................................................................... 251
Tags ................................................................................................................................................................................................ 253
Tags properties .................................................................................................................................................................... 253
Application ............................................................................................................................................................................ 253
Count....................................................................................................................................................................................... 253
Parent ...................................................................................................................................................................................... 253
Tags methods....................................................................................................................................................................... 253
Add ........................................................................................................................................................................................... 253
Index ........................................................................................................................................................................................ 253
Item .......................................................................................................................................................................................... 253
RemoveAll.............................................................................................................................................................................. 253
TextFont........................................................................................................................................................................................ 254
TextFont properties............................................................................................................................................................ 254
Application ............................................................................................................................................................................ 254
Family ...................................................................................................................................................................................... 254
Name ....................................................................................................................................................................................... 254
Parent ...................................................................................................................................................................................... 254
Style.......................................................................................................................................................................................... 254
TextFonts...................................................................................................................................................................................... 255
TextFonts properties.......................................................................................................................................................... 255
Application ............................................................................................................................................................................ 255
Count....................................................................................................................................................................................... 255
Parent ...................................................................................................................................................................................... 255
TextFonts methods ............................................................................................................................................................ 255
Index ........................................................................................................................................................................................ 255
Item .......................................................................................................................................................................................... 255
TextFrame .................................................................................................................................................................................... 256
TextFrame properties ........................................................................................................................................................ 256
Anchor..................................................................................................................................................................................... 256
Application ............................................................................................................................................................................ 256
ArtworkKnockout................................................................................................................................................................ 256
BlendingMode...................................................................................................................................................................... 256
Characters.............................................................................................................................................................................. 256
ColumnCount ....................................................................................................................................................................... 256
ColumnGutter ...................................................................................................................................................................... 256
Contents ................................................................................................................................................................................. 256
ContentVariable................................................................................................................................................................... 256
ControlBounds..................................................................................................................................................................... 256
Editable................................................................................................................................................................................... 256
EndTValue.............................................................................................................................................................................. 256
FlowsLinkHorizontally ....................................................................................................................................................... 256
GeometricBounds............................................................................................................................................................... 256
Height...................................................................................................................................................................................... 256
Hidden..................................................................................................................................................................................... 256
InsertionPoints..................................................................................................................................................................... 256
Adobe Illustrator CS2
Visual Basic Scripting Reference
37
IsIsolated ................................................................................................................................................................................ 256
Kind .......................................................................................................................................................................................... 256
Layer ........................................................................................................................................................................................ 256
Left............................................................................................................................................................................................ 256
Lines......................................................................................................................................................................................... 256
Locked..................................................................................................................................................................................... 257
Matrix....................................................................................................................................................................................... 257
Name ....................................................................................................................................................................................... 257
NextFrame ............................................................................................................................................................................. 257
Opacity.................................................................................................................................................................................... 257
OpticalAlignment................................................................................................................................................................ 257
Orientation ............................................................................................................................................................................ 257
Paragraphs............................................................................................................................................................................. 257
Parent ...................................................................................................................................................................................... 257
Position ................................................................................................................................................................................... 257
PreviousFrame ..................................................................................................................................................................... 257
RowCount .............................................................................................................................................................................. 257
RowGutter.............................................................................................................................................................................. 257
Selected .................................................................................................................................................................................. 257
Sliced ....................................................................................................................................................................................... 257
Spacing ................................................................................................................................................................................... 257
StartTValue ............................................................................................................................................................................ 257
Story......................................................................................................................................................................................... 257
Tags.......................................................................................................................................................................................... 257
TextPath.................................................................................................................................................................................. 257
TextRange .............................................................................................................................................................................. 257
TextRanges ............................................................................................................................................................................ 257
TextSelection ........................................................................................................................................................................ 257
Top............................................................................................................................................................................................ 257
URL ........................................................................................................................................................................................... 257
VisibilityVariable .................................................................................................................................................................. 257
VisibleBounds....................................................................................................................................................................... 257
Width ....................................................................................................................................................................................... 258
Words ...................................................................................................................................................................................... 258
WrapInside............................................................................................................................................................................. 258
WrapOffset............................................................................................................................................................................. 258
Wrapped................................................................................................................................................................................. 258
ZOrderPosition..................................................................................................................................................................... 258
TextFrame methods........................................................................................................................................................... 258
CreateOutline ....................................................................................................................................................................... 258
Duplicate................................................................................................................................................................................ 258
Move ........................................................................................................................................................................................ 258
Remove................................................................................................................................................................................... 258
Resize....................................................................................................................................................................................... 258
Rotate ...................................................................................................................................................................................... 258
Transform............................................................................................................................................................................... 259
Translate ................................................................................................................................................................................. 259
ZOrder ..................................................................................................................................................................................... 259
TextFrames .................................................................................................................................................................................. 260
TextFrames properties ...................................................................................................................................................... 260
Application ............................................................................................................................................................................ 260
Adobe Illustrator CS2
Visual Basic Scripting Reference
38
Count....................................................................................................................................................................................... 260
Parent ...................................................................................................................................................................................... 260
TextFrames methods ......................................................................................................................................................... 260
Add ........................................................................................................................................................................................... 260
AreaText ................................................................................................................................................................................. 260
Index ........................................................................................................................................................................................ 260
Item .......................................................................................................................................................................................... 260
PathText.................................................................................................................................................................................. 260
PointText ................................................................................................................................................................................ 260
RemoveAll.............................................................................................................................................................................. 260
TextPath........................................................................................................................................................................................ 262
TextPath properties............................................................................................................................................................ 262
Application ............................................................................................................................................................................ 262
Area .......................................................................................................................................................................................... 262
BlendingMode...................................................................................................................................................................... 262
Clipping .................................................................................................................................................................................. 262
Editable................................................................................................................................................................................... 262
Evenodd ................................................................................................................................................................................. 262
FillColor................................................................................................................................................................................... 262
Filled ........................................................................................................................................................................................ 262
FillOverprint .......................................................................................................................................................................... 262
Guides ..................................................................................................................................................................................... 262
Height...................................................................................................................................................................................... 262
Left............................................................................................................................................................................................ 262
Note ......................................................................................................................................................................................... 262
Opacity.................................................................................................................................................................................... 262
Parent ...................................................................................................................................................................................... 262
PathPoints.............................................................................................................................................................................. 262
Polarity .................................................................................................................................................................................... 262
Position ................................................................................................................................................................................... 262
Resolution.............................................................................................................................................................................. 262
SelectedPathPoints ............................................................................................................................................................ 262
StrokeCap............................................................................................................................................................................... 262
StrokeColor............................................................................................................................................................................ 262
Stroked.................................................................................................................................................................................... 262
StrokeDashes ........................................................................................................................................................................ 263
StrokeDashOffset ................................................................................................................................................................ 263
StrokeJoin .............................................................................................................................................................................. 263
StrokeMiterLimit.................................................................................................................................................................. 263
StrokeOverprint ................................................................................................................................................................... 263
StrokeWidth .......................................................................................................................................................................... 263
Top............................................................................................................................................................................................ 263
Width ....................................................................................................................................................................................... 263
TextPath methods .............................................................................................................................................................. 263
SetEntirePath ........................................................................................................................................................................ 263
TextRange .................................................................................................................................................................................... 264
TextRange properties ........................................................................................................................................................ 264
Application ............................................................................................................................................................................ 264
CharacterAttributes............................................................................................................................................................ 264
CharacterOffset.................................................................................................................................................................... 264
Characters.............................................................................................................................................................................. 264
Adobe Illustrator CS2
Visual Basic Scripting Reference
39
CharacterStyles .................................................................................................................................................................... 264
Contents ................................................................................................................................................................................. 264
InsertionPoints..................................................................................................................................................................... 264
Kerning.................................................................................................................................................................................... 264
Length ..................................................................................................................................................................................... 264
Lines......................................................................................................................................................................................... 264
ParagraphAttributes .......................................................................................................................................................... 264
Paragraphs............................................................................................................................................................................. 264
ParagraphStyles................................................................................................................................................................... 264
Parent ...................................................................................................................................................................................... 264
Story......................................................................................................................................................................................... 264
TextRanges ............................................................................................................................................................................ 264
TextSelection ........................................................................................................................................................................ 264
Words ...................................................................................................................................................................................... 264
TextRange methods........................................................................................................................................................... 265
ChangeCaseTo ..................................................................................................................................................................... 265
Delete ...................................................................................................................................................................................... 265
DeSelect.................................................................................................................................................................................. 265
Duplicate................................................................................................................................................................................ 265
Move ........................................................................................................................................................................................ 265
Select ....................................................................................................................................................................................... 265
TextRanges .................................................................................................................................................................................. 267
TextRanges properties ...................................................................................................................................................... 267
Application ............................................................................................................................................................................ 267
Count....................................................................................................................................................................................... 267
Parent ...................................................................................................................................................................................... 267
TextRanges methods ......................................................................................................................................................... 267
Index ........................................................................................................................................................................................ 267
Item .......................................................................................................................................................................................... 267
RemoveAll.............................................................................................................................................................................. 267
TracingObject ............................................................................................................................................................................. 268
TracingObject properties ................................................................................................................................................. 268
AnchorCount ........................................................................................................................................................................ 268
Application ............................................................................................................................................................................ 268
AreaCount.............................................................................................................................................................................. 268
ImageResolution ................................................................................................................................................................. 268
Parent ...................................................................................................................................................................................... 268
PathCount.............................................................................................................................................................................. 268
SourceArt ............................................................................................................................................................................... 268
TracingOptions .................................................................................................................................................................... 268
UsedColorCount.................................................................................................................................................................. 268
TracingObject methods.................................................................................................................................................... 269
ExpandTracing ..................................................................................................................................................................... 269
ReleaseTracing ..................................................................................................................................................................... 269
TracingOptions........................................................................................................................................................................... 270
TracingOptions properties .............................................................................................................................................. 270
Application ............................................................................................................................................................................ 270
CornerAngle.......................................................................................................................................................................... 270
Fills............................................................................................................................................................................................ 270
LivePaintOutput .................................................................................................................................................................. 270
MaxColors .............................................................................................................................................................................. 270
Adobe Illustrator CS2
Visual Basic Scripting Reference
40
MaxStrokeWeight ............................................................................................................................................................... 270
MinArea .................................................................................................................................................................................. 270
MinStrokeLength ................................................................................................................................................................ 270
OutputToSwatches............................................................................................................................................................. 270
Palette ..................................................................................................................................................................................... 270
Parent ...................................................................................................................................................................................... 270
PathFitting ............................................................................................................................................................................. 270
PreprocessBlur ..................................................................................................................................................................... 271
Preset....................................................................................................................................................................................... 271
Resample................................................................................................................................................................................ 271
ResampleResolution .......................................................................................................................................................... 271
Strokes..................................................................................................................................................................................... 271
Threshold ............................................................................................................................................................................... 271
TracingMode......................................................................................................................................................................... 271
ViewRaster ............................................................................................................................................................................. 271
ViewVector ............................................................................................................................................................................ 271
TracingOptions methods ................................................................................................................................................. 271
LoadFromPreset .................................................................................................................................................................. 271
StoreToPreset ....................................................................................................................................................................... 271
Variable ......................................................................................................................................................................................... 272
Variable properties ............................................................................................................................................................. 272
Application ............................................................................................................................................................................ 272
Kind .......................................................................................................................................................................................... 272
Name ....................................................................................................................................................................................... 272
PageItems .............................................................................................................................................................................. 272
Parent ...................................................................................................................................................................................... 272
Variable methods................................................................................................................................................................ 272
Delete ...................................................................................................................................................................................... 272
Variables ....................................................................................................................................................................................... 273
Variables properties ........................................................................................................................................................... 273
Application ............................................................................................................................................................................ 273
Count....................................................................................................................................................................................... 273
Parent ...................................................................................................................................................................................... 273
Variables methods .............................................................................................................................................................. 273
Add ........................................................................................................................................................................................... 273
Index ........................................................................................................................................................................................ 273
Item .......................................................................................................................................................................................... 273
RemoveAll.............................................................................................................................................................................. 273
View................................................................................................................................................................................................ 274
View properties.................................................................................................................................................................... 274
Application ............................................................................................................................................................................ 274
Bounds .................................................................................................................................................................................... 274
CenterPoint ........................................................................................................................................................................... 274
Parent ...................................................................................................................................................................................... 274
ScreenMode .......................................................................................................................................................................... 274
Zoom ....................................................................................................................................................................................... 274
Views.............................................................................................................................................................................................. 275
Views properties.................................................................................................................................................................. 275
Application ............................................................................................................................................................................ 275
Count....................................................................................................................................................................................... 275
Parent ...................................................................................................................................................................................... 275
Adobe Illustrator CS2
Visual Basic Scripting Reference
41
Views methods..................................................................................................................................................................... 275
Index ........................................................................................................................................................................................ 275
Item .......................................................................................................................................................................................... 275
Words............................................................................................................................................................................................. 276
Words properties................................................................................................................................................................. 276
Application ............................................................................................................................................................................ 276
Count....................................................................................................................................................................................... 276
Parent ...................................................................................................................................................................................... 276
Words methods ................................................................................................................................................................... 276
Add ........................................................................................................................................................................................... 276
AddBefore.............................................................................................................................................................................. 276
Index ........................................................................................................................................................................................ 276
Item .......................................................................................................................................................................................... 276
RemoveAll.............................................................................................................................................................................. 276
Enumerations reference.......................................................................................................................................................... 277
AiAlternateGlyphsForm .................................................................................................................................................... 277
AiAutoKernType .................................................................................................................................................................. 277
AiAutoLeadingType ........................................................................................................................................................... 277
AiBaselineDirectionType .................................................................................................................................................. 277
AiBlendAnimationType..................................................................................................................................................... 277
AiBlendModes ...................................................................................................................................................................... 277
AiBurasagariTypeEnum .................................................................................................................................................... 277
AiCaseChangeType ............................................................................................................................................................ 277
AiColor .................................................................................................................................................................................... 277
AiColorConversion.............................................................................................................................................................. 278
AiColorDestination ............................................................................................................................................................. 278
AiColorDitherMethod........................................................................................................................................................ 278
AiColorModel........................................................................................................................................................................ 278
AiColorProfile........................................................................................................................................................................ 278
AiColorReductionMethod................................................................................................................................................ 278
AiCompatibility.................................................................................................................................................................... 278
AiCompressionQuality ...................................................................................................................................................... 279
AiCropOptions ..................................................................................................................................................................... 279
AiDocumentColorSpace ................................................................................................................................................... 279
AiDocumentType ................................................................................................................................................................ 279
AiDownsampleMethod..................................................................................................................................................... 279
AiElementPlacement ......................................................................................................................................................... 279
AiEPSPostScriptLevelEnum ............................................................................................................................................. 279
AiEPSPreview........................................................................................................................................................................ 279
AiExportType ........................................................................................................................................................................ 280
AiFigureStyleType............................................................................................................................................................... 280
AiFlashExportStyle.............................................................................................................................................................. 280
AiFlashImageFormat.......................................................................................................................................................... 280
AiFlashJPEGMethod ........................................................................................................................................................... 280
AiFontBaselineOption ....................................................................................................................................................... 280
AiFontCapsOption .............................................................................................................................................................. 280
AiFontOpenTypePositionOption .................................................................................................................................. 280
AiFontSubstitutionPolicy ................................................................................................................................................. 280
AiGradientType.................................................................................................................................................................... 280
AiImageColorSpace............................................................................................................................................................ 280
AiInkPrintStatus ................................................................................................................................................................... 280
Adobe Illustrator CS2
Visual Basic Scripting Reference
42
AiInkType ............................................................................................................................................................................... 280
AiJavaScriptExecutionMode ........................................................................................................................................... 280
AiJustification ....................................................................................................................................................................... 281
AiKinsokuOrderEnum ........................................................................................................................................................ 281
AiKnockoutState.................................................................................................................................................................. 281
AiLanguageType ................................................................................................................................................................. 281
AILayerOrderType............................................................................................................................................................... 281
AiMonochromeCompression ......................................................................................................................................... 281
AiOutputFlattening ............................................................................................................................................................ 282
AiPageItemType .................................................................................................................................................................. 282
AiPageMarksStyle ............................................................................................................................................................... 282
AiPathPointSelection......................................................................................................................................................... 282
AiPDFBoxType...................................................................................................................................................................... 282
AiPDFChangesAllowedEnum ......................................................................................................................................... 282
AiPDFCompatibility............................................................................................................................................................ 282
AiPDFOverprint.................................................................................................................................................................... 282
AiPDFPrintAllowedEnum ................................................................................................................................................. 282
AiPDFTrimMarkWeight ..................................................................................................................................................... 283
AiPDFXStandard .................................................................................................................................................................. 283
AiPhotoshopCompatibility.............................................................................................................................................. 283
AiPointType........................................................................................................................................................................... 283
AiPolarityValues................................................................................................................................................................... 283
AiPostScriptImageCompressionType.......................................................................................................................... 283
AiPrintArtworkDesignation ............................................................................................................................................. 283
AiPrintColorIntent............................................................................................................................................................... 283
AiPrintColorProfile .............................................................................................................................................................. 283
AiPrintColorSeparationMode ......................................................................................................................................... 283
AiPrinterColorMode ........................................................................................................................................................... 283
AiPrinterPostScriptLevelEnum ....................................................................................................................................... 283
AiPrinterTypeEnum ............................................................................................................................................................ 283
AiPrintFontDownloadMode............................................................................................................................................ 283
AiPrintingBounds................................................................................................................................................................ 283
AiPrintOrientation............................................................................................................................................................... 284
AiPrintPosition ..................................................................................................................................................................... 284
AiPrintTiling........................................................................................................................................................................... 284
AiRasterLinkState ................................................................................................................................................................ 284
AiRulerUnits .......................................................................................................................................................................... 284
AiSaveOptions...................................................................................................................................................................... 284
AiScreenMode ...................................................................................................................................................................... 284
AiStrokeCap .......................................................................................................................................................................... 284
AiStrokeJoin .......................................................................................................................................................................... 284
AiStyleRunAlignmentType .............................................................................................................................................. 284
AiSVGCSSPropertyLocation............................................................................................................................................. 284
AiSVGDocumentEncoding............................................................................................................................................... 284
AiSVGDTDVersion ............................................................................................................................................................... 285
AiSVGFontSubsetting ........................................................................................................................................................ 285
AiSVGFontType.................................................................................................................................................................... 285
AiTabStopAlignment ......................................................................................................................................................... 285
AiTextOrientation ............................................................................................................................................................... 285
AiTextType............................................................................................................................................................................. 285
AiTracingModeType........................................................................................................................................................... 285
Adobe Illustrator CS2
Visual Basic Scripting Reference
43
AiTransformation ................................................................................................................................................................ 285
AiTrappingType ................................................................................................................................................................... 285
AiUserInteractionLevel...................................................................................................................................................... 285
AiVariableKind...................................................................................................................................................................... 285
AiViewRasterType ............................................................................................................................................................... 286
AiViewVectorType .............................................................................................................................................................. 286
AiWariChuJustificationType............................................................................................................................................ 286
AiZOrderMethod ................................................................................................................................................................. 286
1
Introduction
About this Manual
This manual provides an introduction to scripting Adobe® Illustrator® CS2 on Windows® with Visual Basic
or VBScript. This document contains the following chapters:
●
Introduction —An introduction to scripting.
●
Scripting Basics — The basics of scripting with Visual Basic in Windows. If you are new to scripting, be
sure to read this chapter.
●
Scripting Illustrator — A brief introduction to the specifics of scripting Illustrator. Concepts and
approaches specific to the application are covered here, such as measurement units, matrices, and
color models.
●
Visual Basic Object Reference — Details and examples are provided for every class in Illustrator’s Visual
Basic type library.
For further information and developments on this and other Adobe products, see the Adobe Solutions
Network website:
http://partners.adobe.com/asn
What is Scripting?
A script is a series of commands that tells Illustrator to perform a series of actions. These actions can be
simple, and affect only a single, selected object in the current document; or complex, and affect all of the
objects in all of your Illustrator documents. The actions might involve only Illustrator, or they might
involve other applications, such as word processors, spreadsheets, and database management programs.
Many of the tasks you can perform with Illustrator’s tools, menus, palettes, and dialog boxes can be
performed by a script (a notable exception is third-party plug-ins, which cannot be scripted at this time).
We naturally think of scripting as a way to automate repetitive tasks, but it can also be a creative tool. You
can use scripts for creative tasks that would be too difficult or time consuming to do manually. For
example, you could write a script to systematically create a series of objects, modifying the new objects’
position, stroke, and fill properties along the way. You could also write a script that accessed Illustrator’s
built-in transformation matrix functions to stretch, scale and distort a series of objects. Without scripting,
you’ll likely miss out on the creative potential of such labor-intensive techniques.
Scripting isn’t just for computer programmers—it’s for everybody. You don’t need a degree in computer
science or mathematics to write scripts that can automate a wide variety of common tasks. If you can read
this text, you can write scripts.
The language you use to write scripts depends on the operating system of the platform you’re using:
AppleScript for Mac OS®; Visual Basic for Windows; JavaScript for either platform. Each of these languages
is described in a separate manual.
Why use scripting?
Graphic design is a field characterized by creativity, but aspects of the actual work of illustration and page
layout are anything but creative. When you think about the work that you do, chances are good you’ll find
44
Adobe Illustrator CS2
Visual Basic Scripting Reference
Introduction
45
that you spend most of your time doing the same or similar production tasks, over and over again. In fact,
you’ll probably notice that the time you spend placing and replacing images, correcting errors in text, and
preparing files for printing at an imagesetting service provider often reduce the time you have available
for doing creative work.
Wouldn’t it be great if you had an assistant—one that wouldn’t mind doing some or all of the boring,
repetitive tasks for you? With that kind of help, you’d have more time to concentrate on the creative
aspects of your work.
With a small investment of time, Illustrator scripting can be the assistant you need. You can start with
short, simple scripts that save you a few seconds every day, and move on to scripts that work all night
while you’re sleeping.
Think about your work—is there a repetitive task that’s driving you crazy? If so, you’ve identified a
candidate for a script. What are the steps involved in performing the task? What are the conditions in
which you need to do the task? Once you understand the process you go through to perform the task,
you’ll be ready to turn it into a script.
What about actions?
Illustrator actions are different from scripts. An Illustrator action is a series of tasks you have recorded while
using the application—menu choices, tool choices, object selection, and other commands. When you
“play” an action, Illustrator performs all of the recorded commands.
You record, play, edit, and delete actions using Illustrator’s built-in Actions palette. The “Automating
Tasks” chapter in the Adobe Illustrator User Guide covers actions in detail.
With the introduction of scripting for Illustrator, it is important to avoid any confusion about the difference
between actions and scripting. Actions and scripts are both ways of automating repetitive tasks, but they
work very differently. The following points summarize the key differences.
●
Actions use a program’s user interface to do their work. As an action runs, menu choices are executed,
objects are selected, and recorded paths are created. Scripts do not use a program’s user interface to
perform tasks, and can execute faster than actions.
●
Actions have very limited facilities for getting and responding to information. You cannot add
conditional logic to an action. Therefore, actions cannot make decisions based on the current situation.
Scripts are capable of getting information and making decisions and calculations based on the
information they receive from Illustrator.
●
A script can execute an action, but actions cannot execute scripts.
Script Support in Adobe Illustrator CS2
The Scripts menu supports AppleScript and JavaScript scripts for Mac OS, and VBScript, JavaScript, and
Visual Basic scripts for Windows.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Introduction
46
For a file to be recognized by Adobe Illustrator CS2 as a valid script file it must have the correct file name
extension:
Script Type
File Type
Extension
Platform
AppleScript
compiled script
OSAS file
.scpt
JavaScript
ExendScript
text
.js
.jsx
VBScript
text
.vbs
Windows
Visual Basic
executable
.exe
Windows
Mac OS
(none)
Mac OS & Windows
Executing scripts
The Adobe Illustrator CS2 interface includes a Scripts menu (File > Scripts) which provides quick and easy
access to your scripts. Scripts can be listed directly as menu items, that run when you select them, or you
can navigate to and run any script in your file system.
If Illustrator CS2 encounters an error during script execution, it displays the error message returned by the
script in an error dialog.
Note: It is not possible to execute scripts that contain the do script command from the Scripts menu.
Attempting to do so causes an error.
Installing scripts
To install a script in the Scripts menu, place it in the Scripts folder (Illustrator CS2 > Presets > Scripts).
The names of the scripts in the Scripts folder, less any file name extension, will be displayed in the Scripts
menu. Any number of scripts may be installed in the Scripts menu.
Scripts added to the Scripts folder while Illustrator is running will not appear in the Scripts menu until the
next time you launch Illustrator.
If you have a large collection of scripts you wish to use, you may use sub-folders in the Scripts folder to
help organize the scripts in the Scripts menu. Each subfolder will be displayed as a separate submenu
containing the scripts in that subfolder.
Executing other scripts
The Other Scripts item at the end of the Scripts menu (File > Scripts > Other Scripts) allows you to
execute scripts which are not installed in the Scripts folder. Selecting Other Scripts displays a file browser
dialog which allows you to select a script file for execution. Only files which are of one of the supported file
types are displayed in the browse dialog. When you select a script file, it is executed the same way as an
installed script.
System requirements for Windows and Visual Basic
Make sure the scripting plug-in is installed on your system before attempting to script Illustrator.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Introduction
47
To use Illustrator scripting in Windows, you must have Windows 98®, Windows NT 4.0, Windows 2000, or
Windows XP.® You will also need the Microsoft® Visual Basic development environment or one of the
applications that contain a Visual Basic editor. Many applications that support the Visual Basic for
Applications (VBA) language contain a built-in editor. Applications that contain a built-in editor include:
Microsoft Word, Microsoft Excel, and Visio. You can use any Visual Basic editor to create your scripts.
As your scripts become more complex or require a user interface, you will find the need for a complete
development environment than one of the built-in editors. The Microsoft Visual Basic development
environment comes in a variety of package, all of which provide everything you need to script Illustrator.
In this manual, we use the Microsoft Visual Basic development environment’s editor.
Changes to Visual Basic and VBA support in Adobe Illustrator CS2
The following changes have been made to the Visual Basic and VBA object model in this release:
●
Updates to PDFSaveOptions, ExportOptionsSVG, and FlashExportOptions to reflect new
capabilities in the corresponding dialogs.
●
In earlier version, a script used RasterItems.Add() to place a raster file format into a document. In
this version, use PlacedItems.Add() instead. To embed the art in the document, use the
PlacedItem.Embed function, which converts it to an embedded RasterItem or other art items.
●
New scripting support for underline and strikethrough font styles.
●
New scripting capability for converting raster art into vector art, called tracing. The tracing operation
reorders the raster art into the source art of a plugin group, and converts it into a group of filled and/or
stroked paths that resemble the original image.
●
New methods PlacedItems.Trace and RasterItems.Trace initiate tracing, creating a new
PluginItem for the new vector art.
●
PluginItem.IsTracing is true for the new item, and PluginItem.Tracing contains a
reference to a new TracingObject object.
●
The TracingObject.TracingOption property references a TracingOptions object that
collects the parameters used for the tracing operation. You can save tracing options to a preset file,
and load previously saved tracing presets, using the TracingOptions.LoadFromPreset and
TracingOptions.StoreToPreset methods.
2
Scripting Basics
When you use Illustrator, you work with documents and their contents. You create documents, layers,
colors, and design elements. You probably think of these things as objects, that you can look at and move
around, and they are in fact represented by objects in the Illustrator object model. The Illustrator object
model contains documents, layers, colors, and page items—objects that can appear in an Illustrator
document.
Automating Illustrator with scripting uses the same object-oriented way of thinking. Each type of object
has its own special properties, and the scripting language has ways to look at and change these
properties.
This chapter provides a brief introduction to the basic concepts and syntax of Visual Basic and VBA on
Windows. A bibliography at the end contains references to more complete language guides.
●
For more information on Illustrator’s object model and specific Illustrator concepts, see Scripting
Illustrator.
●
For detailed information on the Visual Basic Illustrator objects and methods, see Visual Basic Object
Reference.
Object Model Concepts
In object-oriented programming, objects belong to classes and have properties that describe them. You
manipulate the objects and their properties using methods in Visual Basic. (In other languages, these can
be called commands or functions.) What do these terms mean in this context?
Here’s a way to think about objects and their properties. Imagine that you live in a house that responds to
your commands (you can think of this house as technologically advanced, or magical, or both). The house
is an object, and its properties might include the number of rooms, the color of the exterior paint, or the
date of its construction.
Your house can also contain other objects. Similarly, the objects within the house can also contain smaller
objects. Each room, for example, is an object in the house, while each window, door, or appliance is an
object inside a room.
Each object can respond to various commands according to its capabilities. Windows and doors, for
example, can open or close—but the floor and ceiling cannot. Using scripting, you can talk to each object
directly, or you can talk to them as part of the container. You have to be very specific, though—you can’t
tell your house to open a window without telling it which window you want to open. So windows, like all
other objects, need names or at least a numbering system so you can refer to them specifically. For
example, you might say “Tell the house to open the north window of the living room.”
Objects also have properties that describe specific details about them, like color and size. Imagine that the
properties of objects in your house can be changed. You might say, “Door, paint yourself blue.” Because
your door can respond to the command “paint,” you’ll soon have a door of a different color.
Now let’s apply this object model idea to Illustrator. The Illustrator application is the house, its documents
are the rooms, and the objects in your documents are the windows and doors. You can tell Illustrator
documents to add and remove objects. You can ask objects to get or change their properties.
48
Adobe Illustrator CS2
Visual Basic Scripting Reference
Scripting Basics
49
Object classes
Objects with the same properties and behaviors are grouped into “classes.” In the house example,
windows and doors belong to their own classes, since they have unique properties, like number of panes
for windows or the door style for doors. In Illustrator, every type of graphic object—paths, text, meshes,
etc.—belongs to its own class, each with its own set of properties and behaviors. Properties such as
VisibleBounds, Width, and Height, for example, are common to all PageItems.
Object inheritance
Since each container can contain smaller objects, there can be hierarchy of classes: the house contains a
room, which contains a door. Each bigger class is called a superclass, and each smaller one a subclass.
House and room are both superclasses of door. Superclasses and subclasses are also called parent classes
and child classes.
Object classes may inherit, or share, the properties of a parent, or superclass. So in our house example,
windows and doors are both openings in a house, so they can be subclasses of an openings class, which
contains properties that are common to all types of openings, such as open-state. In Illustrator,
PathItems, for example, inherit geometric properties like Width and Height from the PageItem class.
Classes often have additional properties that are not shared with their superclass. In our house, both a
window and door inherit an open-state property from the opening class, but a window has
number-of-panes property which the opening class does not. In Illustrator, PathItems, for example, have
the property StrokeColor which is not inherited from the PageItem class.
Object elements or collections
Object collections, in Visual Basic, are objects contained within other objects. For example, rooms are
elements (or collections) of our house, contained within the house object. In Illustrator, documents are
elements of the application object, and page items are elements of a document object.
Object references
The objects in your documents are arranged in a hierarchy like the house object—page items are in layers,
which are inside a document, which is inside Illustrator. When you send a message to an Illustrator object,
you need to make sure you send it to the right object. To do this, you identify objects by their position in
the hierarchy. You might, for example, write the following statement.
Documents(1).Layers(1).PageItems(1)
When you identify an object in this fashion, you’re creating an object reference, to give the script a way of
finding the object you want to work with.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Scripting Basics
50
Scripting Concepts
This section discusses various basic programming and scripting features and how they are used in the
Visual Basic language.
Comments
Comments are a way to add descriptive text to a script. Comments come in handy when you want to
document the operation of a script (for yourself or for someone else). The use of comments is the most
important technique for good scripting. Comments are where you should leave important notes about the
specific operation of a script that might provide valuable help when the script is modified at a later date.
The time you save later trying to figure out what the script does may be your own. Comments are ignored
by the scripting system as the script executes and cause no run-time speed penalty.
In Visual Basic, enter ' (a single straight quote) to the left of the comment.
' This is a comment
Long script lines
In some cases, individual script lines are too long to print on a single line in this guide.
Visual Basic uses the underscore character ( _ ) to show that the line continues to the next line. This
continuation character denotes a “soft return” in the script. You can enter this character in the editor by
pressing Shift-dash at the end of the line you wish to continue.
Value types
Values are the data your scripts use to do their work. Most of the time, the values used in your scripts will
be numbers or text. The following table shows the Visual Basic value types:
Value type
What it is
Example:
Boolean
Logical true or false
true
Long
Whole numbers (no decimal points). Longs can be
positive or negative.
14
Double
A number which may contain a decimal point.
13.9972
String
A series of text characters. Strings appear inside
(straight) quotation marks.
“I am a string”
Array
A list of values. Arrays contain a single value type
unless the type is defined as Variant.
Array(10.0, 20.0, 30.0, 40.0)
Object
reference
A specific reference to an object.
Application.Documents(1)
User-defined
A collection of elements referenced by a key and
stored as a key-value pair.
Var.name = “you”
Var.index = 1
Adobe Illustrator CS2
Visual Basic Scripting Reference
Scripting Basics
51
Variables
Variables are containers for data. A variable might contain a number, a string, a list (or array), or an object
reference. Variables have names, and you refer to a variable by its name. To put data into a variable, we
assign the data to the variable. The file name of the current Illustrator document or the current date are
both examples of data that can be assigned to a variable.
Why not simply enter the value directly in the script rather than using a variable? When you use a value
directly the flexibility of script is reduced. By using variables the scripts you write will be reusable in a wider
variety of situations. As a script executes, it can assign data to the variables that reflect the state of the
current document and selection, for example, and then make decisions based on the content of the
variables.
Declaring variables
In Visual Basic, it is considered good form to declare all of your variables with the Dim statement before
using them. Using the Dim statement assigns a value type to the variable, which helps us keep our scripts
clear and readable. Memory is also used more efficiently if variables are declared before use. If you start
your scripts in Visual Basic with the line Option Explicit, you will be required to declare all variables
before assigning data to them.
Option Explicit
Dim thisNumber As Single
thisNumber = 10
Assigning variable values
To assign a value that is not an object reference to a variable in Visual Basic, use Visual Basic’s assignment
operator, the equal sign:
thisNumber = 10
thisString = "Hello, World!"
Variables can also be used to store references to objects. In Visual Basic, you must use the Set command
to assign an object reference to a variable. For example, use Set to assign a variable as you create a layer:
Set thisLayer = Illustrator.Documents(1).Layers.Add
This code uses Set with a reference to an existing layer:
Set thisLayer = Illustrator.Documents(1).Layers(1)
Variable naming
Try to use descriptive names for your variables—something like firstPage or corporateLogo, rather
than x or c. While it will take a little more time to type the longer names, using them will make your scripts
much easier to read. The length of a variable’s name has no effect on the execution speed of your script, so
use descriptive names.
You can also give your variable names a standard prefix so that they’ll stand out from the objects,
commands, and keywords of your scripting system.
Variable names must be a single word, but you can use internal capitalization (such as myFirstPage) or
underscore characters (my_first_page) to create more readable names. Variable names cannot begin
with a number, and they can’t contain punctuation or quotation marks.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Scripting Basics
52
Script properties
Visual Basic allows you to define properties for your scripts. Script properties are much like variables, but
with additional features and requirements specific to each language. The meaning and usage of script
properties differs greatly between languages; consult the bibliography for appropriate language
references.
Operators
Operators perform calculations (addition, subtraction, multiplication, and division) on variables or values
and return a result. For example:
docWidth/2
This returns a value equal to half of the content of the variable docWidth. So if docWidth contained the
number 20.5, the value returned would be 10.25.
You can also use operators to perform comparisons (equal to, not equal to, greater than, or less than). For
example:
docWidth > docHeight
This returns the value true if docWidth is greater than docHeight, or false, if it is not.
Some operators differ between languages For example, Visual Basic uses the greater and less than
symbols juxtaposed, <> as the non-equality symbol.
Use the ampersand (&) as the concatenation operator to join two strings.
"Pride " & "and Prejudice."
This returns the string “Pride and Prejudice.”
Methods
If objects are “nouns” and properties are “adjectives” in our scripting systems, then methods are the
“verbs”—they’re the parts of the script that make things happen. The type of the object you’re working
with determines which methods you can use to manipulate it.
In Visual Basic, use the Add method to create new objects, the Set statement to assign object references
to Visual Basic variables or properties, and the assignment operator ( = ) to retrieve and change object
properties.
Conditional statements
If you could speak to Illustrator in the course of a work session, you might say, “If the selected object is a
path, then set its stroke width to 12 points.” Conditional statements make decisions—they give your
scripts a way to evaluate something (the color of the selected object, or the number of color swatches in
the document, or the date) and then act according to the result. Conditional statements generally start
with the word if.
The following example checks the number of currently open documents. If no documents are open, the
script displays a messages in a dialog box.
Private Sub Command1_Click()
Dim documentCount as long
Adobe Illustrator CS2
Visual Basic Scripting Reference
Scripting Basics
53
Dim appRef As New Illustrator.Application
documentCount = appRef.Documents.Count
If documentCount = 0 then
MsgBox "No Illustrator documents are open!"
End If
End Sub
Control structures
If you could talk to Illustrator, you might say, “Repeat the following procedure twenty times.” In scripting
terms, this sort of direction is called a “control structure.” Control structures provide for repetitive
processes, or “loops.” The idea of a loop is to repeat some action over and over again, with or without
changes each time through the loop, until some condition is met.
Visual Basic has a variety of different control structures to choose from. The simplest form of a loop is one
that repeats some series of script operations a set number of times.
For counter = 1 to 20
MsgBox counter
Next
A more complicated type of control structure includes conditional logic, so that it loops while or until
some condition is true or false.
Do While flag = false
flag = (MsgBox ("Quit?", vbOKCancel)) = vbCancel
loop
Do Until flag = true
flag = (MsgBox ("Quit?", vbOKCancel)) = vbOK
loop
Subroutines
In Visual Basic, subroutines are scripting modules you can refer to from within your script. These are
sometimes called routines or handlers. Subroutines are ways to re-use parts of scripts. Typically, you send
one or more values to a subroutine, and it returns one or more values. A subroutine might, for example,
perform conversions from one measurement system to another, or calculate the geometric center point of
an object from its geometric bounds.
There’s nothing special about the code used in subroutines—they are simply conveniences that save you
from having to type the same lines of code over and over again in your script. If you find yourself typing or
pasting the same lines of code into several different places in a script, you’ve identified a good candidate
for a subroutine.
This example calculates the geometric center of a selected art item. It assumes you have a single art item
selected.
Private Sub Command1_Click()
Dim appRef As New Illustrator.Application
Dim selectedObjects As Variant
Dim objectBounds As Variant
Dim objectCenter As Variant
If appRef.Documents.Count > 0 Then
Adobe Illustrator CS2
Visual Basic Scripting Reference
Scripting Basics
54
selectedObjects = appRef.Documents(1).Selection
If TypeName(selectedObjects) = "Variant()" Then
objectBounds = selectedObjects(0).GeometricBounds
objectCenter = GetItemCenter(objectBounds)
MsgBox ("Center x:" & objectCenter(0) & ", y:" & objectCenter(1))
End If
End If
End Sub
The following lines define the function:
Function GetItemCenter(sourceBounds As Variant) As Variant
Dim left As Single
Dim top As Single
Dim right As Single
Dim bottom As Single
Dim xCenter As Single
Dim yCenter As Single
left = sourceBounds(0)
top = sourceBounds(1)
right = sourceBounds(2)
bottom = sourceBounds(3)
xCenter = (left + right) / 2
yCenter = (top + bottom) / 2
GetItemCenter = Array(xCenter, yCenter)
End Function
Testing and Troubleshooting
The scripting environment provides tools for monitoring the progress of your script while it is running—
which make it easier for you to track down any problems your script might be encountering or causing.
In Visual Basic, you can stop your script at any point, or step through your script one line at a time. To stop
your script at a particular line, select that line in your script and choose Debug > Toggle Breakpoint.
When you run the script, Visual Basic will stop at the breakpoint you have set. Choose Debug > Step Into
(or press F8) to execute the next line of your script, or choose Run > Start (or press F5) to continue normal
execution of the script. You can also observe the values of variables defined in your script using the Watch
window—a very valuable tool for debugging your scripts. To view a variable in the Watch window, select
the variable and choose Debug > Quick Watch. Visual Basic displays the Quick Watch dialog box. Click
Add. Visual Basic displays the Watch window.
If you have closed the Watch window, you can display it again by choosing View > Watch Window.
About error handling
Imagine that you’ve written a script that formats the current text selection. What should the script do if the
current selection turns out not to be text at all, but a path item? You can add error handling code to your
script to respond to conditions other than those you expect it to encounter.
If you have complete control over the situations in which your script will run, there’s no need for you to
worry about error handling. If not, however, you’ll have to add some error handling capabilities to your
script.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Scripting Basics
55
The following example shows how to how you can stop a script from executing when a specific file cannot
be found. This example stores a reference to the fifth path item of a document in a variable. If such an
object does not exist in the current document, it displays a message.
Private Sub Command1_Click()
Dim appRef As New Illustrator.Application
Dim docRef As Illustrator.Document
Dim aiObject As Illustrator.PathItem
Dim numObjects As Single
Dim errorMessage As String
Set docRef = appRef.ActiveDocument
numObjects = docRef.PathItems.Count
On Error GoTo DisplayError
Set aiObject = docRef.PathItems(5)
Exit Sub
DisplayError:
errorMessage = "Couldn't locate 5th path object - Only "
errorMessage = errorMessage & numObjects & " objects."
MsgBox errorMessage
End Sub
Visual Basic Resources
For further information and instruction in using Visual Basic and the VBA scripting language, see these
documents and resources:
●
“Learn to Program with Visual Basic 6,” 1st ed., John Smiley, Active Path, 1998. ISBN 1-902-74500-0.
●
“Microsoft Visual Basic 6.0 Professional,” 1st ed., Michael Halvorson, Microsoft Press, 1998. ISBN
1-572-31809-0.
●
“VB & VBA in a Nutshell,” 1st ed., Paul Lomax, O’Reilly, 1998. ISBN 1-56592-358-8.
●
Microsoft Developers Network (MSDN) scripting website:
msdn.microsoft.com/scripting
3
Scripting Illustrator
This chapter discusses the object model and application-specific concepts that you use to script Adobe
Illustrator using Visual Basic and VBScript.
The Illustrator Object Model
A good understanding of the Illustrator object model will improve your scripting abilities. The following
figure shows the containment hierarchy of the object model, starting with the application object.
Application
Document
Text Font
Layer
Page Item
Group Item
Compound
Path Item
Path Item
Graph Item
Brush
Graphic Style
Paragraph Style
Spot
Character Style
View
Mesh Item
Path Item
Path Point
Placed Item
Plugin Item
Gradient
Symbol
Raster Item
Dataset
Pattern
Symbol Item
Variable
Story
Text Frame
Swatch
Adobe Illustrator Scripting Object Model
Note that the Layer, GroupItem, and all text classes can contain additional objects of the same class
which can in turn contain additional nested objects. For the text object model, see Working with text art.
56
Adobe Illustrator CS2
Visual Basic Scripting Reference
Scripting Illustrator
57
Looking at Illustrator objects and commands
While the objects and commands available in Illustrator are all documented in this guide, you can also
view them from inside your scripting system.
➤ To view the Illustrator type library:
1. In any Visual Basic project, choose Project > References. Visual Basic displays the References dialog
box. If you are using a built-in editor in a VBA application, choose Tools > References.
2. Turn on the “Adobe Illustrator CS2 Type Library” option from the list of available references and click
OK. If the library does not appear in the list of available references, reinstall Illustrator with your
scripting plug-ins.
3. Choose View > Object Browser. Visual Basic displays the Object Browser window.
4. Choose “Illustrator” from the list of open libraries shown in the top-left pull-down menu. Visual Basic
displays the classes and the members of those classes in the Object Browser window.
5. Click an object class or class member. Visual Basic displays more information about the object in the
frame at the bottom of the Object Browser window.
Your First Illustrator Script
The traditional first project in any programming language is to display the message “Hello World!” In this
example, we’ll create a new Illustrator document, then add a text frame item containing this message.
➤ To create a Visual Basic script follow these steps:
1. Start Visual Basic and create a new project. Add the “Adobe Illustrator CS2 Type Library” reference to
the project, as shown earlier. If you are using a built-in editor in a VBA application, skip to step 4.
2. Add a form to the project.
3. Create a new button on the form. Double-click the button to open the Code window.
4. Enter the following code. The lines which begin with a single quote character (‘) are comments, and will
be ignored by the scripting system. They’re included to describe the operation of the script. As you
look through the script, you’ll see how we create, then address each object in turn.
Private Sub Command1_Click()
Dim appRef As New Illustrator.Application
Dim documentRef As Illustrator.Document
Dim sampleText As Illustrator.TextFrame
'Create a new document and assign it to a variable
Set documentRef = appRef.Documents.Add
'Create a new text frame item and assign it to a variable
Set sampleText = documentRef.TextFrames.Add
'Set the contents and position of the TextFrame
sampleText.Position = Array(200, 200)
sampleText.Contents = "Hello World!"
End Sub
5. Save the form.
6. Start Illustrator.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Scripting Illustrator
58
7. Return to Visual Basic and run the program. If you created a form, click the button you created earlier.
8. Run the script.
Illustrator creates a new document, adds a text frame item at the specified position, and sets the text to
“Hello World!”.
VBScript
You don’t need to use Visual Basic to run scripts on Windows. Another way to script Illustrator is to use a
VBA editor (such as the one that is included in Microsoft Word) or to use Windows Scripting Host.
Windows Scripting Host is part of Windows2000. If you don’t have Windows2000, you can download
Windows Scripting Host from: http://msdn.microsoft.com/scripting/
Both VBA and Windows Scripting Host use VBScript as their scripting language. The syntax for VBScript is
very similar to the Visual Basic syntax. The three main differences relating to the scripts shown in this guide
are:
●
VBScript is not as strongly typed as Visual Basic.
●
In Visual Basic you say:
Dim aRef as Illustrator.PathItem
●
For VBScript simply omit the “as X” part:
Dim aRef
●
VBScript does not support the as New Illustrator.Application form.
●
In Visual Basic you retrieve the Application object as:
Dim appRef as New Illustrator.Application
●
In VBScript you write the following to retrieve the Application object:
Dim appRef
Set appRef = CreateObject("Illustrator.Application.3")
●
VBScript does not support enumerations; you must use integer values instead. (See the Enumerations
reference section in Visual Basic Object Reference to find the values that correspond to the various
enumerations.) Here’s an example of how to close the frontmost document without saving.
●
In Visual Basic:
Dim appRef As New Illustrator.Application
appRef.ActiveDocument.Close (aiDoNotSaveChanges)
●
In VBScript:
Dim appRef
Set appRef = CreateObject("Illustrator.Application.3")
appRef.ActiveDocument.Close ( 2 )
Here is an example of Hello World! for VBScript:
Dim appRef
Dim documentRef
Dim SampleText
'Create a new document and assign it to a variable
Set appRef = CreateObject("Illustrator.Application.3")
Set documentRef = appRef.Documents.Add
Adobe Illustrator CS2
Visual Basic Scripting Reference
Scripting Illustrator
59
'Create a new text frame item and assign it to a variable
Set SampleText = documentRef.TextFrames.Add
'Set the contents and position of the TextFrame item
SampleText.Position = Array(200, 200)
SampleText.Contents = "Hello World!"
To run this script create a text file and copy the script into it. Save the file with a .vbs extension. If you
have Windows Scripting Host installed, you can double-click on the file to execute the script.
Another way to execute the script is to choose File > Scripts > Browse from the Scripts menu in Illustrator
and select the file.
Adding features to “Hello World”
Next, let’s create a new script that makes changes to the Illustrator document you created with your first
script. Don’t worry if you’ve closed the Illustrator document without saving it—just run your script to
create a new one.
Our second script will demonstrate how to:
●
Get the active document.
●
Get the width of the active document.
●
Resize the text frame item to match the document’s width.
➤ To create the enhanced script follow these steps:
1. Open the project you created for the “Hello World” script, if it’s not already open.
2. Add a new button to the form.
3. Double-click the button to display the Code window, then enter the following code.
Private Sub Command1_Click()
Dim appRef As New Illustrator.Application
Dim documentRef As Illustrator.Document
Dim sampleText As Illustrator.TextFrame
Dim documentWidth As Single
' Get the active document
Set documentRef = appRef.ActiveDocument
documentWidth = documentRef.Width
Set sampleText = documentRef.TextFrames(1)
' Resize the TextFrame item to match the document width
sampleText.Width = documentWidth
sampleText.Left = 0
End Sub
4. Save the form.
5. Open the original document you created using the “Hello World” script, then return to Visual Basic and
run the script.
6. Click the button you created in Step 2.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Scripting Illustrator
60
Object References
In Visual Basic, you must use the Set command to assign an object reference to a variable, rather than the
simple assignment operator (=). For example, the following lines use Set to assign a newly created and an
existing layer reference to variables:
Set thisLayer = Illustrator.Documents(1).Layers.Add()
Set thisLayer = Illustrator.Documents(1).Layers(1)
For some types of objects, the Name property is writable. The collections are sorted alphabetically by
name, so if a script modifies the name of such an object, references to that object by the old name or index
can become invalid. These object types include the following:
Brush
Gradient
GraphicStyle
Pattern
Swatch
Symbol
Variable
Object references in Visual Basic are dynamic and remain valid until disposed. For example, the following
creates a star and rectangle and uses object references to select them:
Private Sub Command1_Click()
'Make 2 new objects and select both
Dim appRef As New Illustrator.Application
Dim pathItemsRef As Illustrator.PathItems
Dim rectPath As Illustrator.PathItem
Dim starPath As Illustrator.PathItem
Set pathItemsRef = appRef.ActiveDocument.ActiveLayer.PathItems
Set rectPath = pathItemsRef.Rectangle(50, 70, 100, 200)
Set starPath = pathItemsRef.Star(40, 70, 200, 110, 5, False)
Dim pathSelection(1) As Variant
Set pathSelection(0) = rectPath
Set pathSelection(1) = starPath
appRef.Selection = pathSelection
End Sub
Creating objects in Visual Basic
As the object model diagram shows, objects are arranged in a hierarchy. To obtain a reference to a specific
object you need to navigate the hierarchy. For example, to store a reference to the first PathItem in the
second layer of the active document in the variable myPath you would write:
Set myPath = appRef.ActiveDocument.layers(2).PathItems(1)
Since most objects in the hierarchy are referenced through the Application object, you must have a
reference to the Illustrator application before you can start modifying any other objects. There are several
ways to obtain a reference to an Illustrator application object.
●
Use the New command if you have added a reference to the Illustrator type library to the project. For
example, the following line creates a new reference to the Application object:
Dim appRef As New Illustrator.Application
Adobe Illustrator CS2
Visual Basic Scripting Reference
●
Scripting Illustrator
61
GetObject also creates a reference to a running instance of Illustrator. If Illustrator is not running an
error is returned.
Dim appRef As Illustrator.Application
Set appRef = GetObject(, "Illustrator.Application")
●
CreateObject launches Illustrator as an invisible application if it is not already running. Note that if
Illustrator was launched as an invisible application you have to manually activate the application to
make it visible.
Dim appRef As Illustrator.Application
Set appRef = CreateObject("Illustrator.Application")
Note: If you have both earlier and later versions of Illustrator installed on the same machine and use the
CreateObject() or GetObject() method to obtain an application reference, use the optional
numeric version identifier at the end of the string “Illustrator.Application” —when the
version identifier is not present, the string refers to the latest installed Illustrator version. To
specifically target a version:
●
For Illustrator 10, use "Illustrator.Application.1"
●
For Illustrator CS, use "Illustrator.Application.2"
●
For Illustrator CS2, use "Illustrator.Application.3"
Objects that must be created
There are a number of objects in addition to Application that cannot be obtained by using the
hierarchy shown in the object model diagram. These objects must created directly using the techniques
shown above for the Application object. Those objects include:
ExportOptionsFlash
Ink
InkInfo
NoColor
OpenOptions
PaperInfo
PPDFile
PPDFileInfo
PrintColorManagementOptions
PrintColorSeparationOptions
PrintCoordinateOptions
Printer
PrinterInfo
PrintFlattenerOptions
PrintFontOptions
PrintJobOptions
PrintOptions
PrintPageMarksOptions
PrintPaperOptions
PrintPostScriptOptions
Screen
ScreenSpotFunction
The following example demonstrates how to create new objects such as EPSSaveOptions.
' Create a reference to the Illustrator Application
Dim appRef As New Illustrator.Application
' Create an EPS-save option object
Dim myEPSSaveOptions As New Illustrator.EPSSaveOptions
' Set the options according to how you want the save to occur
myEPSSaveOptions.EmbedAllFonts = True
myEPSSaveOptions.Compatibility = aiIllustrator8
myEPSSaveOptions.Preview = aiColorTIFF
' Save the active document
appRef.ActiveDocument.SaveAs "C:\Temp\AI_TestDocument.eps",
myEPSSaveOptions
Objects that cannot be created by a script
Following are some objects that cannot be created from a script:
●
Graphic styles
Adobe Illustrator CS2
Visual Basic Scripting Reference
●
Brushes
●
Graphs
●
Mesh art
●
Plugin art
●
Spirals
Scripting Illustrator
62
Object containment: document vs. layer
In Illustrator, all artwork objects are contained in layers, groups, or compound paths that are themselves
contained in a document. The index of an object in a layer or group indicates the object’s position in the
stacking order of the layer or group. This means that Layers(1).PageItems(1) is the frontmost object
in a document, while Layers(1).PageItems(2)lies directly behind in the stacking order.
Note that if you delete all the layers in a document, the document is left with the default empty layer
called Layer 1.
When you refer to an object in your document, you can reference it directly as part of the document or by
its complete containment hierarchy, including layers and any group or compound path if valid. When you
refer to objects contained by the document directly, you can access the entire flattened contents of the
document, without regard to the containment of objects within layers, groups, or compound paths. All
objects, whether or not they are contained in groups or compound paths, are returned as individual
objects contained by the document. The following script demonstrates how to reference an object as part
of a document.
Private Sub Command1_Click()
'Get reference for first page item of document 1
Dim appRef As New Illustrator.Application
Dim documentRef As Illustrator.Document
Dim pageItemRef As Object
Set documentRef = appRef.ActiveDocument
Set pageItemRef = documentRef.PageItems(1)
End Sub
In the script below, the variable pageItemRef will not necessarily refer to the same object as the above
script since this script includes a reference to a layer:
Private Sub Command1_Click()
'Get reference for first page item of document 1
Dim appRef As New Illustrator.Application
Dim documentRef As Illustrator.Document
Dim pageItemRef As Object
Set documentRef = appRef.ActiveDocument
Set pageItemRef = documentRef.Layers(1).PageItems(1)
End Sub
Syntax Differences Between Sub and Function Methods
Visual Basic supports different types of methods. When scripting Illustrator, your scripts will call both Sub
and Function methods. The difference between the two methods is that a Function returns a value while a
Adobe Illustrator CS2
Visual Basic Scripting Reference
Scripting Illustrator
63
Sub, or method call, does not. For example, the Add method is a function because it returns a reference to
the newly added object.
When calling a Function, Visual Basic expects you to put parentheses around the function’s arguments.
With a Sub, however, Visual Basic disallows the use of parentheses around the arguments unless you use
an alternative syntax. The following lines demonstrate the difference between the syntax for calling a
Function, Add, and a Sub, ApplyTo, in Visual Basic.
Set newDoc = appRef.Open("C:\myfile.eps")
appRef.ActiveDocument.GraphicStyles(2).ApplyTo artItem
Working with Document Contents
The following sections provide details of how to work with various kinds of document contents:
●
“Working with selections”
●
“Working with paths”
●
“Working with color”
●
“Working with symbols and symbol items”
●
“Working with text art”
Working with selections
There are instances where you will want to write scripts that act upon the currently selected object or
objects. For example, you might want to have a script that applies formatting to selected text, or changes a
selected path’s shape. To do this, you need to know the number of selected objects and the type of each
object.
The following script works with the current selection.
'Selection sorter
Private Sub Command1_Click()
Dim appRef As New Illustrator.Application
Dim documentRef As Illustrator.Document
Set documentRef = appRef.ActiveDocument
selectedObjects = documentRef.Selection
If TypeName(selectedObjects) = "String" Then
'text is selected
Else
'Is anything selected?
If IsEmpty(selectedObjects) Then GoTo noSelection
For Each artObject In selectedObjects
selectedObjectClass = TypeName(artObject)
Select Case selectedObjectClass
'Something is selected, let’s find out what it is.
Case "PathItem"
'Object is a path item
Case "CompoundPathItem"
'Object is a compound path
Case "RasterItem"
'Object is a raster image
Case "PlacedItem"
'Object is a placed image
Adobe Illustrator CS2
Visual Basic Scripting Reference
Scripting Illustrator
64
Case "MeshItem"
'Object is a mesh
Case "TextFrame"
'Object is a text frame
Case "PluginItem"
'Object is a plugin art item
Case "PathPoint"
'Object is a point of a path
Case "GroupItem"
'Object is a group of objects
End Select
Next
End If
Exit Sub
noSelection:
MsgBox "Select an object and try again."
End Sub
Working with paths
Path items include all artwork that contain paths, including rectangles, ellipses, polygons, as well as
freeform paths. In Illustrator, every path consists of a series of points; see the following figure.
PathPoint
RightDirection
PathItem
Anchor
LeftDirection
Path items, as well as path points, can be created and manipulated from a script. Every aspect of a path
point can be accessed from scripting, including the AnchorPoint and both control points, known as the
LeftDirection and RightDirection properties.
For more information on working with paths, Bézier curves, and path points, refer to the Illustrator Plug-in
Software Development Kit Function Reference. This document is available as part of the Illustrator Software
Development Kit (SDK), which can be downloaded from the Adobe Solutions Network (ASN) web site:
http://partners.adobe.com/asn/developer/sdks.html
Working with color
Swatches can be created and manipulated from your scripts. You can also create new patterns, gradients,
and spot colors from scripts. Just as in the user interface, percentages (0.0 through 100.0) are used to
specify grayscale, individual CMYK values and spot tints. The range 0.0 to 255.0 is used for the individual
RGB color values. Special attention should be paid to working with CMYK and RGB color values.
Illustrator CS2 supports only a single color model within each document, either CMYK or RGB. When you
specify a CMYK color value in a document that uses the RGB color model, Illustrator will convert the values
to RGB and return an RGB color, and vice-versa when specifying RGB colors in a CMYK document.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Scripting Illustrator
65
However, there is some data loss during this conversion. Refer to the “Applying Color” chapter in the
Adobe Illustrator User Guide for more information on working with color.
Working with symbols and symbol items
Symbols are art items that are stored in the Symbols palette and applied to documents. You can create,
delete and duplicate symbols. When you create symbols, Illustrator adds them to the Symbols Palette for
the target document. When you save the document, Illustrator also saves the symbols you created and
used in the document.
Symbol items refer to instances of symbols in a document. You can create, delete, and duplicate symbol
items. They are “linked” to the symbol definition such that changing the definition of a symbol causes all of
the instances of the symbol to change as well. Symbol items are Illustrator art items and therefore can be
treated as other art items or page items. In other words, you can rotate, resize, select, lock, hide, and
perform other operations on them.
Working with text art
In Illustrator CS2, the object model for text changed significantly. The following figure shows the CS2
object model for text.
Application
Text Range
Document
Selection
Paragraph
Character Style
Story
Paragraph Style
Text Frame
Line
Word
Character
Illustrator Object Model for Text
With the new text model, the text in an Illustrator document is contained inside a story. A document can
have multiple stories, and each story has a text range. A story can contain one or more text frames. In this
case, multiple text frames are linked together to form a single story. There are special sets of text ranges
within a text range that have semantic meanings such as paragraphs, lines, words, characters.
n a path
This is
an example of area
text.
ple of te
xt o
This is an
example of
point text.
This is an exam
There are three types of text frame items in Adobe Illustrator: point text, path text, and area text. The Kind
property of a text frame item is used to determine the type of the text frame item. While all three kinds of
text art have some common characteristics, such as an orientation, each kind of text art also has unique
characteristics.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Scripting Illustrator
66
All three kinds of text frames have least one text path associated with them. A TextPath is not the same
as a path art item, but defines the text frame’s position on the artboard and its orientation (horizontal or
vertical). Point text is defined completely by the properties of its text frame and associated text path.
For path and area text, text paths are associated with normal path art items. These path art items can be
accessed and manipulated to modify the appearance of the associated text frame. If the text frame is path
text, it will have a TextPathOffset property, which indicates where on the path object the text begins.
All text art items also have at least one line of text depending on the object’s geometry. A TextLine is all
of the characters that fit on a single line in the text frame item. Text art will have multiple text lines if it
contains hard line breaks or its characters flow to a new line because they do not fit in the width of the text
art. Unlike characters, paragraphs and words, lines can only be created by the Illustrator application.
Refer to the “Using Type” chapter in the Adobe Illustrator User Guide for more information on working
with text art.
Content of a text range
You can set the content of a text range by passing in a Unicode string known to that particular scripting
language. If you know the Unicode value of a character, you can enter it using a C language style backslash
escape sequence. If the string starts with a single or double quote, treat the quote as a delimiter. The exact
escape characters it recognizes depends on the scripting language being used.
Character style, character attributes, local character attributes
You can change the display properties of a text range by applying an appropriate character style and/or
providing local overrides of character attributes at the text and/or paragraph levels.
The character styles are hierarchical, namely you can derive a new character style from another base
(parent) character style, although only one level of inheritance is allowed. The root character style is
named ‘Normal’, with all character attributes defined and set to default values.
If you query for the character attributes of a text range, Illustrator will derive a fully defined/flattened set of
character attributes (because at the root level, ‘Normal’ character style is always fully defined).
This principle also applies the paragraph style, paragraph attributes and local paragraph attributes.
Measurement Units
Illustrator uses points as the unit of measurement for almost all distances, where one inch is equal to 72
points. The one exception is that for values for properties such as kerning, tracking, and the aki properties
(used for Japanese text composition), em units are used; see Em Space Units.
Even if you change the current document ruler’s units of measurement, Illustrator will still use points when
communicating with your scripts. Your scripts will need to perform any unit conversions needed to
represent your measurements as points. For example, to move the current selection to a position 2 inches
to the right of, and 6 inches above, its current position, you’d use the following script for Visual Basic:
Private Sub Command1_Click()
Dim appRef As New Illustrator.Application
Dim documentRef As Illustrator.Document
Dim selectedObjects As Variant
Dim objectRef As Variant
Adobe Illustrator CS2
Visual Basic Scripting Reference
Scripting Illustrator
67
Set documentRef = appRef.ActiveDocument
selectedObjects = documentRef.Selection
If TypeName(selectedObjects) = "Variant()" Then
For Each objectRef In selectedObjects
'There are 72 points per inch, so this moves
'the object 2" to the right and 6" up
objectRef.Translate 144, 226
Next
End If
End Sub
If your script depends on adding, subtracting, multiplying, or dividing specific measurement values for
units other than points, the script will need to convert between the units numerically. For example, to use
English measurements such as inch values for coordinates or measurement units, your script will need to
multiply all inch values by 72 to convert to points, since there are 72 points in an inch. To use metric
measurements such as centimeters, you will need to multiply all centimeter values by 28.346, since there
are 28.346 points in a centimeter.
Unit conversion to points
This table shows the conversion formulae for various units of measurement:
Unit
Conversion formula
centimeters
28.346 points = 1 centimeter
inches
72 points = 1 inch
millimeters
2.834645 points = 1 millimeter
picas
12 points = 1 pica
Qs
0.709 point = 1 Q (1 Q equals 0.23 millimeter)
Em Space Units
One exception to the rule of points being used for all measurements is the use of em units (a traditional
typesetting measure) for a few properties such as for kerning and tracking. Values for these properties are
measured in thousandths of an em space.
Em units are proportional to the current font size. For example, in a 6-point font, 1 em equals 6 points; in a
10-point font, 1 em equals 10 points. Similarly, a kerning value of 20 em units for a 10-point font would be
equivalent to:
(20 units x
10 points) / 1000 units/em
=
0.2 points
Coordinates
Illustrator uses simple two-dimensional geometry to record the position of objects in a document. The
coordinates used in Illustrator are the same as the “traditional” geometric coordinate system you learned
about in school. The horizontal component of a coordinate pair (or “point”) is referred to as “x” and the
vertical position is denoted by “y”. You can see these coordinates in the Info palette when you select or
create an object in Illustrator.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Scripting Illustrator
68
Illustrator scripting uses a special class called fixed point to receive and return coordinate data. The
fixed point is represented as a variant array of two elements in Visual Basic. The first item is the horizontal
or “x” coordinate, while the second item is the vertical or “y” coordinate. The Position of objects on a
document are described with a fixed point.
Fixed points
In Visual Basic, a fixed point with an x coordinate of 5.0 and a y coordinate of 10.2 is represented as a
variant array that looks like this:
Array (5.0, 10.2)
Note that if you declare an array to hold the values of a point, you should pass 1 as the dimension, since
Visual Basic uses index position 0 for the first item in an array.
Dim aPoint(1) As Single
aPoint(0) = 5.0
aPoint(1) = 10.2
Zero point
The zero point (0, 0) for coordinate numbering in Illustrator is in the lower left corner of the document. On
the horizontal axis, coordinates to the right of the ruler’s zero point are positive numbers, and on the
vertical axis, coordinates above the zero point are positive. The PageOrigin of a document defines the
lower left corner of the printable region of the document as a fixed point.
Fixed rectangle
To work with rectangular coordinates where there are a pair of x and y values, Illustrator uses the special
class called a FixedRectangle. This class consists of a variant array with four elements in Visual Basic.
The coordinates of a fixed rectangle in order are: left, top, right, bottom.
In Visual Basic, a fixed rectangle with a left-top corner of (5.0, 200.0) and a right-bottom corner of (100.0,
20.0) is represented by a variant array that looks like this:
Array (5.0, 200.0, 100.0, 20.0)
Alternatively, you can define your array and assign values to its elements like this:
Dim boundsRect(3) As Single
boundsRect(0) = 5.0
boundsRect(1) = 20.0
boundsRect(2) = 100.0
boundsRect(3) = 200.0
Page item positioning and dimensions
Every object, or page item, in a document has a position described by a fixed point and a width and
height. The maximum value allowed for the width or height of a page item is 16348 points.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Scripting Illustrator
69
Position
ControlBounds
VisibleBounds
GeometricBounds
Detail
PageOrigin
(0,0)
Every page item also has three properties that describe the object’s overall extent using fixed rectangles.
The GeometricBounds of a page item are the rectangular dimensions of the object excluding stroke
width. The VisibleBounds of a page item are the dimensions of the object including any stroke widths.
Finally, the ControlBounds define the rectangular dimensions of the object including in- and outcontrol points.
Printing Illustrator Documents
Prior to Illustrator CS, scripts could use the print command, but they could not control any of the print
settings. With the new printing model, you can use the full range of Illustrator print capabilities from a
script. In many instances, the print features available via scripting are greater than those available through
the Illustrator CS2 print user interface.
Using the print scripting feature, scripters can capture and automate parts of their print workflow, which
allows them to focus on other more creative work. Scripting exposes the full capabilities of Illustrator
printing, some of which may not be accessible through the normal print user interface.
Illustrator supports at most one print session at any give time because of limitations in the current printing
architecture.
When printing, you may provide an options parameter to more fully control the printing process.
Illustrator CS2 supports an extensive list of new printing options, all of which have default values. As a
scripter, you can override any one of these printing options. If you do not override those printing options
or if you override those printing options with illegal values (such as specifying a printer or paper that does
not exist), an error is returned.
The following lists the categories of printing options that you can specify. Each one of these categories is
optional. Within each category, default values have been provided for all properties.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Scripting Illustrator
Print Option
Description
Printer name
Name of the selected printer
PPD file name
File name of the selected PPD file
Print style name
Specifies the printing style
Paper options
Specifies the paper name and custom paper sizes
Print job options
Options which control things such as number of print copies
Color separation options
Specifies the separation mode, ink list, etc.
Page marks options
Controls the printing of page marks
Coordinate options
Specifies the positioning and scaling of artwork on the media
Font options
Controls the fonts used for printing
PostScript® options
Controls parameters such as the PostScript LanguageLevel
Color management
Sets color profiles
Flattener options
Controls the transparency flattening
70
The print settings are determined through the following precedence order:
●
The print style settings, if any are specified, override the default print settings.
●
The specific printing options, if any are specified, override the print style settings.
Transformation Matrices
Thanks to the matrix class and the many commands that support matrices, you have access to the power
of geometric transformation matrices. Transformation matrices are mathematical concepts originating in
the field of linear algebra. Geometric manipulations like scaling, rotating, and moving can all be described
using transformation matrices.
Matrices are the basis of how Illustrator internally performs a user’s request to scale, rotate, or move an
object. Using the command set available to create, concatenate, and apply matrices, you can transform
objects in documents with programmatic precision and control. By concatenating a series of rotation,
translation and scaling matrices together and applying the resulting matrix, you can perform a large series
of geometric transformations in record speed. The following examples demonstrate how to combine
multiple modifications in a single matrix and then apply the matrix to every object in a document.
Refer to the Illustrator Plug-in Software Development Kit Function Reference for more information on
working with transformation matrices.
This example shows how to apply 2 transformations to all art in a document using the matrix command.
This is more efficient than performing these transformations one at a time.
Private Sub ApplyMatrix_Click()
Dim appRef As New Illustrator.Application
Dim moveMatrix As Illustrator.Matrix
Dim totalMatrix As Illustrator.Matrix
'Move art half an inch to the right and 1.5 inch up on the page
Set moveMatrix = appRef.GetTranslationMatrix(72# * 0.5, 72# * 1.5)
Adobe Illustrator CS2
Visual Basic Scripting Reference
Scripting Illustrator
71
'Add a rotation to the translation
'to rotate 10 degrees counter clockwise
Set totalMatrix = appRef.ConcatenateRotationMatrix(moveMatrix,10)
'Apply the transformation to all art in the document
Dim frontDocument As Illustrator.Document
Dim artItem As Illustrator.PageItem
Set frontDocument = appRef.ActiveDocument
For Each artItem In frontDocument.PageItems
artItem.Transform totalMatrix
Next
End Sub
A matrix object in Illustrator consists of six properties. In Visual Basic, these properties are:
MValueA
MValueB
MValueC
MValueD
MValueTX
MValueTY
By experimenting with the matrix concatenation commands, you can discover how to construct matrices
that can applied to perform movement (also called translation), rotation, scaling, skewing, and other
transformations. See the script examples for the matrix commands for working samples.
Working with Variables and Datasets
By creating dynamic objects, you can create data-driven graphics. You can define dynamic objects by
using variables. In scripting, the Variable class corresponds to these variables. Variables are
document-level objects; therefore, you create them in the document object. You can add and delete
variables to/from a script by using the Add and Remove/ RemoveAll methods.
Datasets are closely related to variables in that a dataset collects variables and their associated dynamic
data into a single object. The DataSet class is the object that corresponds to an AI DataSet. The
DataSet collection in the Document class provides methods so you can create, update and delete
datasets.
Launching and Quitting Illustrator from a Script
Your scripts can control the activation and quitting of the Illustrator application. In Visual Basic, the
Activate method brings the Illustrator application to the front if it is not already frontmost. The Quit
method quits the application.
Note that if the clipboard contains data at the time of quitting, Illustrator may show a dialog prompting
the user to save the data on the clipboard for other applications. You can avoid this dialog by first clearing
the clipboard with the command:
Clipboard.Clear
Adobe Illustrator CS2
Visual Basic Scripting Reference
Scripting Illustrator
72
User Interaction Levels
An application will usually present a dialog when it needs to provide feedback or request information. This
is called user interaction, and is useful and expected when you are directly interacting with the
application. On the other hand, when a script is interacting with an application, an unexpected dialog will
bring the execution of the script to a halt until the dialog is dismissed. This can be a serious problem in an
automation environment where there is typically no one present to deal with dialogs.
The Illustrator CS2 application class contains a user interaction level property. By setting this property a
script can control the level of interaction allowed during script execution. All interaction is normally
suppressed in an automation environment, and some interaction might be useful where scripts are being
used in a more interactive fashion.
There are two possible values for the UserInteractionLevel property in Visual Basic:
Property Value
Result
aiDontDisplayAlerts
No interaction is allowed
aiDisplayAlerts
Interaction is allowed
4
Visual Basic Object Reference
This reference section describes the objects and methods in the Illustrator Visual Basic 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, including 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 Enumerations reference. Required terms are shown in plain face. All items surrounded
by brackets [ ] are optional.
●
Script examples.
These example are intended to illustrate concepts, and do not necessarily represent the best or most
efficient way to construct a Visual Basic 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 Visual Basic form if you
are using the Visual Basic development environment. A standard button click event is used for all
examples. If you are using a built-in Visual Basic editor in a VBA application, you can paste the script
into a macro routine. In either case, modify the Sub statement in the example to work with your
situation.
See The Illustrator Object Model for an overview of how the Illustrator object model is structured.
73
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
74
Application
The Adobe Illustrator application object, which contains all other Illustrator objects.
Note: If you have both earlier and later versions of Illustrator installed on the same machine and use the
CreateObject() or GetObject() method to obtain an application reference, use the optional
numeric version identifier at the end of the string “Illustrator.Application” —when the
version identifier is not present, the string refers to the latest installed Illustrator version. To
specifically target a version:
●
For Illustrator 10, use "Illustrator.Application.1"
●
For Illustrator CS, use "Illustrator.Application.2"
●
For Illustrator CS2, use "Illustrator.Application.3"
Application properties
Property
Value type
What it is
ActionIsRunning
Boolean
Read-only. If true, an action is still running.
ActiveDocument
Document object
The active (frontmost) document in Illustrator.
Application
Application object
Read-only. The Illustrator Application object.
BrowserAvailable
Boolean
Read-only. If true, a Web browser is available.
Documents
Documents collection
object
Read-only. The documents in the application.
FlattenerPresetsList Variant
Read-only. The list of flattener style names
currently available for use.
FreeMemory
Long
Read-only. The amount of unused memory (in
bytes) within the Adobe Illustrator partition.
Name
String
Read-only. The application’s name (not related to
the filename of the application file).
Path
String
Read-only. The file path to the application.
PDFPresetsList
Variant Array of
Strings
Read-only. The list of preset PDF-options names
available for use.
PPDFileList
Variant Array of
Strings
Read-only. The list of PPD files currently available
for use.
Preferences
Preference Object
Read-only. The application preferences.
PrinterList
Variant
Read-only. A list of available printers.
PrintPresetsList
Variant
Read-only. The list of preset printing-options
names currently available for use.
ScriptingVersion
String
Read-only. The version of the Scripting plug-in.
Selection
Variant Array (of
objects)
All of the currently selected objects in the active
(frontmost) document; see note for more
information.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
Property
Value type
What it is
TextFonts
TextFonts collection
Read-only. The installed fonts.
TracingPresetList
Variant Array of
Strings
Read-only. The list of preset tracing-options
names available for use.
UserInteractionLevel AiUserInteractionLevel
75
Whether or not to interact with users by
displaying dialogs during the running of a script.
Version
String
Read-only. The version of the Adobe Illustrator
application.
Visible
Boolean
Read-only. If true, the application is visible.
Application methods
Method
Returns
What it does
ConcatenateMatrix
Matrix
object
Concatenates two matrices
together.
Matrix
object
Concatenates a rotation
translation to a transformation
matrix.
Matrix
object
Concatenates a scale translation
to a transformation matrix.
Matrix
object
Concatenates a translation to a
transformation matrix.
String
Executes a JavaScript script
contained in the action
argument, and returns the value
of the last executed statement.
String
Executes a JavaScript script from a
file specified by the action
argument, and returns the value
of the last executed statement.
Nothing
Plays an action from the Actions
palette.
Matrix
object
Returns an identity matrix.
Matrix
object
Returns a transformation matrix
containing a single rotation.
(matrix as Matrix,
secondMatrix as Matrix)
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])
DoJavaScript
(action as String,
from as String
[, dialogs as Boolean])
DoJavaScriptFile
(action as String,
from as String
[, dialogs as Boolean])
DoScript
(action as String,
from as String
[, dialogs as Boolean])
GetIdentityMatrix
()
GetRotationMatrix
([angle as Double])
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
76
Method
Returns
What it does
GetScaleMatrix
Matrix
object
Returns a transformation matrix
containing a single scale.
Matrix
object
Returns a transformation matrix
containing a single translation.
Matrix
object
Inverts a matrix.
Boolean
Checks whether two matrices are
equal.
Boolean
Checks whether a matrix is
singular and cannot be inverted.
Document
object
Opens the file or files specified by
the string or array of strings
containing file paths.
([scaleX as Double]
[, scaleY as Double])
GetTranslationMatrix
([deltaX as Double]
[, deltaY as Double])
InvertMatrix
(matrix as Matrix)
IsEqualMatrix
(matrix as Matrix,
secondMatrix as Matrix)
IsSingularMatrix
(matrix as Matrix)
Open
(files as String,
[documentColorSpace as AiDocumentColorSpace],
[options as Object])
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.
Quit
Nothing
()
Redraw
If the clipboard contains data, a
dialog prompts the user to save
the data for other applications. To
avoid this, empty the clipboard
first with Clipboard.Clear.
Nothing
Forces Illustrator to redraw all its
windows.
Nothing
Gets the presets from the file.
Nothing
Translates the placeholder text to
regular text. A way to enter
unicode points in hex values.
Member of
Illustrator.Application.
()
ShowPresets
Quits Illustrator.
(fileSpec as String)
TranslatePlaceholderText
(text as String)
➤ Opening a document
To open a document and obtain a reference to the document that was opened use this code:
' Open a document and get the reference to it
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
77
Dim appRef as New Illustrator.Application
Dim docRef as Illustrator.Document
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, simply set the
selection to Empty, as the following example shows.
Private Sub DeselectAll_Click()
Dim appRef as New Illustrator.Application
appRef.activeDocument.Selection = Empty
End Sub
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 VB command (see the
Windows.DoAction example). If you are using VBScript, you can use the Sleep method defined on the
WScript object to insert a pause to test this property, as in the following example:
Dim appRef
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. See the JavaScript documentation for more information on how to write JavaScripts for
Illustrator.
The first argument to DoJavaScript() is a string that must evaluate to a valid JavaScript expression. For
example, the following script displays an alert using the JavaScript alert method.
appRef.DoJavaScript "alert( 'Number of open documents: ' + _
documents.length);"
This example returns the number of open documents to Visual Basic.
Dim myNumberOfDocuments
myNumberOfDocuments = appRef.DoJavaScript("documents.length;")
MsgBox myNumberOfDocuments
➤ 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.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
Dim appRef As New Illustrator.Application
Dim newDocument As Illustrator.Document
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
78
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
79
Brush
A brush in an Illustrator document. Brushes are contained in documents. Illustrator brushes can be
accessed from a script, but not created or deleted.
Brush properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
Name
String
The Brush name.
Parent
Object
Read-only. The container object.
Brush methods
Method
Returns
What it does
ApplyTo
Nothing
Applies the brush to a specific art item.
(artItem as PageItem)
➤ Applying a Brush
This example duplicates and groups the current selection, applying the second Brush in the document to
the items in the group.
Dim
Dim
Dim
Dim
Dim
Dim
appRef As New Illustrator.Application
newGroup As Illustrator.GroupItem
dupItem As Object
artItem As Object
i As Integer
endIndex As Integer
If appRef.Documents.Count > 0 Then
If Not IsEmpty(appRef.ActiveDocument.selection) Then
endIndex = UBound(appRef.ActiveDocument.selection)
Set newGroup = appRef.ActiveDocument.GroupItems.Add
For i = 0 To endIndex
Set artItem = appRef.ActiveDocument.selection(i)
Set dupItem = artItem.Duplicate(newGroup, aiPlaceAtEnd)
appRef.ActiveDocument.Brushes(2).ApplyTo artItem
Next
End If
End If
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
Brushes
A collection of brushes in a document.
Brushes properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
Count
Long
Read-only. Long. The number of objects in the collection.
Parent
Object
Read-only. The document that contains this object.
Brushes methods
Method
Returns
What it does
Index
Long
Returns the index position of the object within the collection.
(item as Brush)
Item
(itemKey)
Brush
object
Returns an object reference to the object identified by itemKey
(name or index).
➤ Get all brushes in a document
This script displays the total number of available brushes in the current document.
Dim appRef As New Illustrator.Application
Dim numBrushes As Long
If appRef.Documents.Count > 0 Then
numBrushes = appRef.ActiveDocument.Brushes.Count
MsgBox (“There are “ & numBrushes & “ brushes in the document.”)
End If
80
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
81
CharacterAttributes
Specifies the properties of a character contained in a text frame. A CharacterStyle object associates
attributes with a text range.
Note: Character attributes do not have default values, and are undefined until explicitly set.
CharacterAttributes properties
Property
Value Type
What it is
AkiLeft
Double
The amount of inter-glyph space
added to the left side of the glyph in
Japanese text (in thousandths of an
em).
AkiRight
Double
The amount of inter-glyph spacing
added to the right side of the glyph
in Japanese text (in thousandths of
an em).
Alignment
AiStyleRunAlignmentType
The character alignment type.
AlternateGlyphs
AiAlternateGlyphsForm
Specifies which kind of alternate
glyphs should be used.
Application
Application object
Read-only. The Illustrator
Application object.
AutoLeading
Boolean
If true, automatic leading must be
used.
BaselineDirection
AiBaselineDirectionType
The Japanese text baseline
direction.
BaselinePosition
AiFontBaselineOption
The baseline position of text.
BaselineShift
Double
The amount of shift (in points) of
the text baseline.
Capitalization
AiFontCapsOption
Specifies whether the text is normal,
all uppercase, all small caps, or a mix
of small caps and lowercase.
ConnectionForms
Boolean
If true, the OpenType® connection
forms should be used.
ContextualLigature
Boolean
If true, the contextual ligature
should be used.
DiscretionaryLigature
Boolean
If true, the discretionary ligature
should be used.
FigureStyle
AiFigureStyleType
Specifies the figure style to use in an
OpenType font.
FillColor
Object
The color of the text fill.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
82
Property
Value Type
What it is
Fractions
Boolean
Specifies whether OpenType
fractions should be used.
HorizontalScale
Double
The horizontal scaling factor for the
character.
Italics
Boolean
If true, the Japanese font supports
italics.
KerningMethod
AiAutoKernType
Specifies the kerning method to be
used.
Language
AiLanguageType
The language of the text.
Leading
Double
The amount of space between two
lines of text, in points.
Ligature
Boolean
If true, the ligature should be used.
NoBreak
Boolean
If true, no break is allowed.
OpenTypePosition
AiFontOpenTypePositionOption
The OpenType baseline position.
Ordinals
Boolean
If true, the OpenType ordinals
should be used.
Ornaments
Boolean
If true, the OpenType ornaments
should be used.
OverprintFill
Boolean
If true, overprint the fill of the text.
OverprintStroke
Boolean
If true, overprinting of the stroke of
the text is allowed.
Parent
Object
Read-only. The object’s container.
ProportionalMetrics
Boolean
If true, proportional metrics in
Japanese OpenType is to be used.
Rotation
Double
The character rotation angle.
Size
Double
The font size in points.
StrikeThrough
Boolean
If true, characters use
strike-through style.
StrokeColor
Object
The color of the text stroke.
StrokeWeight
Double
Line width of stroke.
StylisticAlternates
Boolean
If true, OpenType stylistic alternates
should be used.
Swash
Boolean
If true, the OpenType swash
character should be used.
TateChuYokoHorizontal
Long
The Tate-Chu-Yoko horizontal
adjustment in points.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
Property
Value Type
What it is
TateChuYokoVertical
Long
The Tate-Chu-Yoko vertical
adjustment in points.
TextFont
TextFont
The font used for the character.
Titling
Boolean
If true, the OpenType titling
alternates should be used.
Tracking
Long
The tracking or range kerning
amount in thousandths of an em.
Tsume
Double
The percentage of space reduction
around a Japanese character.
Underline
Boolean
If true, characters are underlined.
VerticalScale
Double
Character vertical scaling factor.
WariChuCharactersAfter
Break
Long
Specifies how the characters in
Wari-Chu text (an inset note in
Japanese text) are divided into two
or more lines.
WariChuCharactersBefore
Break
Long
Specifies how the characters in
Wari-Chu text (an inset note in
Japanese text) are divided into two
or more lines.
WariChuEnabled
Boolean
If true, Wari-Chu is enabled.
WariChuJustification
AiWariChuJustificationType
The Wari-Chu justification.
WariChuLineGap
Long
The Wari-Chu line gap.
WariChuLines
Long
The number of Wari-Chu (multiple
text lines fit into a space meant for
one) lines.
WariChuScale
Double
The Wari-Chu scale.
➤ Setting character attributes
'
'
'
'
'
Character Attributes
Open a document and add a simple text frame
Use the CharacterAttributes object to increment
the size of each character in the text frame.
Dim
Dim
Dim
Dim
Dim
Dim
appRef As New Illustrator.Application
docRef As Illustrator.Document
textRef As Illustrator.TextFrame
iCount As Integer
i As Integer
dSize As Double
Set docRef = appRef.Documents.Add()
83
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
84
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
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
85
Characters
A collection of TextRange objects in which each represents a single character.
Characters properties
Property
Value type
What it is
Application
Application
Read-only. Application that the collection belongs to.
Count
Long
Read-only. Number of elements in the collection.
Parent
Object
Read-only. The object’s container.
Characters methods
Method
Returns
What it does
Add
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.
Long
Returns the index position of the
object within the collection.
Nothing
Deletes every element in the
collection.
(contents as String
[, relativeObject as TextFrame]
[, insertionLocation as AiElementPlacement])
AddBefore
(contents as String)
Index
(itemPtr as TextRange)
RemoveAll
()
➤ Counting characters
Dim
Dim
Dim
Dim
appRef As New Illustrator.Application
numChars As Integer
textArt As Illustrator.TextFrame
textArtRange As Illustrator.TextRange
If appRef.Documents.Count > 0 Then
numChars = 0
For Each textArt In appRef.ActiveDocument.TextFrames
Set textArtRange = textArt.TextRange
numChars = numChars + textArtRange.length
Next
MsgBox ("There are " & numChars & " characters in the document.")
End If
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
CharacterStyle
A named style that specifies character attributes. For an example, see CharacterStyles.
CharacterStyle properties
Property
Value type
What it is
Application
Application
Read-only. Application to which the collection
belongs.
CharacterAttributes
CharacterAttributes
Read-only. The character properties for the text
range.
Name
String
The character style’s name.
Parent
Object
Read-only. The object’s container.
CharacterStyle methods
Method
Returns
What it does
ApplyTo
Nothing
Applies the character style to the text object or
objects.
Nothing
Deletes the object.
(textItem as Object
[, clearingOverrides as Boolean])
Delete
()
86
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
CharacterStyles
A collection of character styles.
CharacterStyles properties
Property
Value type
What it is
Application
Application
Read-only. Application to which the collection belongs.
Count
Long
Read-only. Number of elements in the collection.
Parent
Object
Read-only. The object’s container.
CharacterStyles methods
Method
Returns
What it does
Add
CharacterStyle
Creates a named character style.
Long
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.
(Name as String)
Index
(itemPtr as CharacterStyle)
Item
(itemKey)
RemoveAll
()
➤ Create and apply character styles
' Open a document, and add 3 simple text frames
' Create a new character style and apply it to
' each of the text frames
Dim
Dim
Dim
Dim
Dim
appRef As New Illustrator.Application
docRef As Illustrator.Document
textRef1 As Illustrator.TextFrame
textRef2 As Illustrator.TextFrame
textRef3 As Illustrator.TextFrame
' 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()
87
Adobe Illustrator CS2
Visual Basic Scripting Reference
textRef3.Contents = "Everyone should script!"
textRef3.Top = 550
textRef3.Left = 150
appRef.Redraw
' Create a new character style
MsgBox "Create and apply a character style 'BigRed'."
Dim charStyle As Illustrator.CharacterStyle
Set charStyle = docRef.CharacterStyles.Add("BigRed")
' Create a red color
Dim colorRed As New Illustrator.RGBColor
colorRed.Red = 255
' Set character attributes of the new style
With charStyle.CharacterAttributes
.Size = 40
.Tracking = -50
.Capitalization = 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
Visual Basic Object Reference
88
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
89
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 will translate 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
object
Read-only. The Illustrator Application object.
Black
Double
The black color value. Range 0.0 to 100.0
Cyan
Double
The cyan color value. Range 0.0 to 100.0
Magenta
Double
The magenta color value. Range 0.0 to 100.0
Yellow
Double
The yellow color value. Range 0.0 to 100.0
➤ Setting CMYK colors
Dim appRef As New Illustrator.Application
Dim frontPath As Illustrator.PathItem
Dim newCMYKColor As New 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
' then wrap the color in a standard color object
newCMYKColor.Black = 0
newCMYKColor.Cyan = 30.4
newCMYKColor.Magenta = 32
newCMYKColor.Yellow = 0
frontPath.Filled = True
frontPath.fillColor = newCMYKColor
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
90
CompoundPathItem
Compound paths are objects composed of multiple intersecting paths, resulting in transparent interior
spaces where the original paths overlapped. The PathItems property provides access to the paths that
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 path’s matching property will be updated to the new value.
Paths contained within a compound path or group in a document are returned as individual paths when a
script asks for the paths contained in the document. However, paths contained in a compound path or
group are not returned when a script asks for the paths in a layer which contains the compound path or
group.
CompoundPathItem properties
Property
Value type
What it is
Application
Application
object
Read-only. The Illustrator Application object.
ArtworkKnockout
AiKnockoutState
Is this object used to create a knockout? If so, what kind of
knockout?
BlendingMode
AiBlendModes
The mode used when compositing an object.
ControlBounds
Variant Array of
4 Doubles
Read-only. The bounds of the object including stroke
width and controls.
Editable
Boolean
Read-only. If true, the object is editable.
GeometricBounds
Variant Array of
4 Doubles
Read-only. The bounds of the object excluding stroke
width.
Height
Double
The height of the object, excluding stroke width,
calculated from the GeometricBounds.
Hidden
Boolean
If true, this object is hidden.
IsIsolated
Boolean
If true, this object is isolated.
Layer
Layer object
Read-only. The layer to which this object belongs.
Left
Double
The left position of the object.
Locked
Boolean
If true, the object is locked.
Name
String
The name of this object.
Opacity
Double
The opacity of the object. The value is between 0.0 and
100.0.
Parent
Document object
Read-only. The document that contains this object.
PathItems
PathItems
collection
object
Read-only. The path art items in this compound path.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
Property
Value type
What it is
Position
Variant Array of
2 Doubles
The position of the top left corner of the
CompoundPathItem excluding stroke width.
Selected
Boolean
If true, the object is selected.
Sliced
Boolean
If true, the CompoundPathItem is sliced. Default: false
Tags
Tags collection
object
Read-only. The tags contained in this object.
Top
Double
The top position of the object.
URL
String
The value of the Adobe URL tag assigned to this object.
VisibilityVariable Variable
91
The VisibilityVariable bound to this object.
VisibleBounds
Variant Array of
4 Doubles
Read-only. The visible bounds of the object including
stroke width.
Width
Double
The width of the object, excluding stroke width,
calculated from the GeometricBounds.
WrapInside
Boolean
If true, the text frame object should be wrapped inside
this object.
WrapOffset
Double
The offset to use when wrapping text around this object.
Wrapped
Boolean
If true, wrap text frame objects around this object (text
frame must be above the object).
ZOrderPosition
Long
Read-only. The position of this art item within the stacking
order of the group or layer (Parent) that contains the art
item.
CompoundPathItem methods
Method
Returns
What it does
Copy
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.
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.
()
Cut
()
Delete
()
Duplicate
([relativeObject as Object],
[insertionLocation as AiElementPlacement])
Move
(relativeObject as Object,
insertionLocation as AiElementPlacement)
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
92
Method
Returns
What it does
Resize
Nothing
Scales the compound path where
scaleX is the horizontal scaling factor
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 a transformation matrix.
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) of this object.
(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])
Translate
([deltaX as Double]
[, deltaY as Double]
[, transformObjects as Boolean]
[, transformFillPatterns as Boolean]
[, transformFillGradients as Boolean]
[, transformStrokePatterns as Boolean])
ZOrder
(zOrderCmd as AiZOrderMethod)
➤ 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 Parent property with a TypeName function.
Dim appRef As New Illustrator.Application
Dim pathArt As Illustrator.PathItem
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
Next
End If
End If
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
93
➤ 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 PathItem inside a compound path you affect all paths contained in the compound path.
The example also shows how to access swatches in a document by name.
Dim
Dim
Dim
Dim
Dim
appRef As New Illustrator.Application
frontDocument As Illustrator.Document
activeLayer As Illustrator.Layer
newCompoundPath As Illustrator.CompoundPathItem
newPath As Illustrator.PathItem
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))
Set newPath = newCompoundPath.PathItems.Add
newPath.SetEntirePath Array(Array(100, 110), Array(100, 300))
' Set the gradient of the compound path
newPath.Stroked = True
newPath.StrokeWidth = 3.5
newPath.StrokeColor = frontDocument.Swatches(8).Color
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
CompoundPathItems
A collection of compound paths.
CompoundPathItems properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
Count
Long
Read-only. The number of objects in the collection.
Parent
Document object
Read-only. The document that contains this object.
CompoundPathItem methods
Method
Returns
What it does
Add
CompountPathItem
object
Creates a new CompoundPathItem object.
Long
Returns the index position of the object within
the collection.
CompoundPathItem
object
Returns an object reference to the object
identified by itemKey (name or index).
Nothing
Deletes all objects in this collection.
()
Index
(item as CompoundPathItem)
Item
(itemKey)
RemoveAll
()
➤ Counting compound paths
This example displays the total number of compound paths contained in the first layer of the current
document.
Dim appRef As New Illustrator.Application
Dim numCPaths As Integer
If appRef.Documents.Count > 0 Then
numCPaths = appRef.ActiveDocument.Layers(1).CompoundPathItems.Count
MsgBox (“There are “ & numCPaths & “ compound paths in document.”)
End If
94
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
95
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. You must have at least one variable bound to an art item in order to create a
DataSet object.
●
See the Variable class, and Working with Variables and Datasets for more information.
●
See DataSets for a sample script that uses a DataSet object.
DataSet properties
Property
Value type
What it is
Application
Application
object
Read-only. The Illustrator Application object.
Name
String
The name of the DataSet.
Parent
Document
object
Read-only. The name of the object that is this DataSet object’s parent.
DataSet methods
Method
Returns
What it does
Delete
Nothing
Deletes the object.
Nothing
Displays the DataSet.
Nothing
Updates the DataSet.
()
Display
()
Update
()
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
96
DataSets
A collection of DataSet objects.
DataSets properties
Property
Value type
What it is
Application
Application
object
Read-only. The Illustrator Application object.
Count
Long
Read-only. The number of datasets in the collection.
Parent
Document
object
Read-only. The name of the object that is this DataSet object’s parent.
DataSets methods
Method
Returns
What it does
Add
DataSet
object
Creates a new DataSet object.
Long
Returns the index position of the object within the
collection.
DataSet
object
Returns an object reference to the object identified by
itemKey (name or index).
Nothing
Deletes all objects in this collection.
()
Index
(item as DataSets)
Item
(itemKey)
RemoveAll
()
➤ Creating datasets
'
'
'
'
'
Variables and Datasets
Create two variables (visibility and text)
Create two datasets with different values
Display both datasets
Dim appRef As New Illustrator.Application
Dim docRef As Illustrator.Document
Set docRef = appRef.Documents.Add()
' Create a visibility variable
Dim itemRef As Illustrator.pathItem
Set itemRef = docRef.PathItems.Rectangle(600, 200, 150, 150)
Dim colorRef As New RGBColor
colorRef.Red = 255
itemRef.FillColor = colorRef
Dim visibilityVar As Illustrator.Variable
Set visibilityVar = docRef.Variables.Add()
visibilityVar.Kind = aiVisibility
itemRef.VisibilityVariable = visibilityVar
' Create a text variable
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
Dim textRef As Illustrator.TextFrame
Set textRef = docRef.TextFrames.Add
textRef.Contents = "Text Variable, dataset 1"
textRef.Top = 400
textRef.Left = 200
Dim textVar As Illustrator.Variable
Set textVar = docRef.Variables.Add
textVar.Kind = aiTextual
textRef.ContentVariable = textVar
MsgBox "There are " & CStr(docRef.Variables.Count) & " variables"
MsgBox "Creating new datasets."
' Create a dataset
Dim ds1 As Illustrator.DataSet
Set ds1 = docRef.DataSets.Add()
' Change data and create a 2nd dataset
itemRef.Hidden = True
textRef.Contents = "Text Variable, dataset 2"
Dim ds2 As Illustrator.DataSet
Set ds2 = docRef.DataSets.Add()
' Display datasets
MsgBox "Switching to dataset 1"
ds1.Display
MsgBox "Switching to dataset 2"
ds2.Display
97
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
98
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 FillColor and Stroked that
have analogous default properties.
A document’s DocumentColorSpace, Height, and Width can only be set when the document is
created. Once a document is created, these properties cannot be changed.
The frontmost document can be referred to as either AppRef.ActiveDocument or
AppRef.Documents(1).
Document properties
Property
Value type
What it is
ActiveDataSet
DataSet object
The active DataSet object in the document.
ActiveLayer
Layer object
The active Layer in the document.
ActiveView
View object
Read-only. The document’s current View.
Application
Application object
Read-only. The Illustrator Application object.
Brushes
Brushes collection
object
Read-only. The Brushes contained in the
document.
CharacterStyles
CharacterStyles
Read-only. The list of character styles in this
document.
CompoundPathItems
CompoundPathItems
collection object
Read-only. The CompoundPathItems contained
in the document.
CropBox
Variant Array of 4
Doubles
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.
CropStyle
AiCropOptions
The style of the document’s cropping box.
DataSets
DataSet object
Read-only. A DataSets collection in the
document.
DefaultFillColor
Color object
The Color to fill new paths if default filled is
true.
DefaultFilled
Boolean
If true, a new path should be filled.
DefaultFillOverprint
Boolean
If true, the art beneath a filled object should
be overprinted by default.
DefaultStrokeCap
AiStrokeCap
Default type of line capping for paths created.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
99
Property
Value type
What it is
DefaultStrokeColor
Color object
The stroke color for new paths if default
stroked is true.
DefaultStroked
Boolean
If true, the new path should be stroked.
DefaultStrokeDashes
Variant Array of
Doubles
Default lengths for dashes and gaps in dashed
lines, starting with the first dash length,
followed by the first gap length, and so on. Set
to an empty variant array for solid line.
DefaultStrokeDashOffset
Double
The default distance into the dash pattern at
which the pattern should be started for new
paths.
DefaultStrokeJoin
AiStrokeJoin
Default type of joints in new paths.
DefaultStrokeMiterLimit
Double
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
If true, the art beneath a stroked object
should be overprinted by default.
DefaultStrokeWidth
Double
Default width of stroke for new paths.
DocumentColorSpace
AiDocumentColorSpace
Read-only. The color specification system to
use for this document’s color space.
FullName
String
Read-only. The file associated with the
document, which includes the complete path
to the file.
GeometricBounds
Variant Array of 4
Doubles
Read-only. The bounds of the illustration
excluding the stroke width of any objects in
the document.
Gradients
Gradients collection
object
Read-only. The Gradients collection
contained in the document.
GraphicStyles
GraphicStyles
collection object
Read-only. The GraphicStyles contained in
the document.
GraphItems
collection object
Read-only. The GraphItems collection
contained in the document.
GroupItems
GroupItems
collection object
Read-only. The GroupItems collection
contained in the document.
Height
Double
Read-only. The height of the document,
calculated from the GeometricBounds.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
100
Property
Value type
What it is
InkList
Variant Array
Read-only. The list of inks in this document.
KinsokuSet
Object
Read-only. The Kinsoku set of characters that
cannot begin or end a line of Japanese text.
Layers
Layers collection
object
Read-only. The layers contained in the
document.
LegacyTextItems
LegacyTextItems
Read-only. The text frame items in this story.
MeshItems
MeshItems collection
object
Read-only. The mesh art items contained in
the document.
MojikumiSet
Object
Read-only. A list of names of predefined
Mojikumi sets which specify the spacing for
the layout and composition of Japanese text.
Name
String
Read-only. The document’s name (not the
complete file path to the document).
OutputResolution
Double
The current output resolution for the
document in dots per inch (dpi).
PageItems
PageItems collection
object
Read-only. The PageItems (contains all art item
classes) contained in the document.
PageOrigin
Variant Array of 2
Doubles
The zero-point of the page in the document
without margins, relative to the overall height
and width.
ParagraphStyles
ParagraphStyles
Read-only. The list of paragraph styles in this
document.
Parent
Application object
Read-only. The application that contains this
document.
Path
String
Read-only. The file associated with the
document, which includes the complete path
to the file.
PathItems
PathItems collection
object
Read-only. The PathItems contained in this
document.
Patterns
Patterns collection
object
Read-only. The patterns contained in this
document.
PlacedItems
PlacedItems
collection object
Read-only. The PlacedItems contained in this
document.
PluginItems
PluginItems
collection object
Read-only. The PluginItems contained in this
document.
PrintTiles
Boolean
Read-only. If true, this document should be
tiled when printed.
RasterItems
RasterItems
collection object
Read-only. The raster items contained in this
document.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
101
Property
Value type
What it is
RulerOrigin
Variant Array of 2
Doubles
The zero-point of the rulers in the document
relative to the bottom left of the document.
RulerUnits
AiRulerUnits
Read-only. The default measurement units for
the rulers in the document.
Saved
Boolean
If true, the document has been saved, or the
document has not been changed since the
last time it was saved.
Selection
Variant Array of
objects
The array of references to the objects in this
document’s current selection.
ShowPlacedImages
Boolean
Read-only. If true, placed images should be
displayed in the document.
SplitLongPaths
Boolean
Read-only. If true, long paths should be split
when printing.
Spots
Spots collection
object
Read-only. The SpotColors contained in this
document.
Stationary
Boolean
Read-only. If true, the file is a stationery file.
Stories
Stories
Read-only. The story items in this document.
Swatches
Swatches collection
object
Read-only. The Swatches contained in this
document.
SymbolItems
SymbolItems
collection object
Read-only. The SymbolItems collection
contained in this document.
Symbols
Symbols collection
object
Read-only. The Symbols collection contained
in this document.
Tags
Tags collection
object
Read-only. The tags contained in this
document.
TextFrames
TextFrames
collection object
Read-only. The TextFrames contained in this
document.
TileFullPages
Boolean
Read-only. If true, full pages should be tiled
when printing this document.
UseDefaultScreen
Boolean
Read-only. If true, the printer’s default screen
should be used when printing this document.
Variables
Variables collection
object
Read-only. The Variables collection
contained in this document.
VariablesLocked
Boolean
If true, the Variables in this document are
locked.
Views
Views collection
object
Read-only. The views contained in this
document.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
Property
Value type
What it is
VisibleBounds
Variant Array of 4
Doubles
Read-only. The visible bounds of the
document, including stroke width of any
objects in the illustration.
Width
Double
Read-only. The width of this document,
calculated from the GeometricBounds.
102
Document methods
Method
Returns
What it does
Activate
Nothing
Bring the first window associated with the
document to the front
Nothing
Closes a document
Nothing
Copies the current selection in the document to
the clipboard; the associated document must be
the frontmost document
Nothing
Cuts the current selection in the document to the
clipboard; the associated document must be the
frontmost document
Nothing
Save all PDF presets to a file
Nothing
Exports the document to the specified file using
one of the export file formats
String
Exports the current PDF preset values to the file
String
Exports the current print preset values to the file
Nothing
Exports Variables from this document to a
specified file
Nothing
Load the character styles from the Illustrator file
Nothing
Load the paragraph styles from the Illustrator file
()
Close
([saving as AiSaveOptions])
Copy
()
Cut
()
ExportPDFPreset
(File as a String)
Export
(exportFile as String,
exportFormat as AiExportType,
[options As
ExportOptionsFlash/
ExportOptionsGIF/
ExportOptionsJPEG/
ExportOptionsPhotoshop/
ExportOptionsPNG24/
ExportOptionsPNG8/
ExportOptionsSVG])
ExportPDFPreset
()
ExportPrintPreset
()
ExportVariables
(Filename as String)
ImportCharacterStyles
(FileSpec as String)
ImportParagraphStyles
(FileSpec as String)
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
103
Method
Returns
What it does
ImportPDFPreset
Nothing
Load all PDF presets from a file
Nothing
Load the named print preset from the file
Nothing
Import Variables from 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
Nothing
Saves the document in it current location
Nothing
Saves the document in the specified file as an
Illustrator, EPS, or PDF file
(FileSpec as String
[, ReplacingPreset as Boolean])
ImportPrintPreset
(printPreset as String
FileSpec as String)
ImportVariables(
filename as String)
Paste
()
PrintOut
(options as PrintOptions)
Save
()
SaveAs
([saveIn as String]
[, options As:
EPSSaveOptions/
IllustratorSaveOptions/
PDFSaveOptions])
➤ 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.
doc.Close aiDoNotSaveChanges
Set doc = Nothing
➤ Creating a document with defaults
This example demonstrates how to create a new document with specific default properties.
Dim appRef As New Illustrator.Application
Dim frontDocument As Illustrator.Document
If (appRef.Documents.Count = 0) Then
Set frontDocument = appRef.Documents.Add
Else
Set frontDocument = appRef.Documents(1)
End If
frontDocument.DefaultFilled = True
frontDocument.DefaultStroked = True
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
104
Documents
A collection of documents.
Documents properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
Count
Long
Read-only. The number of objects in the collection.
Parent
Object
Read-only. The parent of this object.
Documents methods
Method
Returns
What it does
Add
Document
object
Creates a new document using
optional parameters and returns a
reference to the new document
Long
Returns the index position of the
object within the collection
Document
object
Returns an object reference to the
object identified by itemKey (name
or index).
([documentColorSpace As AiDocumentColorSpace]
[, width as Double]
[, height as Double])
Index
(item as Document)
Item
(itemKey)
➤ Creating a document with a color space
This examples demonstrates how to create a new document with a specific color space.
Dim appRef As New Illustrator.Application
appRef.Documents.Add aiDocumentRGBColor
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
105
EPSSaveOptions
Options which may be supplied when saving a document as an Illustrator EPS file. EPSSaveOptions can
only be supplied in conjunction with the document SaveAs method. All properties are optional.
EPSSaveOptions properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application
object.
CMYKPostScript
Boolean
If true, CMYK PostScript® should be
used.
Compatibility
AiCompatibility
Illustrator version compatibility for the
EPS file format.
CompatibleGradientPrinting Boolean
If true, a raster item of the gradient or
gradient mesh should be created so
the object can be printed on
PostScript level 2 printers. Default:
false
EmbedAllFonts
Boolean
If true, fonts should be included in the
EPS file.
EmbedLinkedFiles
Boolean
If true, linked image files should be
included in the saved document.
FlattenOuput
AiOutputFlattening
How should transparency be flattened
for file formats older than Illustrator 9
or greater.
IncludeDocumentThumbnails
Boolean
If true, the thumbnail image of the
EPS artwork should be included.
Overprint
AiPDFOverprint
Style of overprinting. Default:
PreservePDFOverprint
PostScript
AiEPSPostScriptLevelEnum
Specifies the PostScript level to use
when saving the file.
Preview
AiEPSPreviewX
Format for the EPS preview image.
➤ Saving to EPS
This example demonstrates how to save the current document as an Illustrator 8-compatible EPS file using
CMYK PostScript with all fonts embedded.
Dim appRef As New Illustrator.Application
Dim newSaveOptions As New Illustrator.EPSSaveOptions
Dim frontDocument As Illustrator.Document
If appRef.Documents.Count > 0 Then
newSaveOptions.CMYKPostScript = True
newSaveOptions.Compatibility = aiIllustrator8
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
newSaveOptions.EmbedAllFonts = True
Set frontDocument = appRef.ActiveDocument
frontDocument.SaveAs "C:\temp\SaveAs.eps", newSaveOptions
End If
106
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
107
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 any file extension in the file specification.
ExportOptionsFlash properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
ArtBoardClipping
Boolean
If true, the exported image should be clipped
to the art board. Default: false
BackgroundColor
RGBColor object
The background color of the exported Flash
frames.
BackgroundLayers
Variant Array of
Layer objects
A list of layers to be included as the static
background of the exported Flash frames.
BlendAnimation
AiBlendAnimationType
How the blend art objects are animated when
exported to Flash frames. Default:
AiNoBlendAnimation
Compressed
boolean
If true, the exported file should be exported
compressed. Default: false
ConvertTextToOutlines
boolean
If true, all text should be converted to outlines.
Default: false
CurveQuality
Long
The amount of curve information that should
be preserved. Range: 0 to 10, Default: 7
ExportStyle
AiFlashExportStyle
The style in which the exported data should be
created in Flash. Default: aiAsFlashFile.
FlattenOutput
AiOutputFlattening
How transparency should be flattened to
preserve appearance or editability on export.
Default: aiPreserveAppearance
FrameRate
Double
The display rate in frames per second; Range:
0.01 to 12.0, Default: 12.0
GenerateHTML
Boolean
If true, the image should be exported as an
HTML file. Default: true
ImageFormat
AiFlashImageFormat
How the image in the exported Flash file
should be compressed. Default: aiLossless
JPEGMethod
AiFlashJPEGMethod
The JPEG method to use. Default: either
aiJPEGStandard or aiJPEGOptimized
JPEGQuality
Long
Level of compression to use. Range: 0 to 10.
Default: 3
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
108
Property
Value type
What it is
LayerOrder
AILayerOrderType
The order in which layers are exported to Flash
frames. Default: AiBottomUp
Looping
Boolean
If true, the Flash file should be set to loop
when run. Default: false
ReadOnly
Boolean
If true, the file should be exported as
read-only. Default: false
Replacing
AiSaveOptions
If a file with the same name already exists,
should it be replaced. Default:
AiPromptToSaveChanges
Resolution
Double
The resolution in pixels per inch. Range: 72 to
2400. Default: 72
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
109
ExportOptionsGIF
Options which 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 any file extension in the file specification.
ExportOptionsGIF properties
Property
Value type
What it is
AntiAliasing
Boolean
If true, the exported image should be anti-aliased.
Default: true
Application
Application object
Read-only. The Illustrator Application object.
ArtBoardClipping
Boolean
If true, the exported image should be clipped to
the art board. Default: false
ColorCount
Long
The number of colors in the exported image’s color
table. Range: 2 to 256. Default: 128
ColorDither
AiColorDitherMethod
The method used to dither colors in the exported
image. Default: aiDiffusionDither
ColorReduction
AiColorReductionMethod
The method used to reduce the number of colors
in the exported image. Default: aiSelective
DitherPercent
Long
How much should the colors of the exported
image be dithered, where 100.0 is 100%
HorizontalScale
Double
The horizontal scaling factor to apply to the
exported image, where 100.0 is 100%. Default:
100.0
InfoLossPercent
Long
The level of information loss allowed during
compression, where 100.0 is 100%. Default: 0%
Interlaced
Boolean
If true, the exported image should be interlaced.
Default: false
Matte
Boolean
If true, the art board should be matted with a
color. Default: true
MatteColor
RGBColor object
The color to use when matting the art board.
Default: white
SaveAsHTML
Boolean
If true, the exported image should be saved with
an accompanying HTML file. Default: false
Transparency
Boolean
If true, the exported image should use
transparency. Default: true
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
110
Property
Value type
What it is
VerticalScale
Double
The vertical scaling factor to apply 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
This example demonstrates how to export the current document as a GIF.
Dim appRef As New Illustrator.Application
Dim gifExportOptions As New Illustrator.ExportOptionsGIF
Dim docRef As Illustrator.Document
If appRef.Documents.Count > 0 Then
gifExportOptions.AntiAliasing = False
gifExportOptions.ColorCount = 64
gifExportOptions.ColorDither = aiDiffusion
Set docRef = appRef.ActiveDocument
docRef.Export "C:\temp\AiExport.gif", aiGIF, gifExportOptions
End If
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
111
ExportOptionsJPEG
Options which 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 any file extension in the file specification.
ExportOptionsJPEG
Property
Value type
What it is
AntiAliasing
Boolean
If true, the exported image should be anti-aliased.
Default: true
Application
Application object
Read-only. The Illustrator Application object.
ArtBoardClipping
Boolean
If true, the exported image should be clipped to the
art board.
BlurAmount
Double
The amount of blur to apply to the exported image.
Range: 0.0 to 2.0. Default: 0.0
HorizontalScale
Double
The horizontal scaling factor to apply to the exported
image, where 100.0 is 100%. Default: 100.0
Matte
Boolean
If true, the art board should be matted with a color.
Default: true
MatteColor
RGBColor object
The color to use when matting the art board. Default:
white
Optimization
Boolean
If true, the exported image should be optimized for
web viewing. Default: true
QualitySetting
Long
The quality of the exported image. Range: 0 to 100.
Default: 30
SaveAsHTML
Boolean
If true, the exported image should be saved with an
accompanying HTML file. Default: false
VerticalScale
Double
The vertical scaling factor to apply to the exported
image, where 100.0 is 100%. Default: 100.0
➤ Exporting to JPEG
This example demonstrates how to export the current document as a JPEG with specific options.
Dim appRef As New Illustrator.Application
Dim jpegExportOptions As New Illustrator.ExportOptionsJPEG
Dim docRef As Illustrator.Document
If appRef.Documents.Count > 0 Then
jpegExportOptions.AntiAliasing = False
jpegExportOptions.QualitySetting = 70
Set docRef = appRef.ActiveDocument
docRef.Export "C:\temp\AiExport.jpg", aiJPEG, jpegExportOptions
End If
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
112
ExportOptionsPhotoshop
Options which 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 any file extension in the file specification.
ExportOptionsPhotoshop properties
Property
Value type
What it is
AntiAliasing
Boolean
If true, the exported image should be
anti-aliased. Default: true
Application
Application object
Read-only. The Illustrator Application object.
Compatibility
AiPhotoshopCompatibility
Which Photoshop file format to create.
Default: Photoshop8
EditableText
Boolean
If true, text objects should be exported as
editable text layers. Default: true
EmbedICCProfile
Boolean
If true, an ICC profile should be embedded in
the exported file. Default: false
ImageColorSpace
AiImageColorSpace
The color space of the exported file
MaximumEditability
Boolean
If true, preserve as much of the original
document’s structure as possible when
exporting. Default: true
Resolution
Double
The resolution of the exported file in dots per
inch. Range: 72 to 2400. Default: 150
Warnings
Boolean
If true, a warning dialog should be displayed
because of conflicts in the export settings.
Default: true
WriteLayers
Boolean
If true, the document layers should be
preserved in the exported file. Default: true
➤ Exporting to Photoshop
This example exports the current document as a Photoshop 5 file with layers.
Dim appRef As New Illustrator.Application
Dim psdExportOptions As New Illustrator.ExportOptionsPhotoshop
Dim docRef As Illustrator.Document
If appRef.Documents.Count > 0 Then
psdExportOptions.Resolution = 150
Set docRef = appRef.ActiveDocument
docRef.Export "C:\temp\AiExport.psd", aiPhotoshop, psdExportOptions
End If
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
113
ExportOptionsPNG8
Options which 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 any file extension in the file specification.
ExportOptionsPNG8 properties
Property
Value type
What it is
AntiAliasing
Boolean
If true, the exported image should be anti-aliased.
Default: true
Application
Application object
Read-only. The Illustrator Application object.
ArtBoardClipping Boolean
If true, the exported image should be clipped to the
art board. Default: false
ColorCount
Long
The number of colors in the exported image’s color
table. Range: 2 to 256. Default: 128
ColorDither
AiColorDitherMethod
The method used to dither colors in the exported
image. Default: aiDiffusionDither
ColorReduction
AiColorReductionMethod
The method used to reduce the number of colors in
the exported image. Default: aiSelective
DitherPercent
Long
Specifies how much the colors of the exported image
should be dithered, where 100.0 is 100%
HorizontalScale
Double
The horizontal scaling factor to apply to the exported
image, where 100.0 is 100%. Default: 100.0
Interlaced
Boolean
If true, the exported image should be interlaced.
Default: false
Matte
Boolean
If true, the art board should be matted with a color.
Default: true
MatteColor
RGBColor object
The color to use when matting the art board. Default:
white
SaveAsHTML
Boolean
If true, the exported image should be saved with an
accompanying HTML file. Default: false
Transparency
Boolean
If true, the exported image should use transparency.
Default: true
VerticalScale
Double
The vertical scaling factor to apply to the exported
image, where 100.0 is 100%. Default: 100.0
WebSnap
Long
Specifies how much the color table should be
changed to match the Web palette, where 100 is
maximum. Default: 0
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
➤ Exporting to PNG8
This example exports the current document as a PNG8 file.
Dim appRef As New Illustrator.Application
Dim png8ExportOptions As New Illustrator.ExportOptionsPNG8
Dim docRef As Illustrator.Document
If appRef.Documents.Count > 0 Then
png8ExportOptions.AntiAliasing = False
png8ExportOptions.Interlaced = True
Set docRef = appRef.ActiveDocument
docRef.Export "C:\temp\AiExport.png", aiPNG8, png8ExportOptions
End If
114
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
115
ExportOptionsPNG24
Options which 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 any file extension in the file specification.
ExportOptionsPNG24 properties
Property
Value type
What it is
AntiAliasing
Boolean
If true, the exported image should be anti-aliased.
Default: true
Application
Application object
Read-only. The Illustrator Application object.
ArtBoardClipping
Boolean
If true, the exported image should be clipped to the art
board. Default: false
HorizontalScale
Double
The horizontal scaling factor to apply to the exported
image, where 100.0 is 100%. Default: 100.0
Matte
Boolean
If true, the art board should be matted with a color.
Default: true
MatteColor
RGBColor object
The color to use when matting the art board. Default:
white
SaveAsHTML
Boolean
If true, the exported image should be saved with an
accompanying HTML file. Default: false
Transparency
Boolean
If true, the exported image should use transparency.
Default: true
VerticalScale
Double
The vertical scaling factor to apply to the exported
image, where 100.0 is 100%. Default: 100.0
➤ Exporting to PNG24
This example exports the current document as a PNG24 file with specific options.
Dim appRef As New Illustrator.Application
Dim png24ExportOptions As New Illustrator.ExportOptionsPNG24
Dim docRef As Illustrator.Document
If appRef.Documents.Count > 0 Then
png24ExportOptions.AntiAliasing = False
png24ExportOptions.Transparency = False
Set docRef = appRef.ActiveDocument
docRef.Export "C:\temp\AiExport.png", aiPNG24, png24ExportOptions
End If
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
116
ExportOptionsSVG
Options which 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 any file extension in the file specification.
ExportOptionsSVG properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator
Application object.
Compressed
Boolean
If true, the exported file should be
compressed. Default is false
CoordinatePrecision
Long
The decimal precision for element
coordinate values. Range: 1 to 7.
Default: 3
CSSProperties
AiSVGCSSPropertyLocation
Specifies how the CSS properties of
the document should be included in
the exported file
DocumentEncoding
AiSVGDocumentEncoding
Specifies how the text in the
document should be encoded
DTD
AiSVGDTDVersion
The SVG version to which the file
should conform. Default: aiSVG1_1
EmbedRasterImages
Boolean
If true, all raster images contained in
the document should be embedded
in the saved file
FontSubsetting
AiSVGFontSubsetting
Specifies which font glyphs should
be included in the export file
FontType
AiSVGFontType
The type of font to included in the
exported file. Default: aiCEFFont
IncludeFileInfo
Boolean
If true, the XMP (Extensible
Metadata Platform) metadata
should be included in the output
file. Default: false
IncludeVariablesAndDatasets
Boolean
If true, Variables and Datasets
should be included. Default: false
OptimizeForSVGViewer
Boolean
If true, the Adobe namespace
should be included. Default: false
PreserveEditability
Boolean
If true, preserve Illustrator editing
capability when exporting the
document. Default: false
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
117
Property
Value type
What it is
Slices
Boolean
If true, preserve slice data in
exported document. Default: false
SVGAutoKerning
Boolean
If true, SVG automatic kerning is
allowed in the file. Default: false
SVGTextOnPath
Boolean
If true, the SVG text-on-path
construct is allowed in the file.
Default: false
➤ Exporting to SVG
This example exports the current document as a SVG file.
Dim appRef As New Illustrator.Application
Dim svgExportOptions As New Illustrator.ExportOptionsSVG
Dim docRef As Illustrator.Document
If appRef.Documents.Count > 0 Then
svgExportOptions.EmbedRasterImages = True
svgExportOptions.FontSubsettings = aiAllGlyphs
Set docRef = appRef.ActiveDocument
docRef.Export "C:\temp\AiExport.svg", aiSVG, svgExportOptions
End If
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
Gradient
A gradient definition contained in a document. A script can create new gradients.
Gradient properties
Property
Value type
What it is
Application
Application
object
Read-only. The Illustrator Application object.
GradientStops
GradientStops
collection object
Read-only. The gradient stops contained in this gradient.
Name
String
The gradient’s name.
Parent
Document object
Read-only. The document that contains this gradient.
Type
AiGradientType
The kind of the gradient, either radial or linear.
Gradient methods
Method
Returns
What it does
Delete
Nothing
Deletes the object.
()
➤ Creating and applying a gradient
This example shows how you can create a new gradient and apply it as a fill pattern to the frontmost
PathItem.
Dim
Dim
Dim
Dim
Set
appRef As New Illustrator.Application
frontDocument As Illustrator.Document
newGradient As Illustrator.Gradient
locationSpecification As Illustrator.GradientStop
frontDocument = appRef.ActiveDocument
'Create a color for both ends of the gradient
Dim startColor As New Illustrator.RGBColor
Dim endColor As New Illustrator.RGBColor
startColor.Red = 0
startColor.Green = 100
startColor.Blue = 255
endColor.Red = 220
endColor.Green = 0
endColor.Blue = 100
'Create a new gradient
'A new gradient always have 2 stops
Set newGradient = frontDocument.Gradients.Add
newGradient.Name = "Gradient created from script"
newGradient.Type = aiLinearGradient
'Modify the first gradient stop.
118
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
Set locationSpecification = newGradient.GradientStops(1)
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
Dim ColorOfGradient As New Illustrator.GradientColor
ColorOfGradient.Gradient = newGradient
'now get the frontmost path item and
'apply the new gradient as its fill
Dim topPath As Illustrator.PathItem
Set topPath = frontDocument.PathItems(1)
topPath.Filled = True
topPath.fillColor = ColorOfGradient
119
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
120
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
The gradient vector angle in degrees.
Application
Application object
Read-only. The Illustrator Application object.
Gradient
Gradient object
Reference to the object defining the gradient.
HiliteAngle
Double
The gradient hilite vector angle in degrees.
HiliteLength
Double
The gradient hilite vector length.
Length
Double
The gradient vector length.
Matrix
Matrix object
An additional transformation matrix to manipulate the
gradient path.
Origin
Variant Array of 2
Doubles
The gradient vector origin.
➤ Changing a gradient color
The following script obtains the gradient called “Black, White Radial” from the current document and
changes the color of the first gradient stop. The Gradient “Black, White Radial” is one of the default
gradients that appear when you create a new Illustrator document.
Dim
Dim
Dim
Set
appRef As New
frontDocument
firstGradient
frontDocument
Illustrator.Application
As Illustrator.Document
As Illustrator.Gradient
= appRef.ActiveDocument
'Get a reference to the gradient that you want to delete
Set firstGradient = frontDocument.Gradients("White, Black Radial")
'Create the new color
Dim startColor As New Illustrator.RGBColor
startColor.Red = 255
startColor.Green = 238
startColor.Blue = 98
firstGradient.GradientStops(1).Color = startColor
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
Gradients
A collection of Gradient objects in a document.
Gradients properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
Count
Long
Read-only. The number of objects in the collection.
Parent
Document object
Read-only. The parent document of this object.
Gradients methods
Method
Returns
What it does
Add
Gradient object
Creates a new object
Long
Returns the index position of the object within the
collection.
Gradient object
Returns an object reference to the object identified by
itemKey (name or index).
Nothing
Deletes all objects in this collection.
()
Index
(item as Gradient)
Item
(itemKey)
RemoveAll
()
➤ Removing a gradient
This example illustrates how you can remove a gradient from a document.
Dim
Dim
Dim
Set
appRef As New Illustrator.Application
frontDocument As Illustrator.Document
gradientToDelete As Illustrator.Gradient
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
121
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
122
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 object
Read-only. The Illustrator Application object.
Color
Color object
The color linked to this gradient stop.
Midpoint
Double
The distance between two GradientStops, in percentage.
Range: 13.0 to 87.0
Parent
Document object
Read-only. The document that contains this gradient stop.
RampPoint
Double
The location of the color in the blend. Range: 0.0 to 100.0,
where 100.0 is 100%
GradientStop methods
Method
Returns
What it does
Delete
Nothing
Deletes the object.
()
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
123
GradientStops
A collection of GradientStop objects in a specific gradient.
GradientStops properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
Count
Long
Read-only. The number of objects in the collection.
Parent
Document object
Read-only. The document that contains this object.
GradientStops methods
Method
Returns
What it does
Add
GradientStop
object
Creates a new object
Long
Returns the index position of the object within the
collection.
GradientStops
object
Returns an object reference to the object identified by
itemKey (name or index).
Nothing
Deletes all objects in this collection.
()
Index
(item as GradientStop)
Item
(itemKey)
RemoveAll
()
➤ Adding a new gradient stop
This example illustrates how to add a new gradient stop to an existing gradient.
Dim
Dim
Dim
Dim
Dim
Set
appRef As New Illustrator.Application
frontDocument As Illustrator.Document
changeGradient As Illustrator.Gradient
lastStop As Illustrator.GradientStop
newStop As Illustrator.GradientStop
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
Dim originalCount As Integer
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
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
'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%
Dim newStopColor As New Illustrator.GrayColor
newStopColor.Gray = 70
newStop.Color = newStopColor
124
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
125
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 object
Read-only. The Illustrator Application object.
Name
String
The GraphicStyle name.
Parent
Document object
Read-only. The document that contains this object.
GraphicStyle methods
Method
Returns
What it does
ApplyTo
Nothing
Applies the GraphicStyle to a specific art item.
Nothing
Deletes the object.
(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.
Dim
Dim
Dim
Dim
Dim
Dim
appRef As New Illustrator.Application
newGroup As Illustrator.GroupItem
dupItem As Object
artItem As Object
i As Integer
endIndex As Integer
If appRef.Documents.Count > 0 Then
If Not IsEmpty(appRef.ActiveDocument.selection) Then
endIndex = UBound(appRef.ActiveDocument.selection)
Set newGroup = appRef.ActiveDocument.GroupItems.Add
For i = 0 To endIndex
Set artItem = appRef.ActiveDocument.selection(i)
Set dupItem = artItem.Duplicate(newGroup, aiPlaceAtEnd)
appRef.ActiveDocument.GraphicStyles(2).ApplyTo dupItem
Next
End If
End If
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
GraphicStyles
A collection of graphic styles in a document.
GraphicStyles properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
Count
Long
Read-only. The number of objects in the collection.
Parent
Document object
Read-only. The document that contains this object.
GraphicStyles methods
Method
Returns
What it does
Index
Long
Returns the index position of the object within the
collection.
GraphicStyle
object
Returns an object reference to the object identified by
itemKey (name or index).
Nothing
Deletes all objects in this collection.
(item as GraphicStyle)
Item
(itemKey)
RemoveAll
()
➤ Counting graphic styles
This script displays the total number of available graphic styles in the current document.
Dim appRef As New Illustrator.Application
Dim numStyles As Integer
If appRef.Documents.Count > 0 Then
numStyles = appRef.ActiveDocument.GraphicStyles.Count
MsgBox ("There are " & numStyles & " graphic styles in document.")
End If
126
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
127
GraphItem
A graph artwork item. Scripts cannot create new graph items.
GraphItem properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
ArtworkKnockout
AiKnockoutState
Is this GraphItem used to create a knockout, and if
so, what kind.
BlendingMode
AiBlendModes
The mode used when compositing an object.
ContentVariable
Variable 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.
ControlBounds
Variant Array of 4
Doubles
Read-only. The bounds of the object including
stroke width and controls.
Editable
Boolean
Read-only. If true, the GraphItem is editable.
GeometricBounds
Variant Array of 4
Doubles
Read-only. The bounds of the GraphItem excluding
stroke width.
Height
Double
The height of the GraphItem, calculated on the
GeometricBounds.
Hidden
Boolean
If true, this GraphItem is hidden.
IsIsolated
Boolean
If true, this GraphItem is isolated.
Layer
Layer object
Read-only. The Layer to which this GraphItem
belongs.
Left
Double
The left position of the GraphItem.
Locked
Boolean
If true, this GraphItem is locked.
Name
String
The name of this GraphItem.
Opacity
Double
The opacity of the GraphItem. Range: 0.0 to 100.0
Parent
Layer object or
GroupItem object
Read-only. The parent of this GraphItem.
Position
Variant Array of 2
Doubles
The position of the top left corner of the
GraphItem.
Selected
Boolean
If true, this GraphItem is selected.
Sliced
Boolean
If true, this GraphItem is sliced.
Default: false
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
128
Property
Value type
What it is
Tags
Tags object
Read-only. The collection of Tags contained in this
GraphItem.
Top
Double
The top position of the GraphItem.
URL
String
The value of the Adobe URL tag assigned to this
GraphItem.
VisibilityVariable
Variable
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 AiVisibility.
VisibleBounds
Variant Array of 4
Doubles
Read-only. The visible bounds of the GraphItem
including stroke width.
Width
Double
The width of the GraphItem, based on the
GeometricBounds.
WrapInside
Boolean
If true, the text frame object should be wrapped
inside this object.
WrapOffset
Double
The offset to use when wrapping text around this
object.
Wrapped
Boolean
If true, wrap text frame objects around this object
(text frame must be above the object).
ZOrderPosition
Long
Read-only. The position of this GraphItem within
the stacking order of the GroupItem or Layer
(Parent) that contains the GraphItem.
GraphItem methods
Method
Returns
What it does
Copy
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.
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.
()
Cut
()
Delete
()
Duplicate
([relativeObject as Object],
[insertionLocation as AiElementPlacement])
Move
(relativeObject as Object,
insertionLocation as AiElementPlacement)
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
129
Method
Returns
What it does
Resize
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.
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 position in
the stacking order of the group or layer
(Parent) of this object.
(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])
Translate
([deltaX as Double]
[, deltaY as Double]
[, transformObjects as Boolean]
[, transformFillPatterns as Boolean]
[, transformFillGradients as Boolean]
[, transformStrokePatterns as Boolean])
ZOrder
(zOrderCmd as AiZOrderMethod)
➤ Rotating graph items
' Rotate each GraphItem in the current document 90 degrees.
Dim appRef As New Illustrator.Application
Dim ok As Boolean
ok = True
' verify a document with graph item is open
If (appRef.Documents.Count < 1) Then
ok = False
ElseIf (appRef.ActiveDocument.GraphItems.Count < 1) Then
ok = False
End If
If (ok = False) Then
MsgBox "Open a document with graph items before running this sample."
Exit Sub
End If
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
' Rotate each graph item 90 degrees
Dim graphRef As Illustrator.graphItem
For Each graphRef In appRef.ActiveDocument.GraphItems
graphRef.Rotate 90
Next graphRef
appRef.Redraw
130
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
131
GraphItems
A collection of GraphItem objects.
GraphItems properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
Count
Long
Read-only. The number of objects in the collection.
Parent
Document object
Read-only. The document that contains this object.
GraphItems methods
Method
Returns
What it does
Index
Long
Returns the index position of the object within the collection.
GraphItem
object
Returns an object reference to the object identified by itemKey
(name or index).
Nothing
Deletes all objects in this collection.
(item as GraphItem)
Item
(itemKey)
RemoveAll
()
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
132
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 object
Read-only. The Illustrator Application object.
Gray
Double
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
This example illustrates how to change the color of the first word in the active document to a shade of
gray.
Dim
Dim
Dim
Dim
appRef As New Illustrator.Application
text As Illustrator.TextRange
firstWord As Illustrator.TextRange
textColor As New 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
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
133
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 object
Read-only. The Illustrator Application object.
ArtworkKnockout
AiKnockoutState
Is this object used to create a knockout, and if so,
what kind.
BlendingMode
AiBlendModes
The mode used when compositing an object.
Clipped
Boolean
If true, the GroupItem is clipped to its first
PathItem.
CompoundPathItems
CompoundPathItems
collection object
Read-only. The CompoundPathItems contained in
this GroupItem.
ControlBounds
Variant Array of 4
Doubles
Read-only. The bounds of the object including
stroke width and controls.
Editable
Boolean
Read-only. If true, this GroupItem is editable.
GeometricBounds
Variant Array of 4
Doubles
Read-only. The bounds of the object excluding
stroke width.
GraphItems
GraphItems
collection object
Read-only. The raster items contained in this
GroupItem.
GroupItems
GroupItems
collection object
Read-only. The GroupItems contained in this
GroupItem.
Height
Double
The height of the GroupItem, based on the
GeometricBounds.
Hidden
Boolean
If true, this GroupItem is hidden.
IsIsolated
Boolean
If true, this object is isolated.
Layer
Layer object
Read-only. The layer to which this GroupItem
belongs.
Left
Double
The left position of the GroupItem.
LegacyTextItems
LegacyTextItems
Read-only. The text frame items in this story.
Locked
Boolean
If true, this GroupItem is locked.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
134
Property
Value type
What it is
MeshItems
MeshItems collection
object
Read-only. The MeshItems contained in this
GroupItem.
Name
String
The name of this GroupItem.
Opacity
Double
The opacity of the object. Range: 0.0 to 100.0
PageItems
PageItems collection
object
Read-only. The PageItems contained in this
GroupItem.
Parent
Document object
Read-only. The document that contains this
GroupItem.
PathItems
PathItems collection
object
Read-only. The PathItems contained in this
GroupItem.
PlacedItems
PlacedItems
collection object
Read-only. The PlacedItems contained in this
GroupItem.
PluginItems
PluginItems
collection object
Read-only. The PluginItems contained in this
GroupItem.
Position
Variant Array of 2
Doubles
The position of the top left corner of the
GroupItem.
RasterItems
RasterItem
Read-only. The RasterItems contained in this
GroupItem.
Selected
Boolean
If true, this GroupItem is selected.
Sliced
Boolean
If true, this GroupItem is sliced. Default: false
SymbolItems
SymbolItems object
Read-only. The SymbolItems contained in this
GroupItem.
Tags
Tags collection
object
Read-only. The tags contained in this GroupItem.
TextFrames
TextFrames
collection object
Read-only. The TextFrame objects contained in this
GroupItem.
Top
Double
The top position of the GroupItem.
URL
String
The value of the Adobe URL tag assigned to this
GroupItem.
VisibilityVariable
Variable
The Variable bound to this GroupItem.
VisibleBounds
Variant Array of 4
Doubles
Read-only. The visible bounds of the GroupItem
including stroke width.
Width
Double
The width of the GroupItem, based on the
GeometricBounds.
WrapInside
Boolean
If true, the text frame object should be wrapped
inside this object.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
135
Property
Value type
What it is
WrapOffset
Double
The offset to use when wrapping text around this
object.
Wrapped
Boolean
If true, wrap text frame objects around this object
(text frame must be above the object).
ZOrderPosition
Long
Read-only. The position of this group item within
the stacking order of the group or layer (Parent)
that contains this group item.
GroupItem methods
Method
Returns
What it does
Copy
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.
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%
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.
()
Cut
()
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])
Rotate
(angle as Double,
[, changePositions as Boolean]
[, changeFillPatterns as Boolean]
[, changeFillGradients as Boolean]
[, changeStrokePattern as Boolean]
[, rotateAbout as AiTransformation])
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
136
Method
Returns
What it does
Transform
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.
(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)
➤ 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.
Dim appRef As New Illustrator.Application
Dim triangleGroup As Illustrator.GroupItem
'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
Dim trianglePath As Illustrator.PathItem
Dim captionText As Illustrator.TextFrame
Set trianglePath = triangleGroup.PathItems.Add
trianglePath.SetEntirePath Array(Array(100, 100), Array(300, 100), _
Array(200, Math.Tan(1.0471975) * 100 + 100))
Set captionText = triangleGroup.TextFrames.Add
captionText.Position = Array(100, 100)
captionText.Contents = "A triangle"
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
137
GroupItems
A collection of GroupItem objects.
GroupItems properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
Count
Long
Read-only. The number of objects in the collection.
Parent
Document Object
Read-only. The document that contains this object.
GroupItems methods
Method
Returns
What it does
Add
GroupItem
object
Creates a new object
GroupItem
object
Creates a GroupItem from a vector graphics file.
Long
Returns the index position of the object within the
collection.
GroupItem
Returns an object reference to the object identified by
itemkey (name or index).
Nothing
Deletes all objects in this collection.
()
CreateFromFile
(imagefile as String)
Index
(item as GroupItem)
Item
(itemkey)
RemoveAll
()
➤ Importing a PDF using GroupItems
The following script shows how you can import an Adobe PDF 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:\testPDF.pdf.
Dim appRef As New Illustrator.Application
Dim importedGroup As Illustrator.GroupItem
Set importedGroup = appRef.ActiveDocument.GroupItems.CreateFromFile _
("C:\temp\Sample.jpg")
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
138
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 object
Read-only. The Illustrator Application object.
Compatibility
AiCompatibility
Version of the Illustrator file format to create.
Compressed
Boolean
If true, the saved file should be compressed. Default:
true (version 10 or later).
EmbedICCProfile
Boolean
If true, an ICC profile should be embedded in the
saved file.
EmbedLinkedFiles
Boolean
If true, linked image files should be included in the
saved document (only valid for SaveOptions that
specify an Illustrator compatibility of version 7 or
later).
FlattenOutput
AiOutputFlattening
Specifies how transparency should be flattened for
file formats older than Illustrator 9.
FontSubsetThreshold
Double
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).
Overprint
AiPDFOverprint
The overprinting style. Default:
PreservePDFOverprint
PDFCompatible
Boolean
If true, save as a PDF compatible file (version 10 or
later). Default: true
➤ 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 to convert opacity by breaking paths
up in to sub-path to preserve the appearance of the illustration.
Dim appRef As New Illustrator.Application
Dim saveOptions As New Illustrator.IllustratorSaveOptions
saveOptions.Compatibility = aiIllustrator8
saveOptions.FlattenOutput = aiPreserveAppearance
appRef.Documents(1).SaveAs "C:\temp\Ai8SaveAs.ai", saveOptions
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
Ink
Provides information about the ink name and related information.
Ink properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
InkInfo
InkInfo object
The ink information.
Name
String
The ink’s name.
InkInfo
Specifies ink properties.
InkInfo properties
Property
Value type
What it is
Angle
Double
The ink’s screen angle in degrees.
Application
Application
Read-only. The Illustrator Application object.
CustomColor
Object
The color of the custom ink.
Density
Double
The neutral density. Minimum: 0.0
DotShape
String
The dot shape name.
Frequency
Double
The ink’s frequency. Minimum: 0.0
Kind
AiInkType
The ink type.
PrintingStatus
AiInkPrintStatus
The ink printing status.
Trapping
AiTrappingType
The trapping type.
TrappingOrder
Long
The order of trapping for the ink. Minimum: 1
➤ List inks in a document
' Assemble and display a string of the inks in this document
Dim appRef As New Illustrator.Application
Dim docRef As Illustrator.Document
' create a new document and simple text frame
Set docRef = appRef.Documents.Add()
Dim textRef As Illustrator.TextFrame
Set textRef = docRef.TextFrames.Add()
textRef.Top = docRef.Height - 100
textRef.Left = 100
139
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
' Collect data from each Ink and InkInfo object
Dim sInks As String
Dim inkRef
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 inkRef
textRef.Contents = sInks
appRef.Redraw
140
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
141
InsertionPoint
A location between characters, used to insert new text objects. This is a TextRange object in which
characterOffset indicates the location of the insertion point and length is 0. This subclass does not
define any additional properties.
InsertionPoints
A collection of InsertionPoint objects.
InsertionPoints properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
Count
Long
Read-only. Number of elements in the collection.
Parent
TextFrame object
Read-only. The object’s container.
InsertionPoints methods
Method
Returns
What it does
Index
Long
Returns the index position of the object within the
collection.
InsertionPoint
Gets an element from the collection by itemKey (name
or index).
(itemPtr as TextRange)
Item
(itemKey)
➤ Using insertion point to add spaces
' Create a new document and add a simple text frame
' Use insertion points to add spaces between all characters
Dim appRef As New Illustrator.Application
Dim docRef As Illustrator.Document
' create a new document and simple text frame
Set docRef = appRef.Documents.Add()
Dim textRef As Illustrator.TextFrame
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
MsgBox "Use insertion points to add a space between all letters."
Dim i As Integer
i = 2
Do While (i < textRef.InsertionPoints.Count)
textRef.InsertionPoints(i).Characters.Add (" ")
Adobe Illustrator CS2
Visual Basic Scripting Reference
i = i + 2
Loop
Visual Basic Object Reference
142
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
LabColor
A color specification in the CIE Lab color space, used where a color object is required.
LabColor properties
7
Property
Value type
What it is
A
double
The a (red-green) color value. Range -128.0–128.0. Default: 0.0
B
double
The b (yellow-blue) color value. Range -128.0–128.0. Default: 0.0
L
double
The l (lightness) color value. Range -128.0–128.0. Default: 0.0
Name
string
Read-only. The class name of the referenced object.
143
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
144
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 object or as elements of the Document object. Only those page items in
that layer can be accessed through the Layer object. To see page items in different layers, access them
through the document.
Layer properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
ArtworkKnockout
AiKnockoutState
Is this Layer used to create a knockout, and if so, what
kind.
BlendingMode
AiBlendModes
The mode used when compositing an object.
Color
RGBColor object
The Layer’s selection mark color.
CompoundPathItems
CompoundPathItems
collection object
Read-only. The CompoundPathItems contained in this
layer.
DimPlacedImages
Boolean
If true, placed images are to be rendered as dimmed in
this layer.
GraphItems
GraphItems
collection object
Read-only. The GraphItems collection contained in this
layer.
GroupItems
GroupItems
collection object
Read-only. The GroupItems contained in this layer.
HasSelectedArtwork Boolean
If true, an object in this Layer has been selected; setting
this property to false deselects all objects in the layer.
IsIsolated
Boolean
If true, this Layer is isolated.
Layers
Layers collection
object
Read-only. The Layers contained in this layer.
LegacyTextItems
LegacyTextItems
Read-only. LegacyTextItems contained in this layer.
Locked
Boolean
If true, this layer is editable.
MeshItems
MeshItems
collection object
Read-only. The MeshItems contained in this layer.
Name
String
The name of this layer.
Opacity
Double
The opacity of the layer. Range: 0.0 to 100.0
PageItems
PageItems
collection object
Read-only. The PageItems contained in this layer.
Parent
Document object or
Layer Object
Read-only. The document or Layer that contains this layer.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
145
Property
Value type
What it is
PathItems
PathItems
collection object
Read-only. The PathItems contained in this layer.
PlacedItems
PlacedItems
collection object
Read-only. The PlacedItems contained in this layer.
PluginItems
PluginItems
collection object
Read-only. The PluginItems contained in this layer.
Preview
Boolean
If true, this layer should be displayed using preview
mode.
Printable
Boolean
If true, this layer should be printed when printing the
document.
RasterItems
RasterItems
collection object
Read-only. The RasterItems contained in this layer.
Sliced
Boolean
If true, this layer is sliced.
SymbolItems
SymbolItems
collection object
Read-only. The SymbolItems contained in this layer.
TextFrames
TextFrameItems
collection object
Read-only. The TextFrames contained in this layer.
Visible
Boolean
If true, this layer is visible.
ZOrderPosition
Long
Read-only. The position of this layer within the stacking
order of Layers in the document
Layer methods
Method
Returns
What it does
Delete
Nothing
Deletes the object.
Nothing
Moves the art item, specifying the new
location and position.
()
Move
(relativeObject as Object,
insertionLocation as AiElementPlacement)
Paste
Does not change the position of the
object on the art board, but changes the
order in which Illustrator draws the
objects, and the containment hierarchy.
Places the object in the specified
container, behind all other such objects.
Nothing
Pastes the contents of the clipboard into
the Layer; if the associated document is
the frontmost then all pasted objects
remain selected after the paste.
Nothing
Arranges the Layer’s position in the
stacking order of Layers in this document
()
ZOrder
(zOrderCmd as AiZOrderMethod)
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
➤ Count layers in a document
Dim
Dim
Dim
Dim
appRef As New Illustrator.Application
frontDocument As Illustrator.Document
bottomLayer As Illustrator.Layer
countOfLayers As Integer
' Get a reference to the layers, and obtain the total number
Set frontDocument = appRef.ActiveDocument
countOfLayers = frontDocument.Layers.Count
If (frontDocument.Layers.Count < countOfLayers) Then
MsgBox "The frontmost application only has 1 layer"
Exit Sub
End If
146
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
147
Layers
A collection of Layer objects.
Layers properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
Count
Long
Read-only. The number of objects in the collection.
Parent
object
Read-only. The object that contains this Layer (can be another Layer).
Layers methods
Method
Returns
What it does
Add
Layer object
Creates a new object.
Long
Returns the index position of the object within the collection.
Nothing
Deletes all objects in this collection.
()
Index
(item as Layer)
RemoveAll
()
➤ Deleting layers
This example illustrates how to delete all layers whose name starts with the word “Temporary” in all open
documents.
' Remove temporary layers
Dim appRef As New Illustrator.Application
Dim targetDocument As Illustrator.Document
Dim targetLayer As Illustrator.Layer
Dim countOfLayers As Integer
Dim layerIndex As Integer
Dim layerName As String
Dim searchString As String
searchString = "Temporary"
' Loop through all open documents
For Each targetDocument In appRef.Documents
countOfLayers = targetDocument.Layers.Count
' (Go through layers from the back to avoid changing the
' index of unvisited layers when we remove a layer)
For layerIndex = countOfLayers To 1 Step -1
Set targetLayer = targetDocument.Layers(layerIndex)
layerName = targetLayer.Name
If (InStr(layerName, searchString) = 1) Then
targetDocument.Layers.Remove targetLayer
End If
Next layerIndex
Adobe Illustrator CS2
Visual Basic Scripting Reference
Next targetDocument
Visual Basic Object Reference
148
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
149
LegacyTextItem
Unconverted legacy text items in documents from versions prior to Illustrator CS2.
LegacyTextItem properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
ArtworkKnockout
AiKnockoutState
Is this object used to create a knockout, and if so, what
kind.
BlendingMode
AiBlendModes
The mode used when compositing an object.
ControlBounds
Variant Array of 4
Doubles
Read-only. The bounds of the object including stroke
width and controls.
Converted
Boolean
Read-only. If true, the legacy text has been updated to
a native text frame item.
Editable
Boolean
Read-only. If true, this item is editable.
GeometricBounds
Variant Array of 4
Doubles
Read-only. The bounds of the object excluding stroke
width.
Height
Double
The height of the LegacyTextItem excluding stroke
width, based on the GeometricBounds.
Hidden
Boolean
If true, this object is hidden.
IsIsolated
Boolean
If true, this object is isolated.
Layer
Layer object
Read-only. The layer to which this LegacyTextItem
belongs.
Left
Double
The left position of the LegacyTextItem.
Locked
Boolean
If true, this LegacyTextItem is locked.
Name
String
The name of this LegacyTextItem.
Opacity
Double
The opacity of the object. Range: 0.0 to 100.0
Parent
object
Read-only. The object that contains this
LegacyTextItem.
Position
Variant Array of 2
Doubles
The position of the top left corner of the
LegacyTextItem excluding stroke width.
Selected
Boolean
If true, this object is selected.
Sliced
Boolean
If true, this LegacyTextItem is sliced.
Tags
Tags collection
object
Read-only. The tags contained in this LegacyTextItem.
Top
Double
The top position of this LegacyTextItem.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
Property
Value type
What it is
URL
String
The value of the Adobe URL tag assigned to this
LegacyTextItem.
VisibilityVariable Variable
150
The Variable bound to this LegacyTextItem.
VisibleBounds
Variant Array of 4
Doubles
Read-only. The visible bounds of the LegacyTextItem
including stroke width.
Width
Double
The width of the LegacyTextItem excluding stroke
width, based on the GeometricBounds.
WrapInside
Boolean
If true, the text frame object should be wrapped inside
this object.
WrapOffset
Double
The offset to use when wrapping text around this
object.
Wrapped
Boolean
If true, wrap text frame objects around this object (text
frame must be above the object).
ZOrderPosition
Long
Read-only. The position of this art item within the
stacking order of the group or layer (Parent) that
contains the art item.
LegacyTextItem methods
Method
Returns
What it does
ConvertToNative
Boolean
If true, create text frames from all
legacy text items; the original legacy
text items are deleted.
Nothing
Copies the legacy text item to the
clipboard; the associated document
must be the frontmost document.
Nothing
Cuts the legacy text item to the
clipboard; the associated document
must be the frontmost document.
Object
Duplicates the art item, optionally
specifying the location and position
for the copy.
Nothing
Deletes the object.
Nothing
Moves the art item, specifying the
new location and position.
()
Copy
()
Cut
()
Duplicate
([relativeObject as Object],
[insertionLocation as AiElementPlacement])
Delete
()
Move
(relativeObject as Object,
insertionLocation as AiElementPlacement)
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
151
Method
Returns
What it does
Resize
Nothing
Scales the art item where scaleX is
the horizontal scaling factor 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 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.
(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])
Translate
([deltaX as Double]
[, deltaY as Double]
[, transformObjects as Boolean]
[, transformFillPatterns as Boolean]
[, transformFillGradients as Boolean]
[, transformStrokePatterns as Boolean])
ZOrder
(zOrderCmd as AiZOrderMethod)
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
152
LegacyTextItems
A collection of LegacyText items.
LegacyTextItems properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
Count
Long
Read-only. Number of elements in the collection.
Parent
object
Read-only. The object’s container.
LegacyTextItems methods
Method
Returns
What it does
ConvertToNative
Boolean
Create text frames from all legacy text items; the
original legacy text items are deleted. Returns
true if successful.
Long
Returns the index position of the object within the
collection.
LegacyTextItem
Returns an object reference to the object
identified by itemKey (name or index).
Nothing
Deletes all objects in this collection.
()
Index
(itemPtr as LegacyTextItem)
Item
(itemKey)
RemoveAll
()
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
153
Lines
A collection of TextRange objects corresponding to a line of text.
Lines properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
Count
Long
Read-only. Number of elements in the collection.
Parent
object
Read-only. The object’s container.
Lines methods
Method
Returns
What it does
Index
Long
Returns the index position of the object within the
collection.
TextRange
Returns an object reference to the object
identified by itemKey (name or index).
Nothing
Deletes all objects in this collection.
(itemPtr as TextRange)
Item
(itemKey)
RemoveAll
()
➤ Counting lines
' Create an area text item and add some text
' Display the line count, then resize it and display count again
' Create an area text
Dim appRef As New Illustrator.Application
Dim docRef As Illustrator.Document
Set docRef = appRef.Documents.Add()
Dim itemRef As Illustrator.pathItem
Set itemRef = docRef.PathItems.Rectangle(500, 200, 50, 300)
Dim textRef As Illustrator.TextFrame
Set textRef = docRef.TextFrames.AreaText(itemRef)
textRef.Contents = "Scripting with Illustrator is fun and easy."
appRef.Redraw
MsgBox "There are " & CStr(textRef.Lines.Count) & " lines."
' Change the path's width and display line count
itemRef.Width = 300
appRef.Redraw
MsgBox "Now there are " & CStr(textRef.Lines.Count) & " lines."
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
154
Matrix
A transformation matrix specification, used to transform the geometry of objects.
This class is used to define a record which contains the component values of an Illustrator transformation
matrix. It is used for specifying and retrieving matrix information from an Illustrator document or from
PageItems in a document.
Matrices are used in conjunction with the Transform method and as a property of a number of objects. A
matrix specifies how to transform the geometry of an object. You can generate an original matrix using the
application methods getIdentityMatrix, getTranslationMatrix, getScaleMatrix, or
getRotationMatrix.
A Matrix is a record containing the matrix values, not a reference to a matrix object. The matrix
commands listed above operate on the values of a matrix record. If a command modifies a matrix, a
modified matrix record is returned as the result of the command. The original matrix record pass to the
command is not modified.
Matrix properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
MValueA
Double
Matrix property a.
MValueB
Double
Matrix property b.
MValueC
Double
Matrix property c.
MValueD
Double
Matrix property d.
MValueTX
Double
Matrix property tx.
MValueTY
Double
Matrix property ty.
➤ Applying transformations with a matrix
If you need to apply multiple transformations to objects it is more efficient to use the matrix suite than to
apply the transformations one at a time. The following script demonstrates how to combine multiple
matrices together.
Dim appRef As New Illustrator.Application
Dim moveMatrix As Illustrator.Matrix
Dim totalMatrix As Illustrator.Matrix
' Move art half an inch to the right and 1.5 inch up on the page
Set moveMatrix = appRef.GetTranslationMatrix(72# * 0.5, 72# * 1.5)
' Add a rotation to the translation -- 10 degrees counterclockwise
Set totalMatrix = appRef.ConcatenateRotationMatrix(moveMatrix, 10)
' Apply the transformation to all art in the document
Dim artItem As Object
For Each artItem In appRef.ActiveDocument.PageItems
artItem.Transform totalMatrix
Next
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
155
MeshItem
A gradient mesh art item. Mesh items cannot be created from a script, but can be copied and pasted.
MeshItem properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
ArtworkKnockout
AiKnockoutState
Is this object used to create a knockout, and if so, what
kind.
BlendingMode
AiBlendModes
The mode used when compositing an object.
ControlBounds
Variant Array of 4
Doubles
Read-only. The bounds of the object including stroke
width and controls.
Editable
Boolean
Read-only. If true, this MeshItem is editable.
GeometricBounds
Variant Array of 4
Doubles
Read-only. The bounds of the object excluding stroke
width.
Height
Double
The height of the MeshItem, based on the
GeometricBounds.
Hidden
Boolean
If true, this MeshItem is hidden.
IsIsolated
Boolean
If true, this object is isolated.
Layer
Layer object
Read-only. The Layer to which this MeshItem belongs.
Left
Double
The left position of the MeshItem.
Locked
Boolean
If true, this MeshItem is locked.
Name
String
The name of this MeshItem.
Opacity
Double
The opacity of the object. Range 0.0 to 100.0
Parent
object
Read-only. The object that contains this MeshItem.
Position
Variant Array of 2
Doubles
The position of the top left corner of the MeshItem.
Selected
Boolean
If true, this MeshItem is selected.
Sliced
Boolean
If true, this MeshItem is sliced.
Tags
Tags collection
object
Read-only. The tags contained in this MeshItem.
Top
Double
The top position of this MeshItem.
URL
String
The value of the Adobe URL tag assigned to this
MeshItem.
VisibilityVariable Variant
VisibleBounds
Variant Array of 4
Doubles
The Variable bound to this MeshItem.
Read-only. The visible bounds of the MeshItem
including stroke width.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
Property
Value type
What it is
Width
Double
The width of the MeshItem, based on the
GeometricBounds.
WrapInside
Boolean
If true, the text frame object should be wrapped
inside this object.
WrapOffset
Double
The offset to use when wrapping text around this
object.
Wrapped
Boolean
If true, wrap text frame objects around this object
(text frame must be above the object).
ZOrderPosition
Long
Read-only. The position of this art item within the
stacking order of the group or layer (Parent) that
contains the art item.
156
MeshItem methods
Method
Returns
What it does
Copy
Nothing
Copies the mesh item to the
clipboard; the associated document
must be the frontmost document.
Nothing
Cuts the mesh item to the clipboard;
the associated document must be the
frontmost document.
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
Scales the art item where scaleX is
the horizontal scaling factor 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.
()
Cut
()
Delete
()
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])
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
157
Method
Returns
What it does
Transform
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.
(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)
➤ Locking mesh items
This script illustrates how to lock all MeshItems in the active document.
Dim appRef As New Illustrator.Application
Dim meshItem As Illustrator.meshItem
For Each meshItem In appRef.ActiveDocument.MeshItems
meshItem.Locked = True
Next
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
158
MeshItems
A collection of gradient mesh art items.
MeshItems properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
Count
Long
Read-only. Number of elements in the collection.
Parent
object
Read-only. The object’s container.
MeshItems methods
Method
Returns
What it does
Index
Long
Returns the index position of the object within the collection.
MeshItem
Returns an object reference to the object identified by itemKey
(name or index).
Nothing
Deletes all objects in this collection.
(itemPtr as MeshItem)
Item
(itemKey)
RemoveAll
()
➤ Copying mesh items between documents
The following script illustrates how to copy MeshItems from one document to another. To run this script
you need to have two open documents. One document should contain at least one MeshItem, the other
document can be empty. Make the empty document the frontmost before running the script.
Dim
Dim
Dim
Dim
Dim
Dim
Dim
appRef As New Illustrator.Application
sourceDocument As Illustrator.Document
targetDocument As Illustrator.Document
meshItem As Illustrator.meshItem
newMeshItem As Illustrator.meshItem
targetSelection As Variant
locationOffset As Single
Set targetDocument = appRef.Documents(1)
Set sourceDocument = appRef.Documents(2)
locationOffset = 0
For Each meshItem In sourceDocument.MeshItems
sourceDocument.Activate
meshItem.Copy
targetDocument.Activate
targetDocument.Paste
'Get a reference to the item that was just copied into the document
targetSelection = appRef.selection
If (IsEmpty(targetSelection)) Then
MsgBox "Copy/Paste failed"
Exit For
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
End If
Set newMeshItem = targetSelection(0)
newMeshItem.Position = Array(100, 40 + locationOffset)
locationOffset = locationOffset + 50
Next
159
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
160
NoColor
Represents the “none” color. Assignment of a reference to a NoColor object to the document’s default fill
or stroke color, or those of an art item, is equivalent to setting their “Filled” or “Stroked” property to False.
NoColor properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
➤ Removing a fill color
' Create 2 overlapping objects with different fill colors.
' Assign top object a fill color of "NoColor"
' to make the bottom object visible.
Dim
Dim
Set
Dim
Dim
Set
Set
appRef As New Illustrator.Application
docRef As Illustrator.Document
docRef = appRef.Documents.Add()
itemRef1 As Illustrator.PathItem
itemRef2 As Illustrator.PathItem
itemRef1 = docRef.PathItems.Rectangle(500, 200, 200, 100)
itemRef2 = docRef.PathItems.Rectangle(550, 150, 200, 200)
Dim colorRef As New Illustrator.RGBColor
colorRef.Blue = 255
itemRef1.FillColor = colorRef
colorRef.Red = 255
colorRef.Blue = 0
itemRef2.FillColor = colorRef
appRef.Redraw
' Create a nocolor and assign it to the top object
MsgBox "Change red object to NoColor."
Dim noColorRef As New Illustrator.NoColor
itemRef2.FillColor = noColorRef
appRef.Redraw
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
161
OpenOptions
Options to use when opening files in Illustrator.
OpenOptions properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
UpdateLegacyText Boolean
If true, update all text objects for documents saved with legacy
text by Illustrator versions previous to CS. Default: false
➤ Opening a file and updating legacy text
This example opens a file from Illustrator 10 or older, and uses the OpenOptions object to automatically
update any legacy text in the file. This script assumes the file C:\temp\LegacyText.ai exists.
Dim appRef As New Illustrator.Application
Dim docRef As Illustrator.Document
' Open a file with legacy text
Dim optionsRef As New Illustrator.OpenOptions
optionsRef.UpdateLegacyText = True
Set docRef = appRef.Open("C:\temp\LegacyText.ai",_
aiDocumentRGBColor, optionsRef)
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
162
PageItems
A collection of PageItem objects. Provides complete access to all the art items in an Illustrator document
in the following classes:
CompoundPathItem
GraphItem
GroupItem
MeshItem
PathItem
PlacedItem
RasterItem
SymbolItem
TextFrame
You can reference page items through the PageItems property in a Document, Layer, or Group. When
you access an individual item in one of these collections, the reference a page item of one of a particular
type. For example, if you use PageItems to reference a graph item, the typename value of that object is
GraphItem.
PageItems properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
Count
Long
Read-only. Number of elements in the collection.
Parent
Object
Read-only. The object’s container.
PageItems methods
Method
Returns
What it does
Index
Long
Returns the index position of the object within the collection.
Object
Returns an object reference to the object identified by itemKey
(name or index).
Nothing
Deletes all objects in this collection.
(itemPtr as PageItem)
Item
(itemKey)
RemoveAll
()
➤ Getting references to external files
This example illustrates how to obtain all references to external files in the current document. The result is
presented in a new Illustrator document. Before running this, you must open a document that contains
one or more linked images.
Dim
Dim
Dim
Dim
Dim
Dim
appRef As New Illustrator.Application
sourceDocument As Illustrator.Document
artItem As Object
rasterArt As Illustrator.RasterItem
placedArt As Illustrator.PlacedItem
fileReferences(9) As String
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
Dim index As Integer
Set sourceDocument = appRef.ActiveDocument
index = 0
For Each artItem In sourceDocument.PageItems
Select Case TypeName(artItem)
Case Is = "PlacedItem"
fileReferences(index) = artItem.File
index = index + 1
Case Is = "RasterItem"
If (Not artItem.Embedded) Then
fileReferences(index) = artItem.File
index = index + 1
End If
End Select
If index = 10 Then
Exit For
End If
Next
'Write the file references to a new document
Dim reportDocument As Illustrator.Document
Dim fileNameText As Illustrator.TextFrame
Set reportDocument = appRef.Documents.Add
Set fileNameText = reportDocument.TextFrames.Add
fileNameText.Position = Array(50, 520)
fileNameText.Contents = "File references in " &_
sourceDocument.Name & ":"
Dim counter As Integer
For counter = 0 To (index - 1)
Set fileNameText = reportDocument.TextFrames.Add
fileNameText.Position = Array(65, 500 - 20 * counter)
fileNameText.Contents = fileReferences(counter)
Next
➤ Getting page items of particular types
Dim appRef As New Illustrator.Application
Dim artItem As Object
For Each artItem In appRef.ActiveDocument.PageItems
If (TypeName(artItem) = "PlacedItem" Or _
TypeName(artItem) = "RasterItem") Then
artItem.Hidden = True
End If
163
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
Paper
A container for information objects about the paper to be used for printing.
Paper properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
Name
String
The paper name.
PaperInfo
PaperInfo object
The paper information.
PaperInfo
Contains information about the dimensions and imageable area of the paper to be used for printing.
PaperInfo properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
CustomPaper
Boolean
If true, a custom paper is being used.
Height
Double
The paper’s height in points.
ImageableArea
Array of 4 Doubles
The imageable area.
Width
Double
The paper’s width in points.
➤ Using Paper and PaperInfo objects
' Paper and PaperInfo
Dim
Dim
Dim
Dim
Dim
Dim
appRef As New Illustrator.Application
docRef As Illustrator.Document
itemRef As Illustrator.pathItem
textRef As Illustrator.TextFrame
printerRef
sText As String
' Add a new document with some simple artwork
' (Must be a printable artwork for use with Printer object.)
Set docRef = appRef.Documents.Add()
Set itemRef = docRef.PathItems.Rectangle(600, 300, 200, 100)
Set textRef = docRef.TextFrames.Add()
textRef.Top = 600
textRef.Left = 50
' Get paper objects for first printer
Set printerRef = appRef.PrinterList(1)
sText = printerRef.Name
164
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
sText = sText & " paper list:" & vbCrLf
' Display data about available paper types
Dim paperRef
For Each paperRef In printerRef.PrinterInfo.PaperSizes
sText = sText & paperRef.Name & vbCrLf
sText = sText & vbTab & paperRef.PaperInfo.Width
sText = sText & " x " & paperRef.PaperInfo.Height & vbCrLf
Next paperRef
textRef.Contents = sText
appRef.Redraw
165
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
166
ParagraphAttributes
Specifies the properties and attributes of a paragraph contained in a text frame.
Note: Paragraph attributes do not have default values, and are undefined until explicitly set.
ParagraphAttributes properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application
object.
AutoLeadingAmount
Double
Auto leading amount as a percentage.
BunriKinshi
Boolean
If true, BunriKinshi is enabled.
BurasagariType
AiBurasagariTypeEnum
The Burasagari type which specifies
whether punctuation is allowed to fall
outside of the paragraph bounding box
(not available when Kinsoku Shori is set to
None).
DesiredGlyphScaling
Double
Desired glyph scaling expressed as a
percentage.
DesiredLetterSpacing
Double
Desired letter spacing expressed as a
percentage.
DesiredWordSpacing
Double
Desired word spacing expressed as a
percentage.
EveryLineComposer
Boolean
If true, the Every Line Composer is enabled.
FirstLineIndent
Double
First line left indent expressed in points.
HyphenateCapitalizedWords
Boolean
If true, hyphenation is enabled for
capitalized words.
Hyphenation
Boolean
If true, hyphenation is enabled for the
paragraph.
HyphenationPreference
Double
Hyphenation preference scale for better
spacing (0) or fewer hyphens (1)
Range: 0.0 to 1.0
HyphenationZone
Double
Size of the hyphenation zone.
Justification
AiJustification
Paragraph justification.
Kinsoku
String
The name of a Kinsoku Shori set (a set of
characters which cannot be used to begin
or end a line of Japanese text).
KinsokuOrder
AiKinsokuOrderEnum
The preferred Kinsoku order.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
167
Property
Value type
What it is
KurikaeshiMojiShori
Boolean
If true, Kurikaeshi Moji Shori is enabled
(controls how repeated characters are
handled in Japanese text).
LeadingType
AiAutoLeadingType
Specifies the type of auto leading.
LeftIndent
Double
Left indent of margin expressed in points.
MaximumConsecutiveHyphens
Long
Maximum number of consecutive
hyphenated lines.
MaximumGlyphScaling
Double
Maximum glyph scaling expressed as a
percentage.
MaximumLetterSpacing
Double
Maximum letter spacing expressed as a
percentage.
MaximumWordSpacing
Double
Maximum word spacing expressed as a
percentage.
MinimumAfterHyphen
Long
Minimum number of characters after a
hyphen.
MinimumBeforeHyphen
Long
Minimum number of characters before a
hyphen.
MinimumGlyphScaling
Double
Minimum glyph scaling expressed as a
percentage.
MinimumHyphenatedWordSize
Long
Minimum hyphenated word size.
MinimumLetterSpacing
Double
Minimum letter spacing expressed as a
percentage.
MinimumWordSpacing
Double
Minimum word spacing expressed as a
percentage.
Mojikumi
String
The name of a predefined Mojikumi set for
Japanese text composition.
Parent
Object
Read-only. The object’s container.
RightIndent
Double
Right indent of margin expressed in points.
RomanHanging
Boolean
If true, Roman hanging punctuation is
enabled.
SingleWordJustification
AiJustification
Single word justification.
SpaceAfter
Double
Spacing after paragraph in points.
SpaceBefore
Double
Spacing before paragraph in points.
TabStops
Array of TabStopInfo
Tab stop settings, as TabStopInfo objects.
➤ Modifying paragraph attributes
' Add a new document with an area text item
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
' containing 3 paragraphs.
' Use paragraph attributes to adjust the
' justification of each paragraph
Dim
Dim
Dim
Dim
appRef As New Illustrator.Application
docRef As Illustrator.Document
pathRef As Illustrator.PathItem
textRef As Illustrator.TextFrame
' Create 3 new pararagraphs
Set docRef = appRef.Documents.Add()
Set pathRef = docRef.PathItems.Rectangle(600, 200, 200, 400)
Set textRef = docRef.TextFrames.AreaText(pathRef)
textRef.Paragraphs.Add ("Left justified paragraph.")
textRef.Paragraphs.Add ("Center justified paragraph.")
textRef.Paragraphs.Add ("Right justified paragraph.")
textRef.TextRange.CharacterAttributes.Size = 28
' Change the justification of each paragraph
' using the paragraph attributes object
textRef.Paragraphs(1).ParagraphAttributes.Justification = aiRight
textRef.Paragraphs(2).ParagraphAttributes.Justification = aiCenter
textRef.Paragraphs(3).ParagraphAttributes.Justification = aiLeft
168
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
169
Paragraphs
A collection of Paragraph objects.
Paragraphs properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
Count
Long
Read-only. Number of elements in the collection.
Parent
Object
Read-only. The object’s container.
Paragraphs methods
Method
Returns
What it does
Add
TextRange
object
Adds a new paragraph with
specified text contents at the
specified location in the current
document. If location is not
specified, adds the new paragraph
to the containing text frame after
the current text selection or
insertion point.
TextRange
object
Adds a new paragraph with
specified text contents before the
current text selection or insertion
point.
Long
Returns the index position of the
object within the collection.
Object
Returns an object reference to the
object identified by itemKey (name
or index).
Nothing
Deletes all objects in this
collection.
(contents as String
[, relativeObject as TextFrame]
[, insertionLocation as AiElementPlacement])
AddBefore
(contents as String)
Index
(itemPtr as PageItem)
Item
(itemKey)
RemoveAll
()
➤ Counting paragraphs in a document
This script displays the total number of paragraphs contained in all of the TextFrameItems in the
current document.
Dim
Dim
Dim
Dim
appRef As New Illustrator.Application
curTextArt As Illustrator.TextFrame
curTextRange As Illustrator.TextRange
numParagraphs As Integer
If appRef.Documents.Count > 0 Then
numParagraphs = 0
For Each curTextArt In appRef.ActiveDocument.TextFrames
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
Set curTextRange = curTextArt.TextRange
numParagraphs = numParagraphs + curTextRange.Paragraphs.Count
Next
If (numParagraphs > 1) Then
MsgBox ("There are " & numParagraphs & " paragraphs in the doc.")
Else
MsgBox ("There is only one paragraph in the document.")
End If
End If
170
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
171
ParagraphStyle
Associates character and paragraph attributes with a style name. The style object can be used to apply
those attributes to the text in a TextFrame object.
ParagraphStyle properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
CharacterAttributes
CharacterAttributes
Read-only. The character properties for the text
range.
Name
String
The ParagraphStyle’s name.
ParagraphAttributes
ParagraphAttributes
Read-only. The paragraph properties for the text
range.
Parent
Object
Read-only. The object’s container.
ParagraphStyle methods
Method
Returns
What it does
ApplyTo
Nothing
Applies the paragraph style to the text object.
Nothing
Deletes the object.
(textFrame as TextFrame
[, clearingOverrides as Boolean])
Delete
()
➤ Creating and applying a paragraph style
' Create 3 simple paragraphs with different attributes
' Create a ParagraphStyle and apply it to each paragraph
Dim
Dim
Dim
Dim
appRef As New Illustrator.Application
docRef As Illustrator.Document
pathRef As Illustrator.PathItem
textRef As Illustrator.TextFrame
' Create 3 new pararagraphs
Set docRef = appRef.Documents.Add()
Set pathRef = docRef.PathItems.Rectangle(600, 200, 200, 400)
Set textRef = docRef.TextFrames.AreaText(pathRef)
textRef.Paragraphs.Add ("Left justified paragraph.")
textRef.Paragraphs.Add ("Center justified paragraph.")
textRef.Paragraphs.Add ("Right justified paragraph.")
textRef.TextRange.CharacterAttributes.Size = 28
' Change the justification of each paragraph
' using the paragraph attributes object
textRef.Paragraphs(1).ParagraphAttributes.Justification = aiRight
textRef.Paragraphs(2).ParagraphAttributes.Justification = aiCenter
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
textRef.Paragraphs(3).ParagraphAttributes.Justification = aiLeft
' Create a new paragraph style
MsgBox "Creating and applying a paragraph style"
Dim paraStyle As Illustrator.ParagraphStyle
Set paraStyle = docRef.ParagraphStyles.Add("LeftIndent")
' Add some paragraph attributes
paraStyle.ParagraphAttributes.Justification = aiLeft
paraStyle.ParagraphAttributes.FirstLineIndent = 10
Dim pg
For Each pg In textRef.Paragraphs
paraStyle.ApplyTo pg, True
Next pg
appRef.Redraw
172
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
173
ParagraphStyles
A collection of ParagraphStyle objects. See ParagraphStyle for an example.
ParagraphStyles properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
Count
Long
Read-only. Number of elements in the collection.
Parent
Object
Read-only. The object’s container.
ParagraphStyles methods
Method
Returns
What it does
Add
ParagraphStyle
object
Creates a new ParagraphStyle object.
Long
Returns the index position of the object within the
collection.
ParagraphStyle
object
Returns an object reference to the object
identified by itemKey (name or index).
Nothing
Deletes all objects in this collection.
(name as String)
Index
(itemPtr as ParagraphStyle)
Item
(itemKey)
RemoveAll
()
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
174
PathItem
Art items such as those created using the Line, Rectangle, or Pen Tools. A path consists of path points that
define its geometry. The PathItem class give you complete access to paths in Illustrator.
PathItem properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
Area
Double
Read-only. The area of this path in square points. If the
area is negative, the path is wound counterclockwise.
Self-intersecting paths can contain sub-areas that
cancel each other out, which makes this value zero
even though the path has apparent area.
ArtworkKnockout
AiKnockoutState
Is this object used to create a knockout, and if so, what
kind.
BlendingMode
AiBlendModes
The mode used when compositing an object.
Clipping
Boolean
If true, this path is to be used as a clipping path
Closed
Boolean
If true, this path is closed
ControlBounds
Variant Array of 4
Doubles
Read-only. The bounds of the object including stroke
width and controls.
Editable
Boolean
Read-only. If true, this path item is editable.
Evenodd
Boolean
If true, the even-odd rule is used to determine
insideness.
FillColor
Color object
The fill color of the path.
Filled
Boolean
If true, the path should be filled.
FillOverprint
Boolean
If true, the art beneath a filled object should be
overprinted.
GeometricBounds
Variant Array of 4
Doubles
Read-only. The bounds of the object excluding stroke
width.
Guides
Boolean
If true, this path is a guide object.
Height
Double
The height of the path item, based on the
GeometricBounds.
Hidden
Boolean
If true, this path item is hidden.
IsIsolated
Boolean
If true, this object is isolated.
Layer
Layer object
Read-only. The Layer to which this path item belongs.
Left
Double
The left position of the path item.
Locked
Boolean
If true, this path item is locked.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
Property
Value type
What it is
Name
String
The name of this path item.
Note
String
The note text assigned to the path
Opacity
Double
The opacity of the object. Range 0.0 to 100.0
Parent
object
Read-only. The object that contains this path item.
PathPoints
PathPoints
collection object
Read-only. The path points contained in this path
item.
Polarity
AiPolarityValues
The polarity of the path.
Position
Variant Array of 2
Doubles
The position of the top left corner of the path item.
Resolution
Double
The resolution of the path in dots per inch.
Selected
Boolean
If true, this path item is selected.
SelectedPathPoints PathPoints
collection object
175
Read-only. All of the selected path points in the path.
Sliced
Boolean
If true, this path item is sliced.
StrokeCap
AiStrokeCap
The type of line capping.
StrokeColor
Color object
The stroke color for the path.
Stroked
Boolean
If true, the path should be stroked.
StrokeDashes
Variant Array of
Doubles
Dash lengths (set to an empty array for a solid line).
StrokeDashOffset
Double
The default distance into the dash pattern at which
the pattern should be started.
StrokeJoin
AiStrokeJoin
Type of joints for the path.
StrokeMiterLimit
Double
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. A value of 1 specifies a
bevel join. Range: 1 to 500 Default: 4
StrokeOverprint
Boolean
If true, the art beneath a stroked object should be
overprinted.
StrokeWidth
Double
Width of stroke.
Tags
Tags collection
object
Read-only. The tags contained in this path item.
Top
Double
The top position of this path item.
URL
String
The value of the Adobe URL tag assigned to this path
item.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Property
Visual Basic Object Reference
Value type
VisibilityVariable Variant
176
What it is
The Variable bound to this path item.
VisibleBounds
Variant Array of 4
Doubles
Read-only. The visible bounds of the path item
including stroke width.
Width
Double
The width of the path item, based on the
GeometricBounds.
WrapInside
Boolean
If true, the text frame object should be wrapped
inside this object.
WrapOffset
Double
The offset to use when wrapping text around this
object.
Wrapped
Boolean
If true, wrap text frame objects around this object
(text frame must be above the object).
ZOrderPosition
Long
Read-only. The position of this art item within the
stacking order of the group or layer (Parent) that
contains the art item.
PathItem methods
Method
Returns
What it does
Copy
Nothing
Copies the path item to the clipboard;
the associated document must be the
frontmost document.
Nothing
Cuts the path item to the clipboard; the
associated document must be the
frontmost document.
Nothing
Deletes the object.
Object
Duplicates the art item, optionally with
the location and position for the copy.
Nothing
Moves the art item to a new location
and position.
Nothing
Scales the art item where scaleX is the
horizontal scaling factor and scaleY is
the vertical scaling factor; 100.0 = 100%
()
Cut
()
Delete
()
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])
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
177
Method
Returns
What it does
Rotate
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
Sets the path using the specified anchor
points.
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.
(angle as Double,
[, changePositions as Boolean]
[, changeFillPatterns as Boolean]
[, changeFillGradients as Boolean]
[, changeStrokePattern as Boolean]
[, rotateAbout as AiTransformation])
SetEntirePath
(pathSpecification as PathPoints)
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)
➤ Setting attributes of a path
This script sets the stroke color and the fill color of the first path in the frontmost document.
Dim appRef As New Illustrator.Application
Dim frontDocument As Illustrator.Document
Dim firstPath As Illustrator.PathItem
Set frontDocument = appRef.ActiveDocument
Set firstPath = frontDocument.PathItems(1)
firstPath.Filled = True
firstPath.fillColor = frontDocument.Swatches(10).Color
firstPath.Stroked = True
firstPath.StrokeWidth = 5
➤ Setting a path consisting of straight lines
The SetEntirePath method provides an extremely efficient way to create paths that consist of straight
lines. This script illustrates the use of the method.
Dim
Dim
Dim
Dim
Dim
appRef As New Illustrator.Application
frontDocument As Illustrator.Document
newPath As Illustrator.PathItem
lineList(10) As Variant
index As Integer
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
For index = 0 To 10
lineList(index) = Array(index * 10 + 50, (index - 5) ^ 2 * 5 + 50)
Next
Set frontDocument = appRef.ActiveDocument
Set newPath = frontDocument.PathItems.Add
newPath.SetEntirePath(lineList)
178
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
179
PathItems
A collection of PathItem objects. The methods Ellipse, Polygon, Rectangle, RoundedRectangle,
and Star allow you to create complex PathItems using straightforward parameters. Note that
Rectangle, RoundedRectangle, and Ellipse take the Y axis first (Top), then the X axis (Left). If you do
not provide any parameters when calling these methods, default values are used.
PathItems properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
Count
Long
Read-only. Number of elements in the collection.
Parent
Object
Read-only. The object’s container.
PathItems methods
Method
Returns
What it does
Add
PathItem
object
Creates a new PathItem object.
PathItem
object
Creates a new PathItem in the shape of an ellipse
using the supplied parameters.
Long
Returns the index position of the object within
the collection.
PathItem
object
Returns an object reference to the object
identified by itemKey (name or index).
PathItem
object
Creates a new PathItem in the shape of a polygon
using the supplied parameters.
PathItem
object
Creates a new PathItem in the shape of a
rectangle using the supplied parameters.
Nothing
Deletes all objects in this collection.
()
Ellipse
([top as Double]
[, left as Double]
[, width as Double]
[, height as Double]
[, reversed as Boolean]
[, inscribed as Boolean])
Index
(item as PathItem)
Item
(itemKey)
Polygon
([centerX as Double]
[, centerY as Double]
[, radius as Double]
[, sides as Long]
[, reversed as Boolean])
Rectangle
([top as Double]
[, left as Double]
[, width as Double]
[, height as Double]
[, reversed as Boolean])
RemoveAll
()
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
Method
Returns
What it does
RoundedRectangle
PathItem
object
Creates a new PathItem in the shape of a
rectangle with rounded corners using the
supplied parameters.
PathItem
object
Creates a new PathItem in the shape of a star
using the supplied parameters.
([top as Double]
[, left as Double]
[, width as Double]
[, height as Double]
[, horizontalRadius as Double]
[, verticalRadius as Double]
[, reversed as Boolean])
Star
([centerX as Double]
[, centerY as Double]
[, radius as Double]
[, innerRadius as Double]
[, points as Long]
[, reversed as Boolean] )
➤ Creating a rectangle
This script illustrates how to create a new rectangle in the first layer of the frontmost document.
Dim appRef As New Illustrator.Application
Dim frontDocument As Illustrator.Document
Dim newRectangle As Illustrator.PathItem
Set frontDocument = appRef.ActiveDocument
' Create a new rectangle with
' top = 400, left side = 50, witdth = 150 and height = 100
Set newRectangle = frontDocument.PathItems.Rectangle(400,50,150,100)
180
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
181
PathPoint
A point on a specific path. Each path point is made up of an anchor point and a pair of handles, or control
points.
PathPoint properties
Property
Value type
What it is
Anchor
Variant Array of 2
Doubles
The position of the anchor point.
Application
Application object
Read-only. The Illustrator Application object.
LeftDirection
Variant Array of 2
Doubles
The position of this path point’s inward control point.
Parent
object
Read-only. The object that contains this PathPoint
object.
PointType
AiPointType
The type of path point, either a curve or a corner. Any
point can considered a corner point. Setting the type to
a corner forces the left and right direction points to be
on a straight line when the user attempts to modify
them in the user interface.
RightDirection
Variant Array of 2
Doubles
The position of this path point’s outward control point.
Selected
AiPathPointSelection
Are points of this path point selected, and if so, which
ones.
PathPoint methods
Method
Returns
What it does
Delete
Nothing
Deletes the object.
()
➤ Shaping a path item by modifying a path point
This script illustrates how to change the shape of a PathItem by modifying the left direction and the right
direction of the PathPoint.
Dim
Dim
Dim
Dim
Dim
Dim
Dim
appRef As New Illustrator.Application
firstPath As Illustrator.PathItem
currentPoint As Illustrator.PathPoint
nextPoint As Illustrator.PathPoint
countOfPoints As Integer
index As Integer
deltax, deltay, length As Double
Set firstPath = appRef.ActiveDocument.PathItems(1)
countOfPoints = firstPath.PathPoints.Count
' Go through all PathPoints except the last one and set the
' left/right direction according to where the next point is
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
For index = 1 To (countOfPoints - 1)
Set currentPoint = firstPath.PathPoints(index)
Set nextPoint = firstPath.PathPoints(index + 1)
deltax = nextPoint.Anchor(0) - currentPoint.Anchor(0)
deltay = currentPoint.Anchor(1) - nextPoint.Anchor(1)
length = Math.Sqr(deltax ^ 2 + deltay ^ 2)
currentPoint.LeftDirection = _
Array(currentPoint.Anchor(0) - (50 * deltax / length), _
currentPoint.Anchor(1) - (50 * deltay / length))
currentPoint.RightDirection = _
Array(currentPoint.Anchor(0) + (50 * deltax / length), _
currentPoint.Anchor(1) + (50 * deltay / length))
Next index
182
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
183
PathPoints
A collection of PathPoint objects in a path.
PathPoints properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
Count
Long
Read-only. Number of elements in the collection.
Parent
Object
Read-only. The object’s container.
PathPoints methods
Method
Returns
What it does
Add
PathPoint
object
Creates a new PathPoint object.
Long
Returns the index position of the object within the
collection.
PathPoint
object
Returns an object reference to the object identified by
itemKey (name or index).
Nothing
Deletes all objects in this collection.
()
Index
(item as PathPoint)
Item
(itemKey)
RemoveAll
()
➤ Adding a new path point
This script illustrates how to add a new path point to an existing path.
Dim appRef As New Illustrator.Application
Dim firstPath As Illustrator.PathItem
Dim newPoint As Illustrator.PathPoint
Set firstPath = appRef.ActiveDocument.PathItems(1)
Set newPoint = firstPath.PathPoints.Add
newPoint.Anchor = Array(75, 300)
newPoint.LeftDirection = Array(10, 280)
newPoint.RightDirection = Array(165, 330)
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
Pattern
A pattern definition contained in a document.
Pattern properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
Name
String
The pattern name.
Parent
Document object
Read-only. The document that contains this pattern.
Pattern methods
Method
Returns
What it does
Delete
Nothing
Deletes the object.
()
➤ Setting a fill color to a pattern
This script illustrates how to set the default fill color of document 1 to pattern 1.
Dim appRef As New Illustrator.Application
Dim frontDocument As Illustrator.Document
Dim PatternColor As Illustrator.PatternColor
Set frontDocument = appRef.Documents(1)
Set PatternColor = New Illustrator.PatternColor
PatternColor.Pattern = frontDocument.Patterns(1)
frontDocument.DefaultFilled = True
184
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
185
PatternColor
A pattern color specification, used in conjunction with the Pattern property of the Color specification.
Pattern colors are created using a reference to an existing pattern in the document. A matrix may be
specified to further transform the pattern color.
PatternColor objects can be used in any property that takes a color object, such as fillColor or
strokeColor.
PatternColor properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
Matrix
Matrix object
An additional transformation matrix to manipulate the
prototype pattern.
Pattern
Pattern object
A reference to the pattern object to use in this color
definition.
Reflect
Boolean
If true, the prototype should be reflected before filling.
ReflectAngle
Double
The axis in degrees around which to reflect.
Rotation
Double
The angle in degrees to rotate the prototype pattern before
filling.
ScaleFactor
Variant Array of 2
Doubles
The fraction to which to scale the prototype pattern before
filling, represented as a point containing horizontal and
vertical scaling percentages
ShearAngle
Double
The angle in degrees by which to slant the shear.
ShearAxis
Double
The axis in degrees to shear relative to.
ShiftAngle
Double
The angle in degrees to translate the unscaled prototype
pattern before filling.
ShiftDistance
Double
The distance in points to which to translate the unscaled
prototype pattern before filling.
➤ Modifying a pattern
This script illustrates how to modify the first pattern in a document.
Dim
Dim
Dim
Dim
Dim
appRef As New Illustrator.Application
colorOfPattern As New Illustrator.PatternColor
swatchRef As Illustrator.Swatch
swatchColor As Object
firstPath As Illustrator.PathItem
For Each swatchRef In appRef.ActiveDocument.Swatches
' Get the color object of the swatch
Set swatchColor = swatchRef.Color
' Only operate on patterns
If (TypeName(swatchRef) = "PatternColor") Then
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
' Obtain the PatternColor from generic color object
colorOfPattern = swatchColor.Pattern
' Change the pattern properties
colorOfPattern.Rotation = 10
' Set the PatternColor of the original Color object
swatchColor.Pattern = colorOfPattern
' Apply the color to the frontmost path
Set firstPath = appRef.ActiveDocument.PathItems(1)
firstPath.Filled = True
firstPath.fillColor = swatchColor
' Change the definition of the pattern in the palette
swatchRef.Color = swatchColor
End If
Next
186
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
187
Patterns
A collection of Pattern objects in a document.
Patterns properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
Count
Long
Read-only. Number of elements in the collection.
Parent
Object
Read-only. The object’s container.
Patterns methods
Method
Returns
What it does
Add
Pattern object
Creates a new Pattern object.
Long
Returns the index position of the object within the
collection.
Pattern object
Returns an object reference to the object identified by
itemKey (name or index).
Nothing
Deletes all objects in this collection.
()
Index
(item as Pattern)
Item
(itemKey)
RemoveAll
()
➤ Removing a pattern
This script illustrates how to remove a pattern. Note after removing Illustrator objects you should set the
variable that referenced the object you just removed to Nothing.
Dim appRef As New Illustrator.Application
Dim frontDocument As Illustrator.Document
Dim patternToRemove As Illustrator.Pattern
'Remove the second pattern. Then set the patternToRemove reference to
'nothing because it no longer references an existing Illustrator pattern
Set frontDocument = appRef.Documents(1)
Set patternToRemove = frontDocument.Patterns(2)
frontDocument.Patterns.Remove patternToRemove
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
188
PDFFileOptions
Options for opening Adobe PDF documents. This object is found in the PDFFileOptions property of the
Preferences class.
PDFFileOptions properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
PageToOpen
Long
Specifies which page should be used when opening a multipage
document. Default: 1
Parent
Object
Read-only. The object’s container.
PDFCropToBox
AiPDFBoxType
Specifies which box should be used when placing a multipage
document. Default: AiPDFMediaBox
➤ Opening a PDF file
' PDFFileOptions
' Open a multi-page PDF file to a specific
' page using the PDFFileOptions object
' This sample assumes the "C:\temp\Multipage.pdf" exists
Dim appRef As New Illustrator.Application
Dim docRef As Illustrator.Document
appRef.UserInteractionLevel = aiDontDisplayAlerts
With appRef.Preferences.PDFFileOptions
.PageToOpen = 2
.PDFCropToBox = aiPDFBoundingBox
End With
Set docRef = appRef.Open("C:\temp\MultiPage.pdf", aiDocumentRGBColor)
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
189
PDFSaveOptions
Options that can be supplied when saving a document as an Adobe PDF file with the document SaveAs
method.
PDFSaveOptions properties
Property
Value type
What it is
AcrobatLayers
Boolean
If true, create PDF layers from top-level
layers (Acrobat 6 only option). Default:
false
Application
Application object
Read-only. The Illustrator Application
object.
BleedLink
Boolean
Link 4 bleed values. Default: true
BleedOffsetRect
Variant Array of 4
Doubles
The bleed offset rectangle.
ColorBars
Boolean
Draw color bars. Default: false
ColorCompression
AiCompressionQuality
Compression method for color bitmap
images. Default: aiNoCompression
ColorConversionID
AiColorConversion
The PDF color conversion policy.
Default: aiColorConversionNone
ColorDestinationID
AiColorDestination
The conversion target for color
conversion. Default:
aiColorDestinationNone
ColorDownsampling
Double
if zero, no downsampling, otherwise,
the resolution to downsample color
bitmap images to. Default: 150.0
ColorDownsamplingImageThreshold
Double
Downsample if the image’s resolution is
above this value. Default: 225.0
ColorDownsamplingMethod
AiDownsampleMethod
Specifies how color bitmap images
should be resampled. Default:
NoDownsample
ColorProfileID
AiColorProfile
The color profile to include. Default:
aiColorProfileNone
ColorTileSize
Long
Tile size when compressing with
JPEG2000. Default: 256
Compatibility
AiPDFCompatibility
The version of the Acrobat® file format
to create. Default: Acrobat6
CompressArt
Boolean
If true, line art and text should be
compressed. Default: true
DocumentPassword
String
A password string to open the
document. Default: no string
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
Property
Value type
What it is
EnableAccess
Boolean
If true, enable accessing 128-bit.
Default: true
EnableCopy
Boolean
If true, enable copying of text 128-bit.
Default: true
EnableCopyAccess
Boolean
If true, enable copying and accessing
40-bit. Default: true
EnablePlainText
Boolean
Enable plaintext metadata 128-bit;
available only for Acrobat 6. Default:
190
false
FlattenerOptions
PrintFlattenerOptions
object
The printing flattener options
FlattenerPreset
String
Transparency flattener style name.
Default: Custom
FontSubsetThreshold
Double
Include a subset of fonts when less than
this percentage of characters are used.
Range: 0.0 to 100.0. Default: 100.0
GenerateThumbnails
Boolean
If true, generate thumbnails for the
saved document. Default: true
GrayscaleCompression
AiCompressionQuality
Specifies how grayscale bitmap images
should be compressed. Default:
NoCompression
GrayscaleDownsampling
Double
If zero, no downsampling, otherwise,
the resolution to downsample grayscale
images to. Default: 150.0
GrayscaleDownsamplingImageThreshold
Double
Downsample if the image’s resolution is
above this value. Default: 225.0
GrayscaleDownsamplingMethod
AiDownsampleMethod
How should grayscale bitmap images
be resampled. Default: NoDownsample
GrayscaleTileSize
Long
Tile size when compressing with
JPEG2000. Default: 256
MonochromeCompression
AiMonochromeCompression
How should monochrome bitmap
images be compressed. Default:
NoMonoCompression
MonochromeDownsampling
Double
The resolution to downsample images
to. If 0, no downsampling. Default: 300.0
MonochromeDownsamplingImageThreshold
Double
Downsample if the image’s resolution is
above this value. Default: 450
MonochromeDownsamplingMethod
AiDownsampleMethod
How should monochrome bitmap
images be resampled. Default:
NoDownsample
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
191
Property
Value type
What it is
Offset
Double
Offset from artwork to draw printer
marks. Default: 0
Optimization
Boolean
If true, saved PDF should be optimized
for fast web viewing. Default: false
OutputCondition
String
An optional comment to add to the PDF
file, describing the intended printing
condition. Default: not included
OutputConditionID
String
The name of a registered printing
condition. Default: not included
PageInformation
Boolean
If true, draw page information. Default:
false
PageMarksType
AiPageMarksStyle
The page marks style. Default:
PageMarksStandard
PDFAllowPrinting
AiPDFPrintAllowedEnum
PDF security printing permission.
Default: Print128HighResolution
PDFChangesAllowed
AiPDFChangesAllowedEnum
PDF security changes allowed. Default:
Change128AnyChanges
PDFPreset
String
PDF preset name
PDFXStandard
AiPDFChangesAllowedEnum
The PDF standard with which this
document complies. Default:
aiPDFXNone
PDFXStandardDescription
string
A description of the PDF standard from
the selected preset.
PermissionPassword
String
A password string to restrict editing
security settings. Default: no string
PreserveEditability
Boolean
If true, preserve Illustrator editing
capabilities when saving the document.
Default: true
PrinterResolution
Double
Flattening printer resolution. Default:
800.0
RegistrationMarks
Boolean
Draw registration marks. Default: false
RequireDocumentPassword
Boolean
If true, a password should be required
to open the document. Default: false
RequirePermissionPassword Boolean
Trapped
Boolean
If true, a password should be used to
restrict editing security settings.
Default: false
If true, manual trapping has been
prepared for the document. Default:
false
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
192
Property
Value type
What it is
TrimMarks
Boolean
If true, draw trim marks. Default: false
TrimMarkWeight
AiPDFTrimMarkWeight
Trim mark weight. Default:
TrimMarkWeight0125
ViewAfterSaving
Boolean
If true, view PDF after saving. Default:
false
➤ Saving to PDF
This script illustrates how to save the frontmost document as PDF.
Dim appRef As New Illustrator.Application
Dim saveOptions As New Illustrator.PDFSaveOptions
saveOptions.ColorCompression = aiJPEGHigh
saveOptions.Compatibility = aiAcrobat5
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
193
PhotoshopFileOptions
Options for opening a Photoshop file with the Document open method.
PhotoshopFileOptions properties
Property
Value type
What it is
Application
Application
object
Read-only. The Illustrator Application object.
Parent
Object
Read only. This object’s parent object.
PixelAspectRatioCorrection
Boolean
If true, imported images having non-square pixel
aspect ratios should be corrected.
PreserveImageMaps
Boolean
If true, the image maps should be preserved when
the document is converted. Default: true
PreserveLayers
Boolean
If true, layers should be preserved when the
document is converted. Default: true
PreserveSlices
Boolean
If true, slices should be preserved when the
document is converted. Default: true
➤ Opening a Photoshop document
' PhotoshopFileOptions
' Open a PSD file and retain layers
' using the PhotoshopFileOptions object
' This sample assumes the "C:\temp\MultiLayer.psd" exists
Dim appRef As New Illustrator.Application
Dim docRef As Illustrator.Document
With appRef.Preferences.PhotoshopFileOptions
PreserveLayers = True
PixelAspectRatioCorrection = False
End With
Set docRef = appRef.Open("C:\temp\MultiLayers.psd", aiDocumentRGBColor)
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
194
PlacedItem
An artwork item (optionally stored in an external file) placed in a document. A PlacedItem must
correspond to a file containing vector-graphic data, such as a PICT, EPS, or PDF file.
Placed items work only with embedded vector files: EPS, PDF, SVG, and embedded AI. Users can place
vector art files, such as EPS and PDF files, with the File > Place... command in Illustrator. However, placed
image files such as JPG files are represented in the scripting object model as RasterItem objects (see
RasterItem/RasterItems).
When you create a PlacedItem, Illustrator may display a dialog. To avoid this, check the box to turn the
warning off the first time the dialog is displayed.
PlacedItem properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
ArtworkKnockout
AiKnockoutState
Is this object used to create a knockout, and if so,
what kind.
BlendingMode
AiBlendModes
The mode used when compositing an object.
BoundingBox
Variant Array of 4
Doubles
Read-only. Dimensions of PlacedItem regardless of
transformations.
ContentVariable
Variable
The Variable bound to this PlacedItem.
It is not necessary to set the type of the
ContentVariable before binding. Illustrator
automatically sets the type to be the same as the
PageItem to which it is bound.
ControlBounds
Variant Array of 4
Doubles
Read-only. The bounds of the object including stroke
width and controls.
Editable
Boolean
Read-only. If true, this PlacedItem is editable.
File
String
The file containing the placed object.
GeometricBounds
Variant Array of 4
Doubles
Read-only. The bounds of the object excluding stroke
width.
Height
Double
The height of the PlacedItem, based on
GeometricBounds.
Hidden
Boolean
If true, this PlacedItem is hidden.
IsIsolated
Boolean
If true, this object is isolated.
Layer
Layer object
Read-only. The layer this PlacedItem belongs to.
Left
Double
The left position of the PlacedItem.
Locked
Boolean
If true, this PlacedItem is locked
Matrix
Matrix object
The transformation matrix applied to the PlacedItem.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
195
Property
Value type
What it is
Name
String
The name of this PlacedItem.
Opacity
Double
The opacity of the object. Range: 0.0 to 100.0
Parent
object
Read-only. The object that contains this PlacedItem.
Position
Variant Array of 2
Doubles
The position of the top left corner of the PlacedItem.
Selected
Boolean
If true, this PlacedItem is selected.
Sliced
Boolean
If true, this PlacedItem is sliced.
Tags
Tags collection
object
Read-only. The tags contained in this PlacedItem.
Top
Double
The top position of the PlacedItem.
URL
String
The value of the Adobe URL tag assigned to this
PlacedItem.
VisibilityVariable Variable
The Variable bound to this PlacedItem.
VisibleBounds
Variant Array of 4
Doubles
Read-only. The visible bounds of the PlacedItem
including stroke width.
Width
Double
The width of the PlacedItem, based on
GeometricBounds.
WrapInside
Boolean
If true, the text frame object should be wrapped
inside this object.
WrapOffset
Double
The offset to use when wrapping text around this
object.
Wrapped
Boolean
If true, the text frame objects should be wrapped
around this object (text frame must be above the
object).
ZOrderPosition
Long
Read-only. The position of this art item within the
stacking order of the group or layer (Parent) that
contains the art item.
PlacedItem methods
Method
Returns
What it does
Copy
Nothing
Copies the item to the clipboard;
the associated document must be
the frontmost document.
Nothing
Cuts the item to the clipboard; the
associated document must be the
frontmost document.
Nothing
Deletes the object.
()
Cut
()
Delete
()
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
196
Method
Returns
What it does
Duplicate
Object
Duplicates the art item, optionally
with the location and position for
the copy.
Nothing
Embeds this art in the document.
Converts the art to art item objects
as needed and deletes this object.
Nothing
Scales the art item where scaleX is
the horizontal scaling factor 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 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.
([relativeObject as Object],
[insertionLocation as AiElementPlacement])
Embed
()
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])
Translate
([deltaX as Double]
[, deltaY as Double]
[, transformObjects as Boolean]
[, transformFillPatterns as Boolean]
[, transformFillGradients as Boolean]
[, transformStrokePatterns as Boolean])
ZOrder
(zOrderCmd as AiZOrderMethod)
➤ Changing selection in placed items
This script illustrates how to change the selection of PlacedItems.
Dim appRef As New Illustrator.Application
Dim placedArt As Illustrator.PlacedItem
For Each placedArt In appRef.ActiveDocument.PlacedItems
placedArt.Selected = Not (placedArt.Selected)
Next
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
197
PlacedItems
A collection of placed art items. See PlacedItem for an example of use.
PlacedItems properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
Count
Long
Read-only. Number of elements in the collection.
Parent
Document
Read-only. The object’s document container.
PlacedItems methods
Method
Returns
What it does
Add
PlacedItem
object
Creates a new PlacedItem object. Use to place new art
in a document, and use the resulting PlacedItem
object’s embed method to convert that art to embedded
art items.
Long
Returns the index position of the object within the
collection.
PlacedItem
object
Returns an object reference to the object identified by
itemKey (name or index).
Nothing
Deletes all objects in this collection.
()
Index
(item as PlacedItem)
Item
(itemKey)
RemoveAll
()
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
198
PluginItem
An art item created by an Illustrator plug-in such as the blend tool. Scripts can create a plugin item using
PlacedItem.trace or RasterItem.trace, and can copy existing plugin items using the duplicate
method, or copy and paste them, but cannot create PluginItem objects directly.
PluginItem properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
ArtworkKnockout
AiKnockoutState
Is this object used to create a knockout, and if so, what
kind.
BlendingMode
AiBlendModes
The mode used when compositing an object.
ControlBounds
Variant Array of 4
Doubles
Read-only. The bounds of the object including stroke
width and controls.
Editable
Boolean
Read-only. If true, this item is editable.
GeometricBounds
Variant Array of 4
Doubles
Read-only. The bounds of the object excluding stroke
width.
Height
Double
The height of the item, based on GeometricBounds.
Hidden
Boolean
If true, this item is hidden.
IsIsolated
Boolean
If true, this object is isolated.
IsTracing
Boolean
If true, this plugin group represents a vector art item
created by tracing a raster art item. The tracing
property contains the tracing object associated with
the options used to create it.
Layer
Layer object
Read-only. The layer this item belongs to.
Left
Double
The left position of the item.
Locked
Boolean
If true, this item is locked
Name
String
The name of this item.
Opacity
Double
The opacity of the object. Range: 0.0 to 100.0
Parent
object
Read-only. The object that contains this item.
Position
Variant Array of 2
Doubles
The position of the top left corner of the item.
Selected
Boolean
If true, this item is selected.
Sliced
Boolean
If true, this item is sliced.
Tags
Tags collection
object
Read-only. The tags contained in this item.
Top
Double
The top position of the item.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
199
Property
Value type
What it is
Tracing
TracingObject
When this plugin group was created by tracing
(IsTracing is true), the tracing object associated with
the options used to create it.
URL
String
The value of the Adobe URL tag assigned to this item.
VisibilityVariable Variable
The Variable bound to this item.
VisibleBounds
Variant Array of 4
Doubles
Read-only. The visible bounds of the item including
stroke width.
Width
Double
The width of the item, based on GeometricBounds.
WrapInside
Boolean
If true, the text frame object should be wrapped
inside this object.
WrapOffset
Double
The offset to use when wrapping text around this
object.
Wrapped
Boolean
If true, the text frame objects should be wrapped
around this object (text frame must be above the
object).
ZOrderPosition
Long
Read-only. The position of this art item within the
stacking order of the group or layer (Parent) that
contains the art item.
PluginItem methods
Method
Returns
What it does
Copy
Nothing
Copies the item to the clipboard; the
associated document must be the
frontmost document.
Nothing
Cuts the item to the clipboard; the
associated document must be the
frontmost document.
Nothing
Deletes the object.
Object
Duplicates the art item, optionally
with the location and position for
the copy.
Nothing
Moves the art item to a new location
and position.
()
Cut
()
Delete
()
Duplicate
([relativeObject as Object],
[insertionLocation as AiElementPlacement])
Move
(relativeObject as Object,
insertionLocation as AiElementPlacement)
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
200
Method
Returns
What it does
Resize
Nothing
Scales the art item where scaleX is
the horizontal scaling factor 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.
PluginItem
object
Converts the raster art for this object
to vector art, using default options.
Reorders the raster art into the
source art of a plugin group, and
converts it into a group of filled
and/or stroked paths that resemble
the original image.
(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])
Trace
()
Creates and returns a PluginItem
object that references a TraceObject
object.
Transform
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.
(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)
➤ Copying a plug-in item
This example demonstrates how to create a new PluginItem by copying an existing PluginItem.
Dim appRef As New Illustrator.Application
Dim frontDocument As Illustrator.Document
Dim pluginArt As Illustrator.PluginItem
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
Set frontDocument = appRef.ActiveDocument
If (frontDocument.PluginItems.Count > 0) Then
Set pluginArt = frontDocument.PluginItems(1)
pluginArt.Copy
frontDocument.Paste
Else
MsgBox "There is no plug-in art in the front document"
End If
201
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
202
PluginItems
A collection of PluginItem objects in a document.
PluginItems properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
Count
Long
Read-only. Number of elements in the collection.
Parent
Layer or
GroupItem object
Read-only. The object’s container.
PluginItems methods
Method
Returns
What it does
Index
Long
Returns the index position of the object within the
collection.
Plugin object
Returns an object reference to the object identified by
itemKey (name or index).
Nothing
Deletes all objects in this collection.
(item as PluginItem)
Item
(itemKey)
RemoveAll
()
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
PPDFile
Associates file information with a PostScript Printer Description (PPD) file.
PPDFile properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
Name
String
The PPD name.
PPDInfo
PPDFileInfo object
The PPD file information.
PPDFileInfo
Information about a PostScript Printer Description (PPD) file.
PPDFileInfo properties
Property
Value type
What it is
Application
Application
object
Read-only. The Illustrator Application object.
LanguageLevel
String
The PostScript language level.
PPDFilePath
String
Path specification for the PPD file.
ScreenList
Variant
List of color separation screens.
ScreenSpotFunctionList
Variant
List of color separation screen spot functions.
➤ Using a PPD file
' PPD
' Create a document and add a TextFrame for each available PPD.
' Use the textFrame to display PPD info
Dim
Dim
Dim
Dim
Dim
Set
x =
y =
appRef As New Illustrator.Application
docRef As Illustrator.Document
sPPD As String
x As Integer
y As Integer
docRef = appRef.Documents.Add()
30
docRef.Height - 30
Dim ppd
For Each ppd In appRef.PPDFileList
' get data for each PPD
sPPD = ppd.Name & vbCrLf
sPPD = sPPD & vbTab & "PS Level "
sPPD = sPPD & ppd.PPDInfo.LanguageLevel & vbCrLf
203
Adobe Illustrator CS2
Visual Basic Scripting Reference
sPPD = sPPD & vbTab & "Path: "
sPPD = sPPD & ppd.PPDInfo.File & vbCrLf
' display data with a textFrame
Dim textRef As Illustrator.TextFrame
Set textRef = docRef.TextFrames.Add()
textRef.TextRange.CharacterAttributes.Size = 8
textRef.Contents = sPPD
textRef.Top = y
textRef.Left = x
appRef.Redraw
y = y - textRef.Height
Next ppd
Visual Basic Object Reference
204
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
Preferences
Specifies the preferred options for PDF and Photoshop files.
Preferences properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
Parent
Object
Read-only. The object’s container.
PDFFileOptions
PDFFileOptions
Read-only. Options to use when opening or
placing a PDF file.
PhotoshopFileOptions
PhotoshopFileOptions
Read-only. Options to use when opening or
placing a Photoshop file.
205
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
PrintColorManagementOptions
Contains information used for color management of the document.
PrintColorManagementOptions properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
ColorProfileMode AiPrintColorProfile The color management profile mode. Default:
aiSourceProfile
Intent
AiPrintColorIntent
The color management intent type. Default:
aiRelativeColorimetric
Name
String
The color management profile name.
➤ Managing colors for printing
' PrintColorManagementOptions
' Create a PrintColorManagementOptions object and assign it
' to a PrintOptions object, then print with each color intent
' create a simple path item and apply a graphic style to it
Dim appRef As New Illustrator.Application
Dim docRef As Illustrator.Document
Dim pathItem As Illustrator.pathItem
Set docRef = appRef.Documents.Add
Set pathItem = docRef.PathItems.Rectangle(600, 200, 200, 200)
docRef.GraphicStyles(2).ApplyTo pathItem
Dim colorOptions As New Illustrator.PrintColorManagementOptions
Dim printOptionsRef As New Illustrator.PrintOptions
printOptionsRef.ColorManagementOptions = colorOptions
colorOptions.Name = "ColorMatch RGB"
' Print the current document once for each color intent.
colorOptions.Intent = aiAbsoluteColorimetric
docRef.PrintOut
colorOptions.Intent = aiPerceptualIntent
docRef.PrintOut
colorOptions.Intent = aiRelativeColorimetric
docRef.PrintOut
colorOptions.Intent = aiSaturationIntent
docRef.PrintOut
206
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
PrintColorSeparationOptions
Information about the color separations to be used in printing the document.
PrintColorSeparationOptions properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application
object.
ColorSeparationMode
AiPrintColorSeparationMode
The color separation type. Default:
Composite
ConvertSpotColors
Boolean
If true, spot colors should be converted to
process colors. Default: false
InkList
Variant Array of Ink
objects
The list of inks for color separation.
OverPrintBlack
Boolean
If true, overprint in black. Default: false
➤ Managing print color separations
'
'
'
'
PrintColorSeparationOptions
Create a new document and add some symbol items
Create a PrintColorSeparationOptions object and
print with various separation settings
' Create a new document and add some artwork
Dim appRef As New Illustrator.Application
Dim docRef As Illustrator.Document
Set docRef = appRef.Documents.Add()
Dim symbolRef As Illustrator.Symbol
Dim itemRef As Illustrator.SymbolItem
Dim y As Integer
Dim i as Integer
y = docRef.Height - 30
i = 1
Do While (i < 11)
Set symbolRef = docRef.Symbols(i)
Set itemRef = docRef.SymbolItems.Add(symbolRef)
itemRef.Top = y
itemRef.Left = 100
y = (y - (itemRef.Height + 10))
i = i + 1
Loop
appRef.Redraw
' Create a separations object and assign it a
' PrintOptions object
Dim printOpts As New Illustrator.printOptions
Dim separationOpts As New Illustrator.PrintColorSeparationOptions
printOpts.ColorSeparationOptions = separationOpts
207
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
' Print with various separation options
separationOpts.ConvertSpotColors = True
separationOpts.OverPrintBlack = True
separationOpts.ColorSeparationMode = aiComposite
docRef.PrintOut printOpts
separationOpts.ColorSeparationMode = aiInRIPSeparation
docRef.PrintOut printOpts
separationOpts.ConvertSpotColors = False
separationOpts.OverPrintBlack = False
separationOpts.ColorSeparationMode = aiHostBasedSeparation
docRef.PrintOut printOpts
208
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
209
PrintCoordinateOptions
Information about the media and associated printing parameters.
PrintCoordinateOptions properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
Emulsion
Boolean
If true, flip artwork will be flipped horizontally. Default:
false
FitToPage
Boolean
Whether to proportionally scale the artwork to fit on
media. Default: false
HorizontalScale
Double
The horizontal scaling factor expressed as a percentage
(100 = 100%) Range: 1.0 to 10000.0. Default: 100.0
Orientation
AiPrintOrientation
The artwork orientation. Default: Portrait
Position
AiPrintPosition
The artwork position on media. Default: TranslateCenter
Tiling
AiPrintTiling
The page tiling mode. Default: TileNone
VerticalScale
Double
The vertical scaling factor expressed as a percentage (100
= 100%) Range: 1.0 to 10000.0. Default: 100.0
➤ Managing print coordinates
' PrintCoordinateOptions
' Create some simple artwork (that extends off the page)
' and print it with various Coordinate Options
' Create a TextFrame that extends off the page
Dim appRef As New Illustrator.Application
Dim docRef As Illustrator.Document
Set docRef = appRef.Documents.Add()
Dim textRef As Illustrator.TextFrame
Set textRef = docRef.TextFrames.Add()
textRef.Contents = "This should extend off the page"
textRef.Left = -50
textRef.Top = 600
textRef.Width = docRef.Width + 100
textRef.Height = 150
appRef.Redraw
' Print the item using various settings of the
' PrintCoordinateOptions object
Dim coordinateOptions As New Illustrator.PrintCoordinateOptions
Dim printOptions As New Illustrator.printOptions
printOptions.coordinateOptions = coordinateOptions
coordinateOptions.Emulsion = True
' reverse from right to left
coordinateOptions.FitToPage = True
' fit artwork to page size
coordinateOptions.Orientation = aiLandscape
Adobe Illustrator CS2
Visual Basic Scripting Reference
docRef.PrintOut printOptions
coordinateOptions.Emulsion = False
coordinateOptions.Orientation = aiPortrait
coordinateOptions.HorizontalScale = 50
coordinateOptions.VerticalScale = 50
docRef.PrintOut printOptions
Visual Basic Object Reference
210
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
211
Printer
Associates an available printer with printer information. To request a list of printers, you must first have a
document open or an error is returned.
Printer properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
Name
String
The printer name
PrinterInfo
PrinterInfo object
The printer information
PrinterInfo
Contains all configuration information about a printer.
PrinterInfo properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
BinaryPrintingSupport
Boolean
If true, the printer supports binary printing.
ColorSupport
AiPrinterColorMode
The printer color capability.
CustomPaperSupport
Boolean
If true, the printer supports custom paper sizes.
CustomPaperTransverseSupport
Boolean
If true, the printer supports custom paper
transverse.
DeviceResolution
Double
The printer default resolution.
InRIPSeparationSupport
Boolean
If true, the printer supports InRIP color
separation.
MaxDeviceResolution
Double
The printer maximum device resolution.
MaxPaperHeight
Double
Custom paper’s maximum height.
MaxPaperHeightOffset
Double
Custom paper’s maximum height offset.
MaxPaperWidth
Double
Custom paper’s maximum width.
MaxPaperWidthOffset
Double
Custom paper’s maximum width offset.
MinPaperHeight
Double
Custom paper’s minimum height.
MinPaperHeightOffset
Double
Custom paper’s minimum height offset.
MinPaperWidth
Double
Custom paper’s minimum width.
MinPaperWidthOffset
Double
Custom paper’s minimum width offset.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
Property
Value type
What it is
PaperSizes
Variant Array of
Paper objects
The list of supported paper sizes.
PostScriptLevel
AiPrinterPostScript
LevelEnum
The PostScript language level.
PrinterType
AiPrinterTypeEnum
The printer type.
➤ Finding printers
This script accesses and displays the list of printer names.
' Printer
' Use the PrinterList to obtain the name
' of each printer and display it on the page
Dim
Dim
Dim
Dim
appRef As New Illustrator.Application
docRef As Illustrator.Document
textRef As Illustrator.TextFrame
sData As String
Set docRef = appRef.Documents.Add()
Set textRef = docRef.TextFrames.Add()
textRef.Top = docRef.Height - 50
textRef.Left = 50
sData = "Printers:"
Dim printerRef
For Each printerRef In appRef.PrinterList
sData = sData & vbCrLf & printerRef.Name
Next PrinterRef
textRef.Contents = sData
appRef.Redraw
➤ Finding printer information
'
'
'
'
PrintInfo
Add a document and TextFrame
Loop through printer list, show info on each printer
using the PrintInfo attribute
' create a
Dim appRef
Dim docRef
Set docRef
new document
As New Illustrator.Application
As Illustrator.Document
= Documents.Add()
' add title text frame
Dim textRef1 As Illustrator.TextFrame
Set textRef1 = docRef.TextFrames.Add()
textRef1.Contents = "Checking Printers..."
textRef1.Top = 600
textRef1.Left = 200
appRef.Redraw
212
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
213
' for each printer, list the PS support and InHostRip support
Dim sPrintInfo As String
Dim infoRef As Illustrator.PrinterInfo
Dim printerRef
For Each printerRef In appRef.PrinterList
sPrintInfo = sPrintInfo & printerRef.Name & vbCrLf
sPrintInfo = sPrintInfo & vbTab & "PS Level = "
sPrintInfo = sPrintInfo & CStr(printerRef.PrinterInfo.PostScriptLevel)_
& vbCrLf
sPrintInfo = sPrintInfo & vbTab & "Device Resolution = "
sPrintInfo = sPrintInfo & CStr(printerRef.PrinterInfo.DeviceResolution)_
& vbCrLf
sPrintInfo = sPrintInfo & vbTab & "InRIPSeparation Support = "
sPrintInfo = sPrintInfo &
CStr(printerRef.PrinterInfo.InRIPSeparationSupport) & vbCrLf
Next printerRef
textRef1.Contents = sPrintInfo
appRef.Redraw
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
214
PrintFlattenerOptions
Contains flattening options for use when Illustrator outputs artwork that contains transparency into a
non-native format.
PrintFlattenerOptions properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
ClipComplexRegions
Boolean
If true, clip complex regions. Default: false
ConvertStrokesToOutlines
Boolean
If true, convert all strokes to outlines. Default: false
ConvertTextToOutlines
Boolean
If true, convert all text to outlines. Default: false
FlatteningBalance
Double
The flattening balance. Range: 0.0 to 100.0. Default:
100.0
GradientResolution
Long
The gradient resolution in dots per inch (dpi).
Range: 1.0 to 9600.0. Default: 300.0
Overprint
AiPDFOverprint
Whether to preserve, discard, or simulate
overprinting. Default: aiPreservePDFOverprint
RasterizationResolution
Double
The rasterization resolution in dots per inch (dpi).
Range: 1.0 to 9600.0. Default: 300.0
➤ Setting print flattening
'
'
'
'
'
PrintFlattenerOptions
Open a document, and add a simple text frame
with a graphic style applied.
Print the document with "low" and "high"
flattener settings
Dim appRef As New Illustrator.Application
Dim docRef As Illustrator.Document
Set docRef = appRef.Documents.Add()
Dim itemRef As Illustrator.PathItem
Set itemRef = docRef.PathItems.Rectangle(600, 200, 200, 200)
docRef.GraphicStyles(2).ApplyTo itemRef
' Create a PrintFlattenerOptions object and
' assign it to a PrintOptions object.
Dim flatOpts As New Illustrator.PrintFlattenerOptions
Dim printOpts As New Illustrator.printOptions
printOpts.FlattenerOptions = flatOpts
' print faster with low resolution
flatOpts.ClipComplexRegions = True
flatOpts.GradientResolution = 30
flatOpts.RasterizationResolution = 30
docRef.PrintOut printOpts
Adobe Illustrator CS2
Visual Basic Scripting Reference
' print slower with higher resolution
flatOpts.ClipComplexRegions = False
flatOpts.GradientResolution = 300
flatOpts.RasterizationResolution = 300
docRef.PrintOut printOpts
Visual Basic Object Reference
215
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
216
PrintFontOptions
Contains information about font downloading and substitution for the fonts used for printing a document.
PrintFontOptions properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
DownloadFonts
AiPrintFontDownloadMode
The font download mode. Default:
DownloadSubset
FontSubstitution
AiFontSubstitutionPolicy
The font substitution policy. Default:
SubstituteOblique
➤ Setting print font options
' PrintFontOptions
' Create a new print font options object,
' change some attributes and print with it.
Dim appRef As New Illustrator.Application
Dim docRef As Illustrator.Document
Dim textRef As Illustrator.TextFrame
Set docRef = appRef.Documents.Add()
Set textRef = docRef.TextFrames.Add()
textRef.Top = 600
textRef.Left = 50
textRef.Contents = "PrintFontOptions object"
' Create a PrintFontOptions object and
' assign it to a PrintOptions object.
Dim fontOpts As New Illustrator.PrintFontOptions
Dim printOpts As New Illustrator.printOptions
printOpts.FontOptions = fontOpts
fontOpts.DownloadFonts = aiDownloadComplete
fontOpts.FontSubstitution = aiSubstituteOblique
' print it
docRef.PrintOut printOpts
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
217
PrintJobOptions
Contains information about how a job is to be printed.
PrintJobOptions properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
BitmapResolution Double
The bitmap resolution. Minimum 0.0. Default: 0.0
Collate
Boolean
If true, collate print pages. Default: false
Copies
Long
The number of copies to print. Minimum: 1
Default: 1
Designation
AiPrintArtworkDesignation
The layers/objects to be printed. Default:
VisiblePrintableLayers
File
String
The file to which to print.
Name
String
The print job name.
PrintArea
AiPrintingBounds
The printing bounds. Default: ArtboardBounds
PrintAsBitmap
Boolean
If true, print as bitmap. Default: false
ReversePages
Boolean
If true, print pages in reverse order. Default: false
➤ Printing with job options
'
'
'
'
PrintJobOptions
Create simple text items on a variety of
Print/No-Print and Non-Visible layers.
Print the document with various printJobOptions
Dim appRef As New Illustrator.Application
Dim docRef As Illustrator.Document
Set docRef = appRef.Documents.Add()
Dim
Dim
Dim
Dim
Dim
textRef_1 As Illustrator.TextFrame
textRef_2 As Illustrator.TextFrame
textRef_3 As Illustrator.TextFrame
layerRef_2 As Illustrator.Layer
layerRef_3 As Illustrator.Layer
' create a visible, printable item
Set textRef_1 = docRef.Layers(1).TextFrames.Add()
textRef_1.Contents = "Visible and Printable"
textRef_1.Top = 600
textRef_1.Left = 200
' create a visible, non-printable item
Set layerRef_2 = docRef.Layers.Add()
Set textRef_2 = layerRef_2.TextFrames.Add()
textRef_2.Contents = "Visible and Non-Printable"
Adobe Illustrator CS2
Visual Basic Scripting Reference
textRef_2.Top = 500
textRef_2.Left = 250
layerRef_2.Printable = False
' create a non-visible item
Set layerRef_3 = docRef.Layers.Add()
Set textRef_3 = layerRef_3.TextFrames.Add()
textRef_3.Contents = "Non-Visible"
textRef_3.Top = 400
textRef_3.Left = 300
layerRef_3.Visible = False
appRef.Redraw
' Print with various jobOptions
Dim jobOptionsRef As New Illustrator.PrintJobOptions
Dim printOpts As New Illustrator.printOptions
printOpts.JobOptions = jobOptionsRef
jobOptionsRef.Designation = aiAllLayers
jobOptionsRef.ReversePages = True
docRef.PrintOut printOpts
jobOptionsRef.Designation = aiVisibleLayers
jobOptionsRef.ReversePages = False
jobOptionsRef.PrintAsBitmap = True
docRef.PrintOut printOpts
jobOptionsRef.Designation = aiVisiblePrintableLayers
jobOptionsRef.File = "C:\temp\printJobTest1.ps"
docRef.PrintOut printOpts
Visual Basic Object Reference
218
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
219
PrintOptions
Collects all information about all printing options including flattening, color management, coordinates,
fonts, and paper. Used as an argument to the PrintOut method.
PrintOptions properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application
object.
ColorManagementOptions
PrintColorManagementOptions
object
The printing color management
options.
ColorSeparationOptions
PrintColorSeparationOptions
object
The printing color separation options.
CoordinateOptions
PrintCoordinateOptions
object
The printing coordinate options.
FlattenerOptions
PrintFlattenerOptions
object
The printing flattener options.
FlattenerPreset
String
The transparency flattener preset
name.
FontOptions
PrintFontOptions object
The printing font options.
JobOptions
PrintJobOptions object
The printing job options.
PageMarksOptions
PrintPageMarksOptions
object
The printing page marks options.
PaperOptions
PrintPaperOptions object
The paper options.
PostScriptOptions
PrintPostScriptOptions
object
The PostScript options for printing.
PPDName
String
The PPD name.
PrinterName
String
The printer name.
PrintPreset
String
The print style.
➤ Setting print options
'
'
'
'
'
PrintOptions
Create a new document and add some symbol items
Create a variety of print options and assign each
to a PrintOptions object, then print the documennt
with the combined PrintOptions object.
Dim
Dim
Set
Dim
Dim
Dim
dim
appRef As New Illustrator.Application
docRef As Illustrator.Document
docRef = appRef.Documents.Add()
symbolRef As Illustrator.Symbol
itemRef As Illustrator.SymbolItem
y As Integer
i as Integer
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
y = docRef.Height - 30
i = 1
Do While (i < 11)
Set symbolRef = docRef.Symbols(i)
Set itemRef = docRef.SymbolItems.Add(symbolRef)
itemRef.Top = y
itemRef.Left = 100
y = (y - (itemRef.Height + 10))
i = i + 1
Loop
appRef.Redraw
' create multiple options and assign to PrintOptions object
Dim printOpts As New Illustrator.printOptions
Dim colorOpts As New Illustrator.PrintColorManagementOptions
colorOpts.Name = "ColorMatch RGB"
colorOpts.Intent = aiSaturationIntent
printOpts.ColorManagementOptions = colorOpts
Dim jobOpts As New Illustrator.PrintJobOptions
jobOpts.Designation = aiAllLayers
jobOpts.ReversePages = True
printOpts.JobOptions = jobOpts
Dim coordinateOpts As New Illustrator.PrintCoordinateOptions
coordinateOpts.FitToPage = True
printOpts.coordinateOptions = coordinateOpts
Dim flattenerOpts As New Illustrator.PrintFlattenerOptions
flattenerOpts.ClipComplexRegions = True
flattenerOpts.GradientResolution = 60
flattenerOpts.RasterizationResolution = 60
printOpts.FlattenerOptions = flattenerOpts
docRef.PrintOut printerOpts
220
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
221
PrintPageMarksOptions
The options for printing page marks.
PrintPageMarksOptions properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
BleedOffsetRect
Variant Array of 4
Doubles
The bleed offset rectangle.
ColorBars
Boolean
If true, enable color bars printing. Default: false
MarksOffsetRect
Variant Array of 4
Doubles
The page marks offset rectangle.
PageInfoMarks
Boolean
If true, enable page info marks printing. Default: false
PageMarksType
AiPageMarksStyle
The predefined page marks style name. Default:
PageMarksStandard
RegistrationMarks
Boolean
If true, enable registration marks printing. Default:
false
TrimMarks
Boolean
If true, enable trim marks printing. Default: false
TrimMarksWeight
Double
Stroke weight of trim marks. Minimum: 0.0 Default:
0.125
➤ Setting page mark options
'
'
'
'
PrintPageMarksOptions
Create a PrintPageMarksOptions object and assign it
to a PrintOptions object.
Set some attributes and print it.
' create a simple path item for printing
Dim appRef As New Illustrator.Application
Dim docRef As Illustrator.Document
Dim pathItem As Illustrator.pathItem
Set docRef = appRef.Documents.Add
Set pathItem = docRef.PathItems.Rectangle(600, 200, 200, 200)
docRef.GraphicStyles(2).ApplyTo pathItem
' Create a PrintCoordinateOptions object and assign it
' to a PrintOptions object
Dim pageMarksOpts As New Illustrator.PrintPageMarksOptions
pageMarksOpts.ColorBars = True
pageMarksOpts.PageInfoMarks = True
pageMarksOpts.RegistrationMarks = True
pageMarksOpts.TrimMarks = True
Dim printerOpts As New Illustrator.printOptions
printerOpts.PageMarksOptions = pageMarksOpts
docRef.PrintOut printerOpts
Adobe Illustrator CS2
Visual Basic Scripting Reference
' print it
docRef.PrintOut printOpts
Visual Basic Object Reference
222
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
223
PrintPaperOptions
Contains information about the paper to be used in a print job.
PrintPaperOptions properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
Height
Double
The custom height (in points) for using the custom paper. Default:
0.0
Name
String
The paper’s name.
Offset
Double
Custom offset (in points) for using the custom paper. Default: 0.0
Transverse
Boolean
If true, transverse the artwork (rotate 90 degrees) on the custom
paper. Default: false
Width
Double
The custom width in points, for using the custom paper. Default: 0.0
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
PrintPostScriptOptions
Specifies the options to be used when printing to a PostScript printer.
PrintPostScriptOptions properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator
Application object.
BinaryPrinting
Boolean
If true, print in binary mode.
Default: false
CompatibleShading
Boolean
If true, use PostScript level 1
compatible gradient and gradient
mesh printing. Default: false
ForceContinuousTone
Boolean
If true, force continuous tone.
Default: false
ImageCompression
AiPostScriptImageCompressionType
The image compression type.
Default: ImageCompressionNone
NegativePrinting
Boolean
If true, print in negative mode.
Default: false
PostScriptLevel
AiPrinterPostScriptLevelEnum
The PostScript language level.
Default: aiLevel2
ShadingResolution
Double
The shading resolution Range: 1.0
to 9600.0. Default: 300.0
➤ Setting PostScript options
' PrintPostScriptOptions
' Create a new PrintPostScriptOptions object,
' print with several PS levels
' Create a new document and add a TextFrame
Dim appRef As New Illustrator.Application
Dim docRef As Illustrator.Document
Dim textRef As Illustrator.TextFrame
Set docRef = appRef.Documents.Add()
Set textRef = docRef.TextFrames.Add()
textRef.Top = 600
textRef.Left = 50
textRef.Contents = "PrintPostScriptOptions object"
' Create a PrintPostScriptOptions object and
' assign it to a PrintOptions object.
Dim psOpts As New Illustrator.PrintPostScriptOptions
Dim printOpts As New Illustrator.printOptions
printOpts.PostScriptOptions = psOpts
' print with different PS levels
224
Adobe Illustrator CS2
Visual Basic Scripting Reference
psOpts.PostScriptLevel = aiPSLevel2
docRef.PrintOut printOpts
psOpts.PostScriptLevel = aiPSLevel3
docRef.PrintOut printOpts
Visual Basic Object Reference
225
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
226
RasterItem
A bitmap art item in a document. A script can create raster items from an external file, and can create new
raster items by copying and pasting or duplicating existing raster items.
RasterItem properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
ArtworkKnockout
AiKnockoutState
Is this object used to create a knockout, and if so, what
kind.
BlendingMode
AiBlendModes
The mode used when compositing an object.
BoundingBox
Variant Array of 4
Doubles
Read-only. Dimensions of item regardless of
transformations.
ContentVariable
Variable
The Variable bound to this item. It is not necessary to
set the type before binding.
ControlBounds
Variant Array of 4
Doubles
Read-only. The bounds of the object including stroke
width and controls.
Editable
Boolean
Read-only. If true, this item is editable.
Embedded
Boolean
If true, the Raster art can be embedded within the
illustration.
File
String
The file containing the art, if stored externally.
GeometricBounds
Variant Array of 4
Doubles
Read-only. The bounds of the object excluding stroke
width.
Height
Double
The height of the item, based on GeometricBounds.
Hidden
Boolean
If true, this item is hidden.
ImageColorSpace
AiImageColorSpace
The color space of the Raster image.
IsIsolated
Boolean
If true, this object is isolated.
Layer
Layer object
Read-only. The layer this item belongs to.
Left
Double
The left position of the item.
Locked
Boolean
If true, this item is locked
Matrix
Matrix object
The transformation matrix applied to the item.
Name
String
The name of this item.
Opacity
Double
The opacity of the object. Range: 0.0 to 100.0
Parent
object
Read-only. The object that contains this item.
Position
Variant Array of 2
Doubles
The position of the top left corner of the item.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
227
Property
Value type
What it is
Selected
Boolean
If true, this item is selected.
Sliced
Boolean
If true, this item is sliced.
Status
AiRasterLinkState
The status of the linked image, if the image is stored
externally.
Tags
Tags collection
object
Read-only. The tags contained in this item.
Top
Double
The top position of the item.
URL
String
The value of the Adobe URL tag assigned to this item.
VisibilityVariable Variable
The Variable bound to this item.
VisibleBounds
Variant Array of 4
Doubles
Read-only. The visible bounds of the item including
stroke width.
Width
Double
The width of the item, based on GeometricBounds.
WrapInside
Boolean
If true, the text frame object should be wrapped
inside this object.
WrapOffset
Double
The offset to use when wrapping text around this
object.
Wrapped
Boolean
If true, the text frame objects should be wrapped
around this object (text frame must be above the
object).
ZOrderPosition
Long
Read-only. The position of this art item within the
stacking order of the group or layer (Parent) that
contains the art item.
RasterItem methods
Method
Returns
What it does
Colorize
Nothing
Colorizes the RasterItem with a
CMYK or RGB color.
Nothing
Copies the item to the clipboard; the
associated document must be the
frontmost document.
Nothing
Cuts the item to the clipboard; the
associated document must be the
frontmost document.
Nothing
Deletes the object.
Object
Duplicates the art item, optionally
with the location and position for
the copy.
(rasterColor as object)
Copy
()
Cut
()
Delete
()
Duplicate
([relativeObject as Object],
[insertionLocation as AiElementPlacement])
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
228
Method
Returns
What it does
Move
Nothing
Moves the art item to a new location
and position.
Nothing
Scales the art item where scaleX is
the horizontal scaling factor 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.
PluginItem
object
Converts the raster art for this object
to vector art, using default options.
Reorders the raster art into the
source art of a plugin group, and
converts it into a group of filled
and/or stroked paths that resemble
the original image.
(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])
Trace
()
Creates and returns a PluginItem
object that references a TraceObject
object.
Transform
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.
(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)
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
229
RasterItems
A collection of RasterItem objects.
RasterItems properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
Count
Long
Read-only. Number of elements in the collection.
Parent
Object
Read-only. The object’s container.
RasterItems methods
Method
Returns
What it does
Add
RasterItem
object
Creates a new RasterItem object.
Long
Returns the index position of the object within the
collection.
RasterItem
object
Returns an object reference to the object identified by
itemKey (name or index).
Nothing
Deletes all objects in this collection.
()
Index
(item as RasterItem)
Item
(itemKey)
RemoveAll
()
➤ Getting properties of raster items
This script illustrates how to obtain the color space of a raster item.
Dim appRef As New Illustrator.Application
Dim rasterArt As Illustrator.RasterItem
Set rasterArt = appRef.ActiveDocument.RasterItems(1)
Select Case (rasterArt.ImageColorSpace)
Case Is = aiImageCMYK
MsgBox "The first raster item is a CMYK raster item"
Case Is = aiImageRGB
MsgBox "The first raster item is an RGB raster item"
Case Is = aiImageGrayScale
MsgBox "The first raster item is a Grayscale raster item"
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
230
RGBColor
An RGB color specification, used to apply an RGB 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 will translate 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.
RGBColor properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
Blue
Double
The blue color value. Range: 0.0 to 255.0
Green
Double
The green color value. Range: 0.0 to 255.0
Red
Double
The red color value. Range: 0.0 to 255.0
➤ Setting RGB colors
This script sets the default fill color of the frontmost document to yellow using an RGB object. If the color
space of the frontmost document is CMYK, then Illustrator will regard the RGB fill color as a CMYK color
although it is specified using RGB.
Dim appRef As New Illustrator.Application
Dim newFillColor As New Illustrator.RGBColor
'Define the new color
newFillColor.Red = 255#
newFillColor.Green = 255#
newFillColor.Blue = 0
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
Screen
Associates a color separation screen with information to be used for printing.
Screen properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
Name
String
The color separation screen.
ScreenInfo
ScreenInfo object
The color separation screen information.
ScreenInfo
Contains information about the angle and frequency of the screen to be used for printing.
ScreenInfo properties
Property
Value type
What it is
Angle
Double
The screen’s angle in degrees.
Application
Application object
Read-only. The Illustrator Application object.
DefaultScreen
Boolean
If true, it is the default screen.
Frequency
Double
The screen’s frequency.
➤ Getting screen information
' Screen
' Display screen info available for first PPD ojbect
' Create a new document and add a TextFrame
Dim appRef As New Illustrator.Application
Dim docRef As Illustrator.Document
Dim textRef As Illustrator.TextFrame
Set docRef = appRef.Documents.Add()
Set textRef = docRef.TextFrames.Add()
textRef.Top = 600
textRef.Left = 50
textRef.Contents = "Screen Objects for 1st PPD File: " & vbCrLf
' Get the first PPD
Dim ppdRef As Illustrator.PPDFile
Set ppdRef = appRef.PPDFileList(1)
Dim sInfo As String
sInfo = ppdRef.Name & vbCrLf
' Get info on the all screens from the 1st PPD
Dim screenRef
231
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
For Each screenRef In ppdRef.PPDInfo.ScreenList
sInfo = sInfo & screenRef.Name & vbCrLf
sInfo = sInfo & vbTab & "Angle = "
sInfo = sInfo & CStr(screenRef.ScreenInfo.Angle) & vbCrLf
sInfo = sInfo & vbTab & "Frequency = "
sInfo = sInfo & screenRef.ScreenInfo.Frequency & vbCrLf
Next screenRef
textRef.Contents = textRef.Contents & sInfo
appRef.Redraw
232
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
233
ScreenSpotFunction
Contains information about the screen spot function including its definition in PostScript language code.
ScreenSpotFunction properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
Name
String
The color separation screen spot function name.
SpotFunction
String
The spot function expressed in PostScript language
commands.
➤ Getting screen spot information
' ScreenSpotFunction
' Display ScreenSpot info info available for first PPD ojbect
' Create a new document and add a TextFrame
Dim appRef As New Illustrator.Application
Dim docRef As Illustrator.Document
Dim textRef As Illustrator.TextFrame
Set docRef = appRef.Documents.Add()
Set textRef = docRef.TextFrames.Add()
textRef.Top = 600
textRef.Left = 50
textRef.Contents = "ScreenSpotFunctions for 1st PPD:" & vbCrLf
' Get the first PPD
Dim ppdRef As Illustrator.PPDFile
Set ppdRef = appRef.PPDFileList(1)
Dim sInfo As String
sInfo = ppdRef.Name & vbCrLf
' Get info on the all ScreenSpot info from the 1st PPD
Dim screenSpot
For Each screenSpot In ppdRef.PPDInfo.ScreenSpotFunctionList
sInfo = sInfo + screenSpot.Name & ": "
sInfo = sInfo + screenSpot.SpotFunction & vbCrLf
sInfo = sInfo & vbCrLf
Next screenSpot
textRef.Contents = textRef.Contents + sInfo
appRef.Redraw
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
234
Spot
A custom color definition contained in a SpotColor object. All Illustrator documents contain the spot
color [Registration] which can be used to print to all plates of a separation.
If no properties are specified when creating a new spot, default values are provided. However, if specifying
the color, you must use the same color space as the document, either CMYK or RGB. Otherwise, an error
results. When created, the spot is inserted into the swatch palette at the end.
Spot properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
Color
Color object
The color information for this spot color.
ColorType
AiColorModel
The color model for this spot color.
Name
String
The spot color’s name.
Parent
Document object
Read-only. The document that contains this spot color.
Spot methods
Method
Returns
What it does
Delete
Nothing
Deletes the object.
()
➤ Creating a new spot
This script illustrates how to create a new spot in the frontmost document.
Dim appRef As New Illustrator.Application
Dim frontDocument As Illustrator.Document
Dim newSpot As Illustrator.Spot
Dim newSpotColor As Illustrator.SpotColor
'Create the new spot
Set frontDocument = appRef.ActiveDocument
Set newSpot = frontDocument.Spots.Add
'Define the new color value
Dim newColor As New Illustrator.CMYKColor
newColor.Cyan = 35
newColor.Magenta = 0
newColor.Yellow = 50
newColor.Black = 0
'Define a new SpotColor with an 80% tint
'of the new Spot's color. The spot color can then
'be applied to an art item like any other color.
newSpot.Name = "Pea-Green"
newSpot.ColorType = aiSpot
newSpot.Color = newColor
Set newSpotColor = New Illustrator.SpotColor
newSpotColor.Spot = newSpot
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
SpotColor
Color class used to apply the color value of a spot at a specified tint value.
SpotColor properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
Spot
Spot object
A reference to the Spot object that defines the color.
Tint
Double
The tint of the color. Range: 0.0 to 100.0
➤ Applying a tint to a spot
This script shows how to create a new spot, and apply a tint of that spot to the fill of a PathItem.Your
frontmost document must already have a PathItem before you can run this script.
Dim
Dim
Dim
Dim
Dim
appRef As New Illustrator.Application
frontDocument As Illustrator.Document
newColor As New Illustrator.RGBColor
newSpot As Illustrator.Spot
frontPath As Illustrator.PathItem
'Define the new color value
newColor.Red = 255#
newColor.Green = 0
newColor.Blue = 0
'Create the new spot
Set frontDocument = appRef.ActiveDocument
Set newSpot = frontDocument.Spots.Add
'Define the new SpotColor as 80% of the specified RGB color
newSpot.Name = "Red spot color"
newSpot.Color = newColor
'Apply 50% of the spot color just created to the frontmost path item,
'by creating a SpotColor object, setting its properties,
'then applying that to a path item's fill color.
Dim newSpotColor As New Illustrator.SpotColor
newSpotColor.Spot = newSpot
newSpotColor.Tint = 50#
Set frontPath = frontDocument.PathItems(1)
frontPath.Filled = True
235
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
236
Spots
A collection of spot colors in a document.
Spots properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
Count
Long
Read-only. Number of elements in the collection.
Parent
Document
Read-only. The object’s document container.
Spots methods
Method
Returns
What it does
Add
Spot object
Creates a new Spot object.
Long
Returns the index position of the object within the
collection.
Spot object
Returns an object reference to the object identified by
itemKey (name or index).
Nothing
Deletes all objects in this collection.
()
Index
(item as Spot)
Item
(itemKey)
RemoveAll
()
➤ Removing spots from a document
This script illustrates how to remove all spots defined in the frontmost document.
Dim appRef As New Illustrator.Application
Dim documentSpots As Illustrator.Spots
Set documentSpots = appRef.ActiveDocument.Spots
documentSpots.RemoveAll
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
237
Story
A contiguous block of text as specified by a text range. A story can contain one or more text frames; if there
is more than one, the multiple text frames are linked together to form a single story.
Story properties
Property
Value Type
What it is
Application
Application
object
Read-only. The Illustrator Application object.
Characters
Characters
Read-only. All of the characters in the story.
InsertionPoints
InsertionPoints
Read-only. All of the insertion points in this story.
Length
Long
Read-only. The number of characters in the story.
Lines
Lines
Read-only. All of the lines in this story.
Paragraphs
Paragraphs
Read-only. All of the paragraphs in this story.
Parent
Object
Read-only. The object’s container.
TextFrames
TextFrames
Read-only. The text frame items in this story.
TextRange
TextRange
Read-only. The text range of the story.
TextRanges
TextRanges
Read-only. All of the text ranges in the story.
TextSelection
Variant Array of
TextRange
objects
Read-only. The selected text ranges in the story.
Words
Words
Read-only. All of the words in the story.
➤ Linking text frames into a story
' Story
' Create two TextFrames and link
' the 2nd to the first to create a single story.
Dim
Dim
Set
Dim
Dim
Dim
Dim
Dim
Dim
appRef As New Illustrator.Application
docRef As Illustrator.Document
docRef = appRef.Documents.Add()
storyRef1 As Illustrator.Story
storyRef2 As Illustrator.Story
textRef1 As Illustrator.TextFrame
textRef2 As Illustrator.TextFrame
itemRef1 As Illustrator.pathItem
itemRef2 As Illustrator.pathItem
' Create the first text frame
Set itemRef1 = docRef.PathItems.Rectangle(600, 200, 50, 30)
Set textRef1 = docRef.TextFrames.AreaText(itemRef1)
textRef1.Selected = True
' create the 2nd text frame and
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
238
' link it to the first
Set itemRef2 = docRef.PathItems.Rectangle(550, 300, 50, 200)
Set textRef2 = docRef.TextFrames.AreaText(itemRef2, aiHorizontal, textRef1)
textRef1.Contents = "This is two text frames linked together as one story"
textRef2.Selected = True
appRef.Redraw
MsgBox "There is " & CStr(docRef.Stories.Count) & " story"
' Create a 3rd text frame and count the stories
Dim textRef3 As Illustrator.TextFrame
Set textRef3 = docRef.TextFrames.Add
textRef3.Contents = "Each unlinked textFrame adds a story."
textRef3.Top = 650
textRef3.Left = 200
appRef.Redraw
MsgBox "Now there are " & CStr(docRef.Stories.Count) & " stories"
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
239
Stories
A collection of Story objects. See Story for an example.
Stories properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
Count
Long
Read-only. Number of elements in the collection.
Parent
Document
Read-only. The object’s document container.
Stories methods
Method
Returns
What it does
Index
Long
Returns the index position of the object within the
collection.
Story object
Returns an object reference to the object identified by
itemKey (name or index).
(item as Story)
Item
(itemKey)
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
240
Swatch
A color swatch definition contained in a document. The swatches correspond to the swatch palette in the
Illustrator user interface. Additional swatches can be created either manually by a user or by a script. The
swatch can hold all types of color data (that is, pattern, gradient, CMYK, RGB, gray, and spot).
Swatch properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
Color
Color object
The color information for this swatch.
Name
String
The swatch’s name.
Parent
Document object
Read-only. The document that contains this swatch.
Swatch methods
Method
Returns
What it does
Delete
Nothing
Deletes the object.
()
➤ Changing the name of a swatch
This script illustrates how to change the name of the fifth swatch.
Dim appRef As New Illustrator.Application
Dim swatch5 As Illustrator.Swatch
Set swatch5 = appRef.ActiveDocument.Swatches(5)
swatch5.Name = "myColor"
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
241
Swatches
A collection of swatch objects in a document.
Swatches properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
Count
Long
Read-only. Number of elements in the collection.
Parent
Document
Read-only. The object’s document container.
Swatches methods
Method
Returns
What it does
Add
Swatch object
Creates a new Swatch object.
Long
Returns the index position of the object within the
collection.
Swatch object
Returns an object reference to the object identified by
itemKey (name or index).
Nothing
Deletes all objects in this collection.
()
Index
(item as Swatch)
Item
(itemKey)
RemoveAll
()
➤ Deleting a swatch
This script illustrates how to first obtain a swatch by index and then how to delete that swatch.
Dim appRef As New Illustrator.Application
Dim swatchToDelete As Illustrator.Swatch
Dim documentSwatches As Illustrator.Swatches
Set documentSwatches = appRef.ActiveDocument.Swatches
Set swatchToDelete = documentSwatches("Orange")
swatchToDelete.delete
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
242
Symbol
An art item that is stored in the Symbols Palette, and can be reused one or more times in the document
without duplicating the art data. Symbols are contained in documents. Instances of Symbol in a
document are associated with SymbolItem objects, which store the art-object properties. See Symbols
and SymbolItem.
Symbol properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
Name
String
The symbol’s name.
Parent
Document object
Read-only. The document that contains this symbol.
Symbol methods
Method
Returns
What it does
Delete
Nothing
Deletes the object.
object
Creates a duplicate of the object.
()
Duplicate
()
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
243
Symbols
A collection of symbol objects in a document.
Symbols properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
Count
Long
Read-only. Number of elements in the collection.
Parent
Document
Read-only. The object’s document container.
Symbols methods
Method
Returns
What it does
Add
Symbol object
Creates a new Symbol object in the document based on
the art item.
Long
Returns the index position of the object within the
collection.
Symbol object
Returns an object reference to the object identified by
itemKey (name or index).
Nothing
Deletes all objects in this collection.
(sourceArt as Object)
Index
(item as Symbol)
Item
(itemKey)
RemoveAll
()
➤ Creating symbols
' Symbols
' Create a simple path item from each graphic style
' and then add the item as a new symbol
Dim
Dim
Set
Dim
y =
appRef As New Illustrator.Application
docRef As Illustrator.Document
docRef = appRef.Documents.Add()
y As Integer
docRef.Height - 30
Dim iCount As Integer
iCount = docRef.GraphicStyles.Count
MsgBox "There are " + CStr(iCount) + " symbols."
Dim styleRef As Illustrator.GraphicStyle
Dim itemRef As Illustrator.pathItem
Dim symbolRef As Illustrator.Symbol
Dim i As Integer
i = 2
Do While (i < (iCount + 1))
' create a PathItem and apply the style to it
Set styleRef = docRef.GraphicStyles(i)
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
Set itemRef = docRef.PathItems.Rectangle(y, 100, 20, 20)
styleRef.ApplyTo itemRef
' create a new symbol from the graphic style
docRef.Symbols.Add itemRef
y = (y - (itemRef.Height + 40)) ' reduce y for next item
i = i + 1
Loop
appRef.Redraw
MsgBox "There are now " + CStr(docRef.Symbols.Count) + " symbols."
244
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
245
SymbolItem
An art item made reuseable by adding it to the Symbols palette. A SymbolItem is linked to the Symbol
from which it was created and changes if you modify the associated Symbol object.
SymbolItem properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
ArtworkKnockout
AiKnockoutState
Is this object used to create a knockout, and if so, what
kind.
BlendingMode
AiBlendModes
The mode used when compositing an object.
ControlBounds
Variant Array of 4
Doubles
Read-only. The bounds of the object including stroke
width and controls.
Editable
Boolean
Read-only. If true, this item is editable.
GeometricBounds
Variant Array of 4
Doubles
Read-only. The bounds of the object excluding stroke
width.
Height
Double
The height of the item, based on GeometricBounds.
Hidden
Boolean
If true, this item is hidden.
IsIsolated
Boolean
If true, this object is isolated.
Layer
Layer object
Read-only. The layer this item belongs to.
Left
Double
The left position of the item.
Locked
Boolean
If true, this item is locked
Name
String
The name of this item.
Opacity
Double
The opacity of the object. Range: 0.0 to 100.0
Parent
object
Read-only. The object that contains this item.
Position
Variant Array of 2
Doubles
The position of the top left corner of the item.
Selected
Boolean
If true, this item is selected.
Sliced
Boolean
If true, this item is sliced.
Symbol
Symbol object
The symbol object to which this item is linked. You
can set this property to link it to a different symbol
object.
Tags
Tags collection
object
Read-only. The tags contained in this item.
Top
Double
The top position of the item.
URL
String
The value of the Adobe URL tag assigned to this item.
VisibilityVariable Variable
The Variable bound to this item.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
Property
Value type
What it is
VisibleBounds
Variant Array of 4
Doubles
Read-only. The visible bounds of the item including
stroke width.
Width
Double
The width of the item, based on GeometricBounds.
WrapInside
Boolean
If true, the text frame object should be wrapped
inside this object.
WrapOffset
Double
The offset to use when wrapping text around this
object.
Wrapped
Boolean
If true, the text frame objects should be wrapped
around this object (text frame must be above the
object).
ZOrderPosition
Long
Read-only. The position of this art item within the
stacking order of the group or layer (Parent) that
contains the art item.
246
SymbolItem methods
Method
Returns
What it does
Copy
Nothing
Copies the item to the clipboard; the
associated document must be the
frontmost document.
Nothing
Cuts the item to the clipboard; the
associated document must be the
frontmost document.
Nothing
Deletes the object.
Object
Duplicates the art item, optionally with
the location and position for the copy.
Nothing
Moves the art item to a new location
and position.
Nothing
Scales the art item where scaleX is the
horizontal scaling factor and scaleY is
the vertical scaling factor; 100.0 = 100%
()
Cut
()
Delete
()
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])
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
247
Method
Returns
What it does
Rotate
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.
(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)
➤ Getting symbol items for symbols
' SymbolItems
' Add a symbol item to the document for every available.symbol
Dim appRef As New Illustrator.Application
Dim docRef As Illustrator.Document
Set docRef = appRef.Documents.Add()
Dim
Dim
y =
x =
x As Integer
y As Integer
docRef.Height - 30
50
Dim symbolRef As Illustrator.Symbol
Dim itemRef As Illustrator.SymbolItem
Dim i As Integer
i = 1
Do While (i < (docRef.Symbols.Count + 1))
Set symbolRef = docRef.Symbols(i)
Set itemRef = docRef.SymbolItems.Add(symbolRef)
itemRef.Top = y
itemRef.Left = x
y = y - (itemRef.Height + 20)
If (y < 60) Then
y = docRef.Height - 30
x = x + 200
Adobe Illustrator CS2
Visual Basic Scripting Reference
End If
i = i + 1
Loop
Visual Basic Object Reference
248
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
249
SymbolItems
A collection of SymbolItem objects in a document. See SymbolItem for example.
SymbolItems properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
Count
Long
Read-only. Number of elements in the collection.
Parent
object
Read-only. The object’s container.
SymbolItems methods
Method
Returns
What it does
Add
SymbolItem
object
Creates a new SymbolItem object in the document
linked to the given symbol.
Long
Returns the index position of the object within the
collection.
SymbolItem
object
Returns an object reference to the object identified by
itemKey (name or index).
Nothing
Deletes all objects in this collection.
(symbol as Symbol)
Index
(item as SymbolItem)
Item
(itemKey)
RemoveAll
()
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
250
TabStopInfo
Information about the alignment, position, and other details for a tab stop in a ParagraphAttributes
object.
TabStopInfo properties
Property
Value type
What it is
Alignment
AiTabStopAlignment
The alignment of the tab stop. Default: LeftTab
Application
Application object
Read-only. The Illustrator Application object.
DecimalCharacter
String
The character used for decimal tab stops. Default: “.”
Leader
String
The leader dot.
Position
Double
The position of the tab stop expressed in points.
Default: 0.0
➤ Getting tab stop information
' TabStopInfo
' Check the current document for textFrames.
' Display information about each TabStop found.
' verify a document is open
Dim appRef As New Illustrator.Application
If (appRef.Documents.Count < 1) Then
MsgBox "open a document that has paragraphs that contains TabStops."
Else
Dim docRef As Illustrator.Document
Set docRef = appRef.ActiveDocument
If (docRef.TextFrames.Count < 1) Then
MsgBox "open a document that has paragraphs that contains TabStops."
Else
Dim sData As String
Dim textRef As Illustrator.TextFrame
Dim paraRef As Illustrator.TextRange
Dim tabRef
For Each textRef In docRef.TextFrames
' check each TextFrame for paragraphs
For Each paraRef In textRef.Paragraphs
' check each paragraph for TabStops
For Each tabRef In paraRef.ParagraphAttributes.TabStops
sData = "TabStop Leader = " & tabRef.Leader & vbCrLf
sData = sData & "TabStop Position = " & CStr(tabRef.Position)
MsgBox sData, vbApplicationModal, "TabStop Found"
Next tabRef
Next paraRef
Next textRef
End If
End If
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
251
Tag
A tag associated with a specific art item. Tags allow you to assign an unlimited number of key-value pairs
to any item in a document.
Tag properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
Name
String
The Tag’s name.
Parent
Object
Read-only. The object that contains this Tag.
Value
String
The data stored in this Tag.
Tag methods
Method
Returns
What it does
Delete
Nothing
Deletes the object.
()
➤ Using tags
This example illustrates how to list the tags associated with the first selected item. The name and value of
the tags are listed in a new document.
Dim
Dim
Dim
Dim
Dim
Dim
Dim
appRef As New Illustrator.Application
reportDocument As Illustrator.Document
selection As Variant
selectedArt As Object
tagList As Illustrator.Tags
tagItem As Illustrator.Tag
top_offset As Single
selection = appRef.selection
If (Not IsEmpty(selection)) Then
'Get the first selected item
Set selectedArt = selection(0)
Set tagList = selectedArt.Tags
If (tagList.Count = 0) Then
MsgBox "The selected art has no tags"
Exit Sub
End If
'Create a document and add a line of text per tag
Set reportDocument = appRef.Documents.Add
top_offset = 400
For Each tagItem In tagList
Dim tagText As Illustrator.TextFrame
Set tagText = reportDocument.TextFrames.Add
tagText.Contents = "Tag: (" & tagItem.Name & " _
, " & tagItem.Value & ")"
Adobe Illustrator CS2
Visual Basic Scripting Reference
tagText.Position = Array(100, top_offset)
top_offset = top_offset - 20
Next
End If
Visual Basic Object Reference
252
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
253
Tags
A collection of Tag objects.
Tags properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
Count
Long
Read-only. Number of elements in the collection.
Parent
object
Read-only. The object’s container.
Tags methods
Method
Returns
What it does
Add
Tag object
Creates a new Tag object.
Long
Returns the index position of the object within the
collection.
Tag object
Returns an object reference to the object identified by
itemKey (name or index).
Nothing
Deletes all objects in this collection.
()
Index
(item as Tag)
Item
(itemKey)
RemoveAll
()
➤ Creating tags to mark images
This example illustrates how to mark all images in a document with a specific tag. If your script creates
temporary PageItems, you can then later look at the "MyInfo" tag. If it exist for a particular PageItem
and it’s value is "OriginalItem" you know not to delete it.
Dim
Dim
Dim
Dim
appRef As New Illustrator.Application
frontDocument As Illustrator.Document
imageArt As Object
tagRef As Illustrator.Tag
Set frontDocument = appRef.ActiveDocument
For Each imageArt In frontDocument.PageItems
If ((imageArt.PageItemType = aiPlacedItem) Or _
(imageArt.PageItemType = aiRasterItem)) Then
'Create a new Tag with the name myInfo and the value originalItem
Set tagRef = imageArt.Tags.Add
tagRef.Name = "MyInfo"
tagRef.Value = "OriginalItem"
End If
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
TextFont
Information about a font in the document, found in a CharacterAttributes object.
TextFont properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
Family
String
Read-only. The font’s family name.
Name
String
Read-only. The font’s full name.
Parent
Object
Read-only. The object’s container.
Style
String
Read-only. The font’s style name.
➤ Showing fonts in a document
' TextFont, TextFonts
' Create a new document, list all available fonts.
Dim appRef As New Illustrator.Application
Dim docRef As Illustrator.Document
Set docRef = appRef.Documents.Add()
Dim
Dim
x =
y =
x As Integer
y As Integer
30
docRef.Height - 30
Dim fontRef
Dim textRef As Illustrator.TextFrame
For Each fontRef In appRef.TextFonts
Set textRef = docRef.TextFrames.Add()
textRef.TextRange.CharacterAttributes.Size = 8
textRef.Contents = fontRef.Name + " " + fontRef.Style
textRef.Top = y
textRef.Left = x
appRef.Redraw
y = y - textRef.Height
If (y < 30) Then
'reset y,x at bottom of page
y = docRef.Height - 30
x = x + 150
End If
Next fontRef
254
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
255
TextFonts
A collection of TextFont objects.
TextFonts properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
Count
Long
Read-only. Number of elements in the collection.
Parent
object
Read-only. The object’s container.
TextFonts methods
Method
Returns
What it does
Index
Long
Returns the index position of the object within the
collection.
TextFont
object
Returns an object reference to the object identified by
itemKey (name or index).
(item as TextFont)
Item
(itemKey)
➤ Finding a font
Dim
Dim
Dim
Dim
appRef As New Illustrator.Application
fontToTest As Illustrator.TextFont
foundTextFace As Boolean
fontName As String
fontName = "Symbol"
foundTextFace = False
For Each fontToTest In appRef.TextFonts
If (fontToTest.Name = fontName) Then
foundTextFace = True
Exit For
End If
Next
If (foundTextFace) Then
MsgBox fontName & " is installed on this machine"
Else
MsgBox fontName & " is not installed on this machine"
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
256
TextFrame
A text frame contained in a Story ; there may be more than one TextFrame if the text is area text.
TextFrame properties
Property
Value type
What it is
Anchor
VariantArray of 2
Doubles
The position of the anchor point along the path
text.
Application
Application object
Read-only. The Illustrator Application object.
ArtworkKnockout
AiKnockoutState
Is this object used to create a knockout, and if so,
what kind.
BlendingMode
AiBlendModes
The mode used when compositing an object.
Characters
Characters
Read-only. All the characters in this text range.
ColumnCount
Long
The column count in the text frame (area text only).
ColumnGutter
Double
The column gutter in the text frame (area text
only).
Contents
String
The text contents of this text frame.
ContentVariable
Variable
The content variable bound to this text frame.
ControlBounds
Variant Array of 4
Doubles
Read-only. The bounds of the object including
stroke width and controls.
Editable
Boolean
Read-only. If true, this item is editable.
EndTValue
Double
The end position of text along a path, as a value
relative to the path’s segments (path text only).
FlowsLinkHorizontally
Boolean
If true, text is first flowed horizontally between
linked frames.
GeometricBounds
Variant Array of 4
Doubles
Read-only. The bounds of the object excluding
stroke width.
Height
Double
The height of the item, based on GeometricBounds.
Hidden
Boolean
If true, this item is hidden.
InsertionPoints
InsertionPoints
Read-only. All the insertion points in this text
range.
IsIsolated
Boolean
If true, this object is isolated.
Kind
AiTextType
Read-only. The type of a text frame item.
Layer
Layer object
Read-only. The layer this item belongs to.
Left
Double
The left position of the item.
Lines
Lines
Read-only. All the lines in this text range.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
257
Property
Value type
What it is
Locked
Boolean
If true, this item is locked.
Matrix
Matrix
Read-only. The transformation matrix for this text
frame.
Name
String
The name of this item.
NextFrame
TextFrame
The linked frame following this one.
Opacity
Double
The opacity of the object. Range: 0.0 to 100.0
OpticalAlignment
Boolean
If true, the optical alignment is active.
Orientation
AiTextOrientation
The orientation of the text in the frame.
Paragraphs
Paragraphs
Read-only. All the paragraphs in this text range.
Parent
object
Read-only. The object that contains this item.
Position
Variant Array of 2
Doubles
The position of the top left corner of the item.
PreviousFrame
TextFrame
The linked text frame preceding this one.
RowCount
Long
The row count in the text frame (area text only).
RowGutter
Double
The row gutter in the text frame (area text only).
Selected
Boolean
If true, this item is selected.
Sliced
Boolean
If true, this item is sliced.
Spacing
Double
The amount of spacing.
StartTValue
Double
The start position of text along a path, as a value
relative to the path’s segments (path text only).
Story
Story
Read-only. The story of the text frame.
Tags
Tags collection
object
Read-only. The tags contained in this item.
TextPath
TextPath
The path points defining the path for the text frame
(area and path text).
TextRange
TextRange
Read-only. The text range of the text frame.
TextRanges
TextRanges
Read-only. All the text in this text range.
TextSelection
Variant Array of
TextRange
The selected text (ranges) in the story.
Top
Double
The top position of the item.
URL
String
The value of the Adobe URL tag assigned to this
item.
VisibilityVariable
Variable
The Variable bound to this item.
VisibleBounds
Variant Array of 4
Doubles
Read-only. The visible bounds of the item including
stroke width.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
258
Property
Value type
What it is
Width
Double
The width of the item, based on GeometricBounds.
Words
Words
Read-only. All the words in this text range.
WrapInside
Boolean
If true, the text frame object should be wrapped
inside this object.
WrapOffset
Double
The offset to use when wrapping text around this
object.
Wrapped
Boolean
If true, the text frame objects should be wrapped
around this object (text frame must be above the
object).
ZOrderPosition
Long
Read-only. The position of this art item within the
stacking order of the group or layer (Parent) that
contains the art item.
TextFrame methods
Method
Returns
What it does
CreateOutline
GroupItem
object
Creates an outline for the frame
text.
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
Deletes this object.
Nothing
Scales the art item where scaleX is
the horizontal scaling factor 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.
()
Duplicate
([relativeObject as Object]
[, insertionLocation as AiElementPlacement])
Move
(relativeObject as Object,
insertionLocation as AiElementPlacement)
Remove
()
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])
Adobe Illustrator CS2
Visual Basic Scripting Reference
Transform
Visual Basic Object Reference
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.
(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
259
(zOrderCmd as AiZOrderMethod)
➤ Using text frames
Dim appRef As New Illustrator.Application
Dim selection As Variant
Dim frontDocument As Illustrator.Document
Dim sourceTextArt As Illustrator.TextFrame
Dim newTextArt As Illustrator.TextFrame
Dim textArtGroup As Illustrator.TextFrames
' First check the selection of the application
' It has to be a text art item in order for this script to run
selection = appRef.selection
If (IsEmpty(selection)) Then
MsgBox "Select a text item before running this script"
Exit Sub
End If
If (TypeName(selection(0)) <> "TextFrame") Then
MsgBox "Select a text item before running this script"
Exit Sub
End If
Set frontDocument = appRef.ActiveDocument
Set sourceTextArt = selection(0)
'Get the parent of the text art so new text art items can be inserted
'in the same group or layer as the selected text art is in
Set textArtGroup = sourceTextArt.Parent.TextFrames
'Create 5 new versions of the text art each rotated a bit
Dim i As Integer
For i = 1 To 5
Set newTextArt = textArtGroup.Add
newTextArt.Position = sourceTextArt.Position
newTextArt.Contents = sourceTextArt.Contents
newTextArt.Rotate 180 * i / 6
Next
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
260
TextFrames
A collection of TextFrame objects.
TextFrames properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
Count
Long
Read-only. Number of elements in the collection.
Parent
object
Read-only. The object’s container.
TextFrames methods
Method
Returns
What it does
Add
TextFrame
object
Creates a new point TextFrame object.
TextFrame
object
Creates a new area TextFrame object.
Long
Returns the index position of the
object within the collection.
TextFrame
object
Returns an object reference to the
object identified by itemKey (name or
index).
TextFrame
object
Creates an on-path text frame item.
TextFrame
object
Creates a point text frame item.
Nothing
Deletes all objects in this collection.
()
AreaText
(textPath as PathItem
[, orientation as AiTextOrientation]
[, baseFrame as TextFrame]
[, postFix as Boolean]) )
Index
(item as TextFrame)
Item
(itemKey)
PathText
(textPath as PathItem
[, startTValue as Double]
[, endTValue as Double]
[, orientation as AiTextOrientation]
[, baseFrame as TextFrame]
[, postFix as Boolean])
PointText
(anchor as Array of 2 Doubles
[, orientation as AiTextOrientation])
RemoveAll
()
➤ Adding 3 types of text frames
The following example illustrates how to add a document and create three different types of text frames.
'
'
'
'
TextFrames
Add a document and create 3 TextFrames (area, path, point).
Change the content of each TextFrame.
Remove one TextFrame and display the count.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
Dim appRef As New Illustrator.Application
Dim docRef As Illustrator.Document
Set docRef = appRef.Documents.Add()
' create 3 new textFrames (are, line, point)
' Area Text
Dim rectRef As Illustrator.pathItem
Set rectRef = docRef.PathItems.Rectangle(700, 50, 100, 100)
Dim areaTextRef As Illustrator.TextFrame
Set areaTextRef = docRef.TextFrames.AreaText(rectRef)
areaTextRef.Contents = "TextFrame #1"
areaTextRef.Selected = True
' Line Text
Dim lineRef As Illustrator.pathItem
Set lineRef = docRef.PathItems.Add()
lineRef.SetEntirePath (Array(Array(200, 700), Array(300, 550)))
Dim pathTextRef As Illustrator.TextFrame
Set pathTextRef = docRef.TextFrames.PathText(lineRef)
pathTextRef.Contents = "TextFrame #2"
pathTextRef.Selected = True
' Point Text
Dim pointTextRef As Illustrator.TextFrame
Set pointTextRef = docRef.TextFrames.Add()
pointTextRef.Contents = "TextFrame #3"
pointTextRef.Top = 700
pointTextRef.Left = 400
pointTextRef.Selected = True
appRef.Redraw
Dim sText As String
sText = "There are " & CStr(docRef.TextFrames.Count) & " TextFrames."
sText = sText & vbCrLf & "Changing contents of each TextFrame."
MsgBox sText
' change the content of each
areaTextRef.Contents = "Area TextFrame."
pathTextRef.Contents = "Path TextFrame."
pointTextRef.Contents = "Point TextFrame."
appRef.Redraw
MsgBox "Removing 1 TextFrame."
docRef.TextFrames(2).Delete
appRef.Redraw
' count again, count should reduce by 1.
MsgBox "Now there are " & CStr(docRef.TextFrames.Count) & " TextFrames."
261
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
262
TextPath
A path or list of paths for area or path text. A path consists of path points that define its geometry.
TextPath properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
Area
Double
Read-only. The area of this path in square points. If the
area is negative, the path is wound counterclockwise.
Self-intersecting paths can contain sub-areas that
cancel each other out, which makes this value zero
even though the path has apparent area.
BlendingMode
AiBlendModes
The blend mode used when compositing an object.
Clipping
Boolean
If true, this path should be used as a clipping path.
Editable
Boolean
Read-only. If true, this item is editable.
Evenodd
Boolean
If true, the even-odd rule should be used to determine
insideness.
FillColor
Color Object
The fill color of the path.
Filled
Boolean
If true, the path be filled.
FillOverprint
Boolean
If true, the art beneath a filled object should be
overprinted.
Guides
Boolean
If true, this path is a guide object.
Height
Double
The height of the group item.
Left
Double
The position of the left side of the item.
Note
String
The note text assigned to the path.
Opacity
Double
The opacity of the object. Range: 0.0 to 100.0
Parent
Layer or GroupItem
Read-only. The parent of this object.
PathPoints
PathPoints
Read-only. The path points contained in this path item.
Polarity
AiPolarityValues
The polarity of the path.
Position
Array of 2 Doubles
The position of the top left corner of the item.
Resolution
Double
The resolution of the path in dots per inch (dpi).
SelectedPathPoints
PathPoints
Read-only. All of the selected path points in the path.
StrokeCap
AiStrokeCap
The type of line capping.
StrokeColor
Color Object
The stroke color for the path.
Stroked
Boolean
If true, the path should be stroked.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
263
Property
Value type
What it is
StrokeDashes
Object
Dash lengths. Set to an empty object, {}, for a solid line.
StrokeDashOffset
Double
The default distance into the dash pattern at which the
pattern should be started.
StrokeJoin
AiStrokeJoin
Type of joints for the path.
StrokeMiterLimit
Double
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. A value of 1 specifies a
bevel join. Range: 1 to 500 Default: 4
StrokeOverprint
Boolean
If true, the art beneath a stroked object should be
overprinted.
StrokeWidth
Double
Width of the stroke.
Top
Double
The position of the top of the item.
Width
Double
The width of the item.
TextPath methods
Method
Returns
What it does
SetEntirePath
Nothing
Sets the path using the specified anchor points.
(pathPoints as PathPoints)
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
264
TextRange
A range of characters from a text item (story, text frame, character, word, line, paragraph, or another text
range).
TextRange properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
CharacterAttributes
CharacterAttributes
Read-only. The character properties for the text
range.
CharacterOffset
Long
Offset of the first character.
Characters
Characters
Read-only. All of the characters in the text
range.
CharacterStyles
CharacterStyles
Read-only. List of referenced character styles in
the text range.
Contents
String
The text string.
InsertionPoints
InsertionPoints
Read-only. All of the insertion points in this text
range.
Kerning
Long
The spacing between two characters, in
thousandths of an em.
Length
Long
Length of text range. Minimum: 0
Lines
Lines
Read-only. All the lines in this text range.
ParagraphAttributes
ParagraphAttributes
Read-only. The paragraph properties.
Paragraphs
Paragraphs
Read-only. All of the paragraphs in this text
range.
ParagraphStyles
ParagraphStyles
Read-only. A list of referenced paragraph styles
in the text range.
Parent
Object
Read-only. The object’s container.
Story
Story
Read-only. The story of the text range.
TextRanges
TextRanges
Read-only. All of the text in this text range.
TextSelection
Array of TextRange
objects
Read-only. The selected text (ranges) in the text
range.
Words
Words
Read-only. All of the words in this text range.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
265
TextRange methods
Method
Returns
What it does
ChangeCaseTo
Nothing
Changes the capitalization of text.
Nothing
Deletes the object.
Nothing
Deselects the text range.
TextRange
Duplicates the art item, optionally
specifying the location and position
for the copy.
Nothing
Moves the art item to the new
location and position.
Nothing
Selects the text range. If
addToDocument is true, adds this to the
current selection; otherwise replaces
the current selection.
(type as AiCaseChangeType)
Delete
()
DeSelect
()
Duplicate
([relativeObject as Object],
[insertionLocation as AiElementPlacement])
Move
(relativeObject as Object,
insertionLocation as AiElementPlacement)
Select
([addToDocument as Boolean])
➤ Using a text range
Dim
Dim
Dim
Dim
Dim
Dim
Dim
appRef As New Illustrator.Application
textArt As Illustrator.TextFrame
textArtRange As Illustrator.TextRange
textWord As Illustrator.TextRange
wordLen As Integer
charsToChange As Integer
firstChars As Illustrator.TextRange
For Each textArt In appRef.ActiveDocument.TextFrames
Set textArtRange = textArt.TextRange
For Each textWord In textArtRange.Words
'If word is longer than 2 characters
'resize just the first 2 characters
'otherwise, resize the whole word
wordLen = Len(textWord.Contents)
If (wordLen < 2) Then
charsToChange = wordLen
Else
charsToChange = 2
End If
'resize the word
If (charsToChange > 0) Then
'Omit 1st arg to go from the beginning to
'character number charsToChange-1 (First character is index 0)
Dim i
For i = 1 To charsToChange
Set firstChars = textWord.Characters(i)
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
firstChars.CharacterAttributes.Size =_
firstChars.CharacterAttributes.Size * 1.5
Next
End If
Next
Next
266
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
267
TextRanges
A collection of TextRange objects.
TextRanges properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
Count
Long
Read-only. Number of elements in the collection.
Parent
Document
Read-only. The object’s document container.
TextRanges methods
Method
Returns
What it does
Index
Long
Returns the index position of the object within the
collection.
TextRange
object
Returns an object reference to the object identified by
itemKey (name or index).
Nothing
Deletes all objects in this collection.
(item as TextRange)
Item
(itemKey)
RemoveAll
()
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
268
TracingObject
A tracing object, which associates source raster art item with a vector-art plugin group created by tracing.
Scripts can initiate tracing using PlacedItem.Trace or RasterItem.Trace. The resulting
PluginItem object represents the vector art group, and has this object in its Tracing property.
A script can force the tracing operation by calling the document’s Redraw method. The operation is
asynchronous, so a script should call Redraw after creating the tracing object, but before accessing its
properties or expanding the tracing to convert it to an art item group.
The read-only properties that describe the tracing result have valid values only after the first tracing
operation completes. A value of 0 indicates that the operation has not yet been completed.
TracingObject properties
Property
Value type
What it is
AnchorCount
Long
Read-only. The number of anchors in the tracing result.
Application
Application
Read-only. The Illustrator Application object.
AreaCount
Long
Read-only. The number of areas in the tracing result.
ImageResolution
Real
Read-only. The resolution of the source image in pixels per
inch.
Parent
Object
Read-only. The object’s container.
PathCount
Long
Read-only. The number of paths in the tracing result.
SourceArt
PlacedItem or
RasterItem
The raster art used to create the associated vector-art plugin
group.
TracingOptions
TracingOptions
The options used to convert the raster artwork to vector art.
UsedColorCount
Long
Read-only. The number of colors used in the tracing result.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
269
TracingObject methods
Method
Returns
What it does
ExpandTracing
GroupItem
object
Converts the vector art into a new group item. The new
GroupItem object replaces the PluginItem object in the
document. By default, viewed is false, and the new group
contains only the tracing result (the filled or stroked paths). If
viewed is true, the new group retains additional information
that was specified for the viewing mode, such as outlines and
overlays.
([viewed As Boolean])
Deletes this object and its associated PluginItem object. Any
group-level attributes that were applied to the plugin item
are applied to the top level of the new group item.
ReleaseTracing
()
PlacedItem
or
RasterItem
object
Reverts the artwork in the document to the original source
raster art and removes the traced vector art. Returns the
original object used to create the tracing, and deletes this
object and its associated PluginItem object.
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
270
TracingOptions
A set of options used in converting raster art to vector art by tracing.
TracingOptions properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
CornerAngle
Double
The sharpness, in degrees of a turn in the original
image that is considered a corner in the tracing
result path. Range: 0 to 180
Fills
Boolean
If true, trace with fills. At least one of Fills or
Strokes must be true.
LivePaintOutput
boolean
If true, result is LivePaint art. If false, it is classic
art.
Note: A script should only set this value in
preparation for a subsequent expand
operation. Leaving a tracing on the
artboard when this property is true can
lead to unexpected application behavior.
MaxColors
Long
The maximum number of colors allowed for
automatic palette generation. Used only if
TracingMode is color or grayscale. Range: 2 to 256
MaxStrokeWeight
Double
The maximum stroke weight in points, when
Strokes is true. Range: 0.01 to 100.0
MinArea
Long
The smallest feature, in square pixels, that is
traced. For example, if it is 4, a feature of 2 pixels
wide by 2 pixels high is traced.
MinStrokeLength
Double
The minimum length in pixels of features in the
original image that can be stroked, when Strokes
is true. Smaller features are omitted. Range: 0.0 to
200.0 Default: 20.0
OutputToSwatches
Boolean
If true, named colors (swatches) are generated for
each new color created by the tracing result. Used
only if TracingMode is color or grayscale.
Palette
String
The name of a color palette to use for tracing. If
the empty string, use the automatic palette. Used
only if TracingMode is color or grayscale.
Parent
Object
Read-only. The object’s container.
PathFitting
Double
The distance between the traced shape and the
original pixel shape. Lower values create a tighter
path fitting. Higher values create a looser path
fitting. Range: 0.0 to 10.0
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
271
Property
Value type
What it is
PreprocessBlur
Double
The amount of blur used during preprocessing, in
pixels. Blurring helps reduce small artifacts and
smooth jagged edges in the tracing result. Range:
0.0 to 2.0
Preset
String
Read-only. The name of a preset file containing
these options.
Resample
Boolean
If true, resample when tracing. (This setting is not
captured in a preset file.)
Always true when the raster source art is placed
or linked.
ResampleResolution
Double
The resolution to use when resampling in pixels
per inch (ppi). Lower resolution increases the
speed of the tracing operation. (This setting is not
captured in a preset file.)
Strokes
Boolean
If true, trace with strokes. At least one of Fills or
Strokes must be true. Used only if TracingMode is
black-and-white.
Threshold
Long
The threshold value of black-and-white tracing.
All pixels with a grayscale value greater than this
are converted to black. Used only if TracingMode is
black-and-white. Range: 0 to 255
TracingMode
AiTracingModeType
The color mode for tracing.
ViewRaster
AiViewRasterType
The view for previews of the raster image. (This
setting is not captured in a preset file.)
ViewVector
AiViewVectorType
The view for previews of the vector result. (This
setting is not captured in a preset file.)
TracingOptions methods
Method
Returns
What it does
LoadFromPreset
Boolean
Loads a set of options from the specified preset, as found
in the Application.TracingPresetList array.
Boolean
Saves this set of options in the specified preset. Use a
name found in the Application.TracingPresetList array,
or a new name to create a new preset. For an existing
preset, overwrites an unlocked preset and returns true.
Returns false if the preset is locked.
(presetName as String)
StoreToPreset
(presetName as String)
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
Variable
A dynamic object used to create data-driven graphics. For an example, see DataSets.
Variable properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
Kind
AiVariableKind
The variable’s type.
Name
String
The name of the variable.
PageItems
PageItems
Read-only. All of the artwork in this document.
Parent
Document
Read-only. The document that contains this object.
Variable methods
Method
Returns
What it does
Delete
Nothing
Deletes the object.
()
272
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
273
Variables
A collection of Variable objects in a document.
Variables properties
V
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
Count
Long
Read-only. Number of elements in the collection.
Parent
Document
Read-only. The object’s document container.
Variables methods
Method
Returns
What it does
Add
Variable
object
Creates a new Variable object.
Long
Returns the index position of the object within the
collection.
Variable
object
Returns an object reference to the object identified by
itemKey (name or index).
Nothing
Deletes all objects in this collection.
()
Index
(item as Variable)
Item
(itemKey)
RemoveAll
()
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
274
View
A document view in an Illustrator document, which represents a window view onto a document. Scripts
cannot create new views, but can modify some properties of existing views, including the center point,
screen mode, and zoom.
View properties
Property
Value type
What it is
Application
Application object
Read-only. The Illustrator Application object.
Bounds
Variant Array of 4
Doubles
Read-only. The bounding rectangle of this View relative to
the current document’s bounds.
CenterPoint
Variant Array of 2
Doubles
The center point of this View relative to the current
document’s bounds.
Parent
Document object
Read-only. The document that contains this object.
ScreenMode
AiScreenMode
The mode of display for this view.
Zoom
Double
The zoom factor of this view, where 100.0 is 100%
➤ Setting a view
This example illustrates how to set the first view of the frontmost document to full screen mode.
Dim appRef As New Illustrator.Application
Dim frontDoc As Illustrator.Document
Set frontDoc = appRef.activeDocument
Dim viewsRef As Illustrator.Views
Set viewsRef = frontDoc.Views
Dim firstView As Illustrator.View
Set firstView = viewsRef(1)
firstView.ScreenMode = aiFullScreen
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
275
Views
A collection of View objects in a document.
Views properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
Count
Long
Read-only. Number of elements in the collection.
Parent
Document
Read-only. The object’s document container.
Views methods
Method
Returns
What it does
Index
Long
Returns the index position of the object within the
collection.
View object
Returns an object reference to the object identified by
itemKey (name or index).
(item as View)
Item
(itemKey)
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
276
Words
A collection of words in a text item, where each word is a TextRange object.
Words properties
Property
Value type
What it is
Application
Application
Read-only. The Illustrator Application object.
Count
Long
Read-only. Number of elements in the collection.
Parent
Object
Read-only. The object’s container.
Words methods
Method
Returns
What it does
Add
TextRange
Adds a new word with specified
text contents at the specified
location in the current document.
If location is not specified, adds the
new word to the containing text
frame after the current text
selection or insertion point.
TextRange
Inserts text at the beginning of the
range.
Long
Returns the index position of the
object within the collection.
TextRange
Returns an object reference to the
object identified by itemKey (name
or index).
Nothing
Deletes all objects in this
collection.
(contents as String
[, relativeObject as TextFrame]
[, insertionLocation as AiElementPlacement])
AddBefore
(contents as String)
Index
(itemPtr as TextRange)
Item
(itemKey)
RemoveAll
()
➤ Counting words in a document
Displays the total number of words contained in all TextFrameItems in the current document.
Dim
Dim
Dim
Dim
appRef As New Illustrator.Application
numWords As Integer
textArt As Illustrator.TextFrame
textArtRange As Illustrator.TextRange
If appRef.Documents.Count > 0 Then
numWords = 0
For Each textArt In appRef.ActiveDocument.TextFrames
numWords = numWords + textArt.TextRange.Words.Count
Next
MsgBox ("There are " & numWords & " words in the document.")
End If
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
Enumerations reference
These enumeration values are defined for object properties in the Visual Basic dictionary.
Enumeration type
Values
AiAlternateGlyphsForm
aiDefaultForm
aiTraditional
aiExpert
aiJIS78Form
aiJIS83Form
aiHalfWidth
aiThirdWidth
aiQuarterWidth
aiFullWidth
aiProportionalWidth
AiAutoKernType
aiNoAutoKern
aiAuto
aiOptical
AiAutoLeadingType
aiBottomToBottom
aiTopToTop
AiBaselineDirectionType
aiStandardBaseline
aiTateChuYokoBaseline
aiVerticalRotatedBaseline
AiBlendAnimationType
aiInBuild
aiInSequence
aiNoBlendAnimation
AiBlendModes
aiColorBlend
aiColorBurn
aiColorDodge
aiDarken
aiDifference
aiExclusion
aiHardLight
aiHue
aiLighten
aiLuminosity
aiMultiply
aiNormalBlend
aiOverlay
aiSaturation
aiScreen
aiSoftLight
AiBurasagariTypeEnum
aiBurasagariNone
aiBurasagariStandard
aiBurasagariForced
AiCaseChangeType
aiUpperCase
aiLowerCase
aiTitleCase
aiSentenceCase
AiColor
aiColorCMYK =1
aiColorGradient =6
aiColorGray = 2
aiColorNone = 0
aiColorPattern = 5
aiColorRGB =3
aiColorSpot =4
What it means
The blend mode used
when compositing an
object
A color space.
277
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
278
Enumeration type
Values
What it means
AiColorConversion
aiColorConversionRepurpose
aiColorConversionToDest
aiColorConversionNone
AiColorDestination
aiColorDestinationDocCMYK
aiColorDestinationDocRGB
aiColorDestinationProfile
aiColorDestinationWorkingCMYK
aiColorDestinationWorkingRGB
aiColorDestinationNone
AiColorDitherMethod
aiDiffusion
aiNoise
aiNoReduction
aiPatternDither
AiColorModel
aiRegistration
aiProcess
aiSpot
AiColorProfile
aiIncludeAllProfile
aiIncludedeStProfile
aiIncludeRGBProfile
aiLeaveProfileUnchanged
aiColorProfileNone
AiColorReductionMethod
aiAdaptive
aiPerceptual
aiSelective
aiWeb
The method used to
reduce the number of
colors in exported GIF and
PNG8 images
AiCompatibility
aiIllustrator3
aiJapaneseVersion3
aiIllustrator8
aiIllustrator9
aiIllustrator10
aiIllustrator11
aiIllustrator12
The version of the
Illustrator file format to
create when saving an EPS
or Illustrator file
The method used to dither
colors in exported GIF and
PNG8 images
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
279
Enumeration type
Values
What it means
AiCompressionQuality
aiJPEGHigh
aiJPEGLow
aiJPEGMaximum
aiJPEGMedium
aiJPEGMinimum
aiNoCompression
aiZIP4Bit
aiZIP8Bit
aiAutomaticJPEGMinimum
aiAutomaticJPEGLow
aiAutomaticJPEGMedium
aiAutomaticJPEGHigh
aiAutomaticJPEGMaximum
aiAutomaticJPEG2000Minimum
aiAutomaticJPEG2000Low
aiAutomaticJPEG2000Medium
aiAutomaticJPEG2000High
aiAutomaticJPEG2000Maximum
aiAutomaticJPEG2000Lossless
aiJPEG2000Minimum
aiJPEG2000Low
aiJPEG2000Medium
aiJPEG2000High
aiJPEG2000Maximum
aiJPEG2000Lossless
The quality of bitmap
compression used when
saving a PDF file
AiCropOptions
aiCropJapanese
aiCropStandard
The style of a document’s
cropping box
AiDocumentColorSpace
aiDocumentCMYKColor
aiDocumentRGBColor
The color space of a
document
AiDocumentType
aiEPS
aiIllustrator
aiPDF
The file format used to
save a file
AiDownsampleMethod
aiNoDownsample
aiAverageDownsample
aiSubsample
aiBicubicDownsample
AiElementPlacement
aiPlaceInside
aiPlaceAtBeginning
aiPlaceAtEnd
aiPlaceBefore
aiPlaceAfter
AiEPSPostScriptLevelEnum
aiLevel2
aiLevel3
Specifies the PostScript
level to use when saving
an EPS file
AiEPSPreview
aiBWMacintosh
aiBWTIFF
aiColorMacintosh
aiColorTIFF
aiNoPreview
aiTransparentColorTIFF
The preview image format
used when saving an EPS
file
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
280
Enumeration type
Values
What it means
AiExportType
aiGIF
aiJPEG
aiPhotoshop
aiPNG24
aiPNG8
aiSVG
aiFlash
The file format used to
export a file
AiFigureStyleType
aiDefaultFigureStyle
aiTabular
aiTabularOldStyle
aiProportional
aiProportionalOldStyle
AiFlashExportStyle
aiAsFlashFile
aiLayersAsFrames
aiLayersAsFiles
AiFlashImageFormat
aiLossless
aiLossy
AiFlashJPEGMethod
aiJPEGStandard
aiJPEGOptimized
AiFontBaselineOption
aiNormalBaseline
aiSuperScript
aiSubScript
AiFontCapsOption
aiNormalCaps
aiSmallCaps
aiAllCaps
aiAllSmallCaps
AiFontOpenTypePositionOption
aiOpenTypeDefault
aiOpenTypeSuperScript
aiOpenTypeSubScript
aiNumerator
aiDenominator
AiFontSubstitutionPolicy
aiSubstituteOblique
aiSubstituteTint
aiSubstituteDevice
AiGradientType
aiLinearGradient
aiRadialGradient
The type of the gradient,
radial or linear
AiImageColorSpace
aiImageCMYK
aiImageGrayScale
aiImageRGB
The color space of a raster
item or an exported
Photoshop 5 file
AiInkPrintStatus
aiDisableInk
aiEnableInk
aiConvertInk
AiInkType
aiCyanInk
aiMagentaInk
aiYellowInk
aiBlackInk
aiCustomInk
AiJavaScriptExecutionMode
aiNeverShowDebugger
aiDebuggerOnError
aiBeforeRunning
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
Enumeration type
Values
What it means
AiJustification
aiCenter
aiLeft
aiRight
aiFullJustifyLastLineLeft
aiFullJustifyLastLineRight
aiFullJustifyLastLineCenter
aiFullJustify
The alignment or
justification for a
paragraph of text
AiKinsokuOrderEnum
aiPushIn
aiPushOutFirst
aiPushOutOnly
AiKnockoutState
aiDisabled
aiEnabled
aiInherited
aiKnockoutUnknown
AiLanguageType
aiBokmalNorwegian
aiBrazillian Portuguese
aiBulgarian
aiCanadianFrench
aiCatalan
aiChinese
aiCzech
aiDanish
aiDutch
aiEnglish
aiFinnish
aiGreek
aiHungarian
aiIcelandic
aiItalian
aiJapanese
aiNynorskNorwegian
aiOldGerman
aiPolish
aiRomanian
aiRussian
aiSpanish
aiSerbian
aiStandardFrench
aiStandardGerman
aiStandardPortuguese
aiSwedish
aiSwissGerman
aiTurkish
aiUKEnglish
aiUkranian
AILayerOrderType
aiTopDown
aiBottomUp
AiMonochromeCompression
aiCCIT3
aiCCIT4
aiMonoZIP
aiNoMonoCompression
aiRunLength
281
The type of knockout to
use on a PageItem
The type of monochrome
bitmap compression to use
when saving a PDF
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
282
Enumeration type
Values
What it means
AiOutputFlattening
aiPreserveAppearance
aiPreservePaths
Specifies how
transparency should be
flattened when saving EPS
and Illustrator file formats
with compatibility set to
versions of Illustrator less
than 9
AiPageItemType
aiCompoundPathItem = 1
aiGraphItem = 2
aiGroupItem =3
aiLegacyTextItem = 11
aiMeshItem = 4
aiPathItem = 5
aiPlacedItem = 6
aiPluginItem =7
aiRasterItem =8
aiSymbolItem = 9
aiTextFrame = 10
The type (class) of art item
that is represented by a
particular PageItem
AiPageMarksStyle
aiPageMarksRoman
aiPageMarksJapanese
AiPathPointSelection
aiAnchorPoint
aiLeftDirection
aiLeftRightPoint
aiNoSelection
aiRightDirection
AiPDFBoxType
aiPDFArtBox
aiPDFCropBox
aiPDFTrimBox
aiPDFBleedBox
aiPDFMediaBox
aiPDFBoundingBox
AiPDFChangesAllowedEnum
aiChange128None
aiChange128EditPage
aiChange128FillForm
aiChange128Commenting
aiChange128AnyChanges
aiChange40None
aiChange40PageLayout
aiChange40Commenting
aiChange40AnyChanges
AiPDFCompatibility
aiAcrobat4
aiAcrobat5
aiAcrobat6
aiAcrobat7
AiPDFOverprint
aiPreservePDFOverprint
aiDiscardPDFOverprint
AiPDFPrintAllowedEnum
aiPrint128None
aiPrint128LowResolution
aiPrint128HighResolution
aiPrint40None
aiPrint40HighResolution
Specifies which points, if
any, of a path point are
selected
The version of the Acrobat
file format to create when
saving a PDF file
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
Enumeration type
Values
AiPDFTrimMarkWeight
aiTrimMarkWeight0125
aiTrimMarkWeight025
aiTrimMarkWeight05
AiPDFXStandard
aiPDFX1A2001
aiPDFX1A2003
aiPDFX32001
aiPDFX32003
aiPDFXNone
AiPhotoshopCompatibility
aiPhotoshop5
aiPhotoshop8
AiPointType
aiCorner
aiSmooth
AiPolarityValues
aiPositive = 1
aiNegative = –1
AiPostScriptImageCompressionType aiImageCompressionNone
aiImageCompressionRLE
aiImageCompressionJPEG
AiPrintArtworkDesignation
aiVisiblePrintableLayers
aiVisibleLayers
aiAllLayers
AiPrintColorIntent
aiPerceptualIntent
aiSaturationIntent
aiRelativeColorimetric
aiAbsoluteColorimetric
AiPrintColorProfile
aiOldstyleProfile
aiSourceProfile
aiPrinterProfile
aiCustomProfile
AiPrintColorSeparationMode
aiComposite
aiOnHostSeparation
aiInRIPSeparation
AiPrinterColorMode
aiColorPrinter
aiGrayscalePrinter
aiBlackAndWhitePrinter
AiPrinterPostScriptLevelEnum
aiPSLevel1
aiPSLevel2
aiPSLevel3
AiPrinterTypeEnum
aiUnknownPrinterType
aiPostScriptPrinter
aiNonPostScriptPrinter
AiPrintFontDownloadMode
aiDownloadNone
aiDownloadSubset
aiDownloadComplete
AiPrintingBounds
aiArtboardBounds
aiArtworkBounds
aiCropBounds
What it means
The type of path point,
either a curve or a corner
283
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
284
Enumeration type
Values
What it means
AiPrintOrientation
aiPortrait
aiLandscape
aiReversePortrait
aiReverseLandscape
AiPrintPosition
aiTranslateTopLeft
aiTranslateTop
aiTranslateTopRight
aiTranslateLeft
aiTranslateCenter
aiTranslateRight
aiTranslateBottomLeft
aiTranslateBottom
aiTranslateBottomRight
AiPrintTiling
aiTileSingleFullPage
aiTileFullPages
aiTileImageableAreas
AiRasterLinkState
aiDataFromFile
aiDataModified
aiNoData
The status of a raster item’s
linked image, if the image
is stored externally
AiRulerUnits
aiUnitsCM
aiUnitsInches
aiUnitsMM
aiUnitsPicas
aiUnitsPoints
aiUnitsQ
aiUnitsUnknown
The default measurement
units for the rulers in a
document
AiSaveOptions
aiDoNotSaveChanges
aiPromptToSaveChanges
aiSaveChanges
Save options provided
when closing a document
AiScreenMode
aiDesktop
aiFullScreen
aiMultiWindow
The mode of display for a
view
AiStrokeCap
aiButtEndCap
aiProjectingEndCap
aiRoundEndCap
The type of line capping
for a path stroke
AiStrokeJoin
aiBevelEndJoin
aiMiterEndJoin
aiRoundEndJoin
The type of joints for a
path stroke
AiStyleRunAlignmentType
aiAlignBottom
aiICFBottom
aiRomanBaseline
aiAlignCenter
aiICFTop
aiAlignTop
AiSVGCSSPropertyLocation
aiEntities
aiStyleAttributes
aiStyleElements
aiPresentationAttributes
How should the CSS
properties of the
document be included in
an exported SVG file?
AiSVGDocumentEncoding
aiASCII
aiUTF16
aiUTF8
How text is encoded when
exporting an SVG file
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
285
Enumeration type
Values
What it means
AiSVGDTDVersion
aiSVG1_0
aiSVG1_0
aiSVG1_1
aiSVGBasic1_1
aiSVGTiny1_1
aiSVGTiny1_1Plus
SVG version compatibility
for exported file
AiSVGFontSubsetting
aiAllGlyphs
aiCommonEnglish
aiCommonRoman
aiGlyphsUsed
aiGlyphsUsedPlusEnglish
aiGlyphsUsedPlusRoman
aiNoFonts
What font glyphs should
be included in an exported
SVG file?
AiSVGFontType
aiCEFFont
aiOutlineFont
aiSVGFont
Types for fonts included in
exported SVG files
AiTabStopAlignment
aiCenterTab
aiDecimalTab
aiLeftTab
aiRightTab
The alignment of a tab
stop
AiTextOrientation
aiHorizontal
aiVertical
The orientation of text in a
AiTextType
aiAreaText
aiPathText
aiPointText
The type of text art
displayed by this object
AiTracingModeType
aiTracingModeBlackAndWhite
aiTracingModeColor
aiTracingModeGray
AiTransformation
aiTransformBottom
aiTransformBottomLeft
aiTransformBottomRight
aiTransformCenter
aiTransformDocumentOrigin
aiTransformLeft
aiTransformRight
aiTransformTop
aiTransformTopLeft
aiTransformTopRight
AiTrappingType
aiNormalTrapping
aiTransparent
aiOpaque
aiIgnoreOpaque
AiUserInteractionLevel
aiDontDisplayAlerts = –1
aiDisplayAlerts = 2
AiVariableKind
aiGraph
aiImage
aiTextual
aiUnknownKind
aiVisibility
TextFrameItem
The point to use as the
anchor point about which
an object is rotated,
resized or transformed
The enumerated type of
the kind of variable
Adobe Illustrator CS2
Visual Basic Scripting Reference
Visual Basic Object Reference
Enumeration type
Values
AiViewRasterType
aiTracingViewRasterAdjustedImage
aiTracingViewRasterNoImage
aiTracingViewRasterOriginalImage
aiTracingViewRasterTransparentImage
AiViewVectorType
aiTracingViewVectorNoTracingResult
aiTracingViewVectorOutlines
aiTracingViewVectorOutlinesWithTracing
aiTracingViewVectorTracingresult
AiWariChuJustificationType
aiWariChuLeft
aiWariChuRight
aiWariChuCenter
aiWariChuFullJustifyLastLineLeft
aiWariChuFullJustifyLastLineRight
aiWariChuFullJustifyLastLineCenter
aiWariChuAutoJustify
AiZOrderMethod
aiBringForward
aiBringToFront
aiSendBackward
aiSendToBack
286
What it means
The raster viewing mode
for tracing.
The vector viewing mode
for tracing.
The method used to
arrange an art item’s
position in the stacking
order of its parent group or
layer, as specified with the
ZOrder method
Index
A
actions
about 45
compared to scripting 45
executing 77
aki properties 66
anchor points 64
application properties 74
application version 61
applying styles
about 66
brush 79
character 87
graphic 125
paragraph 171
arithmetic operators 52
array value 50
art items
bitmaps 226
creating a group 136
grouped 133
plug-ins 198
properties 174
providing access 162
raster 226
symbols 242, 245
tags 251
attributes, about 66
B
Boolean value 50
brackets, about 73
brushes
about 79
displaying all 80
buttons, adding to forms 57
C
centimeters, conversion 67
character styles
See also fonts
about 66
counting characters 85
creating and applying 87
setting attributes 83, 86
specifying properties 81
classes
objects 49
spot colors 235
clipboard
clearing before quitting 71
copying and pasting 77
closing documents 103
CMYK colors
spot 234
swatches 64
translating 89, 230
collections, object 49
colors
CMYK. See CMYK colors
document properties 104
gradients. See gradients
gray, using 132
none 160
pattern 185
pattern fill settings 184
print management 206
removing fill 160
RGB. See RGB colors
screen spot functions 233
separation management 207
separation screen information 231
specifying 89
spot. See spot colors
stop definitions 122
swatches. See swatches
using 64
commands
concatenation 71
viewing 57
comments, about 50
comparison operators 52
compound paths
counting 94
creating 93
shared values 90
concatenation operators 52
conditional statements 52
containment, object 62
continuation character 50
control bounds 69
control structures 53
conversions, measurements 67
coordinates, about 67
copying. See clipboard
CS2 version changes 47
cutting. See clipboard
D
datasets
about 95
creating 96
using 71
debugging process 54
deleting
287
Adobe Illustrator CS2
Visual Basic Scripting Reference
layers 62, 147
swatches 241
variables 71
dim statement, declaring variables 51
dimensions, page items 68
documents
closing 103
color model 64
color spaces 104
copy and paste 77
copying mesh items between 158
counting layers 146
counting paragraphs 169
counting words 276
default settings 98, 103
EPS options 105
Flash export options 107
GIF options 109
JPEG options 111
listing inks 139
object containment 62
opening Photoshop 193
opening reference 76
page item positioning 68
PDF options 188
Photoshop options 112
placed items 194
PNG options 113, 115
printing 69
saving options 138
saving to Illustrator 8 138
showing fonts 254
SVG options 116
SWF options 107
units of measure 66
using contents 63
double value 50
E
elements, object 49
em space units 67
enumeration values reference 277
EPS document properties 105
error handling, about 54
executing
actions 77
scripts 46
exporting files
Flash 107
GIF 109
JPEG 111
Photoshop 112
PNG8 113
PNG24 115
SVG 116
F
files
See also individual file types
288
external references 162
opening options 161
preferences 205
fill colors
removing 160
setting to patterns 184
fixed points 68
fixed rectangles 68
Flash files, exporting 107
flattening options 214
fonts
See also character styles
finding 255
information 254
printing options 216
showing 254
frames, text. See text frames
G
geometric bounds 69
GIF files, exporting 109
gradients
adding stops 123
changing color 120
color specifications 120
creating and applying 118
mesh items 155
properties 118, 121
removing 121
stop definitions 122
graph items
properties 127, 131
rotating 129
graphic styles
applying 125
counting 126
gray color, using 132
group items
about 133
creating 136
creating from plugin items created by tracing 200, 228, 268,
270
importing PDFs 137
properties 137
H
handlers, creating 53
height, maximum value allowed 69
“Hello World” script
creating 57
improving 59
I
if statements 52
Illustrator
launching 71
Plug-in Software Development Kit Function Reference 64
quitting 71
Adobe Illustrator CS2
Visual Basic Scripting Reference
saving to version 8 138
specifying a version 61
type library 57, 73
User’s Guide 64
images, marking with tags 253
importing PDFs 137
inches, conversion 67
inheritance, objects 49
inks, properties 139
insertion points
about 141
adding spaces 141
installing scripts 46
invoking JavaScript 77
J
JavaScript, invoking 77
job options, printing 217
JPEG files, exporting 111
K
key-value pairs 50
L
l 153
launching Illustrator 71
layers
about 144
counting 146
deleting 62, 147
object containment 62
left direction 64
legacy text
properties 149, 152
updating 161
lines, counting 153
listing
inks in documents 139
printers 212
local attributes 66
long value 50
M
matrices
about 70, 154
applying 154
concatenation commands 71
pattern colors 185
transformation 70, 154
measurements, about 66
mesh items
copying between documents 158
locking 157
properties 155
methods
about 52
alphabetical reference 73
millimeters, conversion 67
289
N
numeric value types 50
O
object model
basic concepts 48
diagram 56
text 65
object references
about 49, 60
value types 50
objects
about 48
alphabetical reference 73
cannot be created by a script 61
classes 49
collections 49
container object 74
containment 62
creating in Visual Basic 60
dimensions 68
direct creation required 61
elements 49
hierarchy 56
inheritance 49
model. See object model
properties 48, 49
references. See object references
response to commands 48
viewing 57
opening documents
code example 76
Photoshop 193
operators, about 52
P
page items
accessing 162
getting a particular type 163
positioning and dimensions 68
paper
about 164
information 223
using objects 164
paragraph styles
creating and applying 171
properties 173
paragraphs
associating styles 171
counting 169
modifying attributes 167
properties 166, 169
pasting. See clipboard
path items
collections 179
properties 174
path points
about 181
adding 183
Adobe Illustrator CS2
Visual Basic Scripting Reference
modifying 181
paths
about 64
compound 90
consisting of straight lines 177
creating compound 93
selecting 92
setting attributes 177
shaping 181
patterns
creating colors 185
fill settings 184
modifying 185
removing 187
PDF files
importing 137
opening 188
save options 189
setting preferences 205
Photoshop files
exporting 112
opening 193
setting preferences 205
picas, conversion 67
placed items
about 194
changing selection 196
collections 197
plug-in items
collections 202
copying 200
properties 198
plugin items
creating by tracing 200, 228, 268, 270
PNG files, exporting
PNG8 113
PNG24 115
points
conversion units 67
fixed 68
zero 68
PostScript print options 224
PPD files, about 203
printing
associating printers with information 211
collecting information 219
color management 206
color separation screens 231
color separations 207
coordinates 209
finding printer information 212
flattening 214
font options 216
job information 217
listing printers 212
media parameters 209
page marks 221
paper information 223
PostScript options 224
printer configuration information 211
290
settings options 70, 219
Q
Qs (unit), conversion 67
quitting Illustrator 71
R
ranges, text. See text ranges
raster art
converting to vector art by tracing 200, 228, 268, 270
raster items
creating 226
getting properties 229
records, matrix 154
rectangles
creating 180
fixed 68
reference value type 50
references, object. See object references
requirements, system 46
RGB colors
about 230
settings 230
spot 234
swatches 64
translating 89
right direction 64
rotating
graph items 129
objects 70
routines, creating 53
S
saving files
Illustrator version 8 138
options 138
screens
getting information 231
spot function 233
script examples
coding style 73
“Hello World” 57
improved “Hello World” 59
VBScript 58
scripting
about 44, 48
adding features 59
automating 48
basic concepts 50
breaking long lines 50
comments 50
compared to actions 45
printing documents 69
using 44
value types 50
Visual Basic example 57
scripts
executing 46
Adobe Illustrator CS2
Visual Basic Scripting Reference
file extensions 45
installing 46
menu 45
properties 52
subroutines 53
support in Illustrator 45
SDK 64
selections
accessing 77
using 63
separation screens
getting information 231
spot function 233
soft return character 50
Software Development Kit 64
software requirements 46
spaces, adding 141
spot colors
about 234
applying tint 235
classes 235
creating 234
documents 236
removing 236
spot functions 233
stop definitions
adding 123
properties 122
stories
about 237
linking text frames 237
properties 239
string value 50
subclasses, about 49
subroutines, creating 53
superclasses, about 49
SVG files, exporting 116
swatches
about 240
changing names 240
deleting 241
using 64
SWF files, exporting 107
symbols
about 65, 242
creating 243
getting items 247
items 65, 245, 249
system requirements 46
T
tab stops, using 250
tags
about 251
creating to mark images 253
terminology, object model 48
testing. See debugging process
text
art items 65
291
counting lines 153
counting paragraphs 169
font information 254
frames. See text frames
insertion points 141
legacy 149, 152, 161
linking to stories 237
modifying paragraph attributes 167
paragraph properties 166
ranges. See text ranges
value types 50
text frames
adding 260
properties 256
stories 65
using 259
using text art 65
text ranges
about 264
content 66
lines of text 153
using 265, 267
using text art 65
tints, applying to spot colors 235
tracing 200, 228, 268, 270
loading and saving presets options 271
transformation matrices
about 70
applying 154
troubleshooting. See debugging process
type library
about 57
alphabetical listing 73
U
underscore character 50
units of measure 66
user interaction levels 72
user-defined value 50
V
values
enumeration 277
list of types 50
variables
about 51
assigning values 51
declaring 51
deleting 71
naming 51
using 71, 272, 273
VBA
changes in Illustrator CS2 47
scripting language 58
VBScript 58
vector art
creating from raster art by tracing 200, 228, 268, 270
versions of Illustrator, specifying 61
views, using 274, 275
Adobe Illustrator CS2
Visual Basic Scripting Reference
visible bounds 69
Visual Basic
buttons and forms 57
changes in Illustrator CS2 47
continuation character 50
debugging 54
resources 55
scripting language 58
syntax issues with methods 62
type library 57, 73
292
words
about 276
changing to gray color 132
counting 276
X
X axis 67, 179
Y
Y axis 67, 179
W
watch window 54
web site, Adobe Solutions Network 44, 64
width, maximum value allowed 69
Z
zero point 68
Adobe Illustrator CS2
Visual Basic Scripting Reference
293
Adobe Illustrator CS2
Visual Basic Scripting Reference
294
Source Exif Data:
File Type : PDF File Type Extension : pdf MIME Type : application/pdf PDF Version : 1.6 Linearized : Yes Encryption : Standard V2.3 (128-bit) User Access : Print, Extract, Print high-res Tagged PDF : Yes Page Mode : UseOutlines XMP Toolkit : 3.1-701 Producer : Acrobat Distiller 7.0 (Windows) Keywords : Illustrator, Visual Basic, scripting, VBA Copyright : Adobe Systems Inc. 2005 Create Date : 2005:02:08 08:14:23Z Creator Tool : FrameMaker 7.0 Modify Date : 2005:08:17 14:10:03-07:00 Metadata Date : 2005:08:17 14:10:03-07:00 Format : application/pdf Title : Illustrator CS2 Visual Basic Scripting Reference Creator : Adobe Systems, Incorporated Description : scripting Illustrator with Visual Basic Document ID : uuid:ff4d1426-cfe4-41cb-b7d8-0bf4c5a423d5 Instance ID : uuid:b525231f-1e79-4de5-aca2-3cfb5acc591b Page Count : 294 Subject : scripting Illustrator with Visual Basic Author : Adobe Systems, IncorporatedEXIF Metadata provided by EXIF.tools