adobe illustrator vbscript/python 开发文档中文

考虑到翻译的一些专业术语以及精确性,关于API的整体描述部分保留了原文,对API具体的属性及作用进行翻译,请根据需求进行调整,虽然是vbsciprt的版本,但是python也可以调用的,调用方法自行搜索

ADOBE® ILLUSTRATOR®

ADOBE ILLUSTRATOR 2024 SCRIPTING REFERENCE:VBSCRIPT

2024 Adobe Incorporated. All rights reserved.

Adobe Illustrator 2024 Scripting Reference: VBScript

If this guide is distributed with software that includes an end user agreement, this guide, as well as the software

described in it, is furnished under license and may be used or copied only in accordance with the terms of such license. Except as permitted by any such license, no part of this guide may be reproduced, stored in a retrieval system, or

transmitted, in any form or by any means, electronic, mechanical, recording, or otherwise, without the prior written

permission of Adobe Incorporated. Please note that the content in this guide is protected under copyright law even if it is not distributed with software that includes an end user license agreement.

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

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

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

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

Macintosh is a trademark of Apple Computer, Incorporated, registered in the United States and other countries. Windows is either a registered trademark or trademark of Microsoft Corporation in the United States and other countries.

JavaScript and all Java-related marks are trademarks or registered trademarks of Sun Microsystems, Incorporated in the United States and other countries.

All other trademarks are the property of their respective owners.

Adobe Incorporated, 345 Park Avenue, San Jose, California 95110, USA. Notice to U.S. Government End Users. The

Software and Documentation are “Commercial Items,” as that term is defined at 48 C.F.R. §2.101, consisting of

“Commercial Computer Software”and “Commercial Computer Software Documentation,” as such terms are used in 48 C.F.R. §12.212 or 48 C.F.R. §227.7202, as applicable. Consistent with 48 C.F.R. §12.212 or 48 C.F.R. §§227.7202-1 through 227.7202-4, as applicable, the Commercial Computer Software and Commercial Computer Software Documentation are being licensed to U.S. Government end users (a) only as Commercial Items and (b) with only those rights as are granted to all other end users pursuant to the terms and conditions herein. Unpublished-rights reserved under the copyright

laws of the United States. Adobe Incorporated, 345 Park Avenue, San Jose, CA 95110-2704, USA. For U.S. Government End Users, Adobe agrees to comply with all applicable equal opportunity laws including, if appropriate, the provisions of

Executive Order 11246, as amended, Section 402 of the Vietnam Era Veterans Readjustment Assistance Act of 1974 (38 USC 4212), and Section 503 of the Rehabilitation Act of 1973, as amended, and the regulations at 41 CFR Parts 60-1

through 60-60, 60-250, and 60-741. The affirmative action clause and regulations contained in the preceding sentence shall be incorporated by reference.

Contents

1 VBScript Object Reference 8

目录目录目录目录
Application 9Artboard 16Artboards 17AutoCADFileOptions 18
Brush 19Brushes 20CharacterAttributes 21Characters 25
CharacterStyle 27CharacterStyles 28CMYKColor 30Color info 31
CompoundPathItem 32CompoundPathItems 37DataSet 38DataSets 39
Document 41Documents 50DocumentPreset 51EPSSaveOptions 52
ExportForScreens 54ExportOptionsAutoCAD 55ExportOptionsGIF 56ExportOptionsJPEG 58
ExportOptionsPhotoshop 60ExportOptionsPNG8 62ExportOptionsPNG24 64ExportOptionsSVG 66
ExportOptionsTIFF 68ExportOptionsWebP 69FreeHandFileOptions 70FXGSaveOptions 71
Gradient 72GradientColor 74Gradients 75GradientStop 76
GradientStops 77GraphicStyle 79GraphicStyles 80GraphItem 81
GraphItems 85GrayColor 86GridRepeatConfig 87GridRepeatItem 88
GridRepeatItems 89AiGridRepeatUpdate 90GroupItem 91GroupItems 95
IllustratorSaveOptions 96ImageCaptureOptions 98Ink 99InkInfo 100
InsertionPoint 102InsertionPoints 103LabColor 104Layer 105
Layers 108LegacyTextItem 109LegacyTextItems 112Lines 113
Matrix 114MeshItem 115MeshItems 118NoColor 120
NonNativeItem 121NonNativeItems 124OpenOptions 125PageItem 127
PageItems 130Paper 132PaperInfo 133ParagraphAttributes 135
Paragraphs 139ParagraphStyle 141ParagraphStyles 143PathItem 144
PathItems 149PathPoint 151PathPoints 153Pattern 154
PatternColor 155Patterns 157PDFFileOptions 158PDFSaveOptions 159
PhotoshopFileOptions 164PlacedItem 165PlacedItems 169PluginItem 170
PluginItems 174PPDFile 175PPDFileInfo 176Preferences 177
PrintColorManagementOptions 179PrintColorSeparationOptions 180PrintCoordinateOptions 182Printer 184
PrinterInfo 185PrintFlattenerOptions 187PrintFontOptions 189PrintJobOptions 190
PrintOptions 192PrintPageMarksOptions 194PrintPaperOptions 195PrintPostScriptOptions 196
RadialRepeatConfig 198RadialRepeatItem 199RadialRepeatItems 200AiRadialRepeatUpdate 201
RasterEffectOptions 202RasterItem 203RasterItems 207RasterizeOptions 209
RGBColor 210Screen 211ScreenInfo 212ScreenSpotFunction 213
Spot 214SpotColor 216Spots 217Stories 218
Story 219Swatch 221Swatches 222SwatchGroup 223
SwatchGroups 224Symbol 225SymbolItem 226SymbolItems 230
Symbols 231SymmetryRepeatConfig 233SymmetryRepeatItem 234SymmetryRepeatItems 235
AiSymmetryRepeatUpdate 236TabStopInfo 237Tag 238Tags 239
TextFont 240TextFonts 242TextFrame 243TextFrames 248
TextPath 250TextRange 252TextRanges 255TracingObject 256
TracingOptions 258Variable 261Variables 262View 263
Views 264Words 265Enumerations Reference 267

1 VBScript Object Reference

This reference section describes the objects and methods in the Illustrator VBScript type library. All of the classes in the type library are presented alphabetically. The chapter concludes with an enumerations

reference which lists all of the enumerations in the Illustrator type library.

Each class listing includes the following:

b Properties of the class — These include value type, read-only status, and an explanation.

b Methods for the class — Value types needed by the method are shown in boldface. Enumerated

values are linked to the Chapter 2, “Enumerations Reference.” Required terms are shown in plain face. All items surrounded by brackets ([ ]) are optional.

b Script examples — These example are intended to illustrate concepts, and do not necessarily

represent the best or most efficient way to construct a VBScript script. They contain little error

checking, and assume that the proper context exists for the scripts to execute in (for instance, that there is a document open or items selected).

Each script contains a single subroutine that can be pasted into any event in a VBScript form if you are using the VBScript development environment. A standard button click event is used for all examples. If you are using a built-in VBScript editor in a VBA application, you can paste the script into a macro

routine. In either case, modify the Sub statement in the example to work with your situation.

For an overview of how the Illustrator object model is structured, see Adobe Illustrator 2024 Scripting Guide.

Page 9

Application

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

Application properties
PropertyValue typeWhat it is
ActionIsRunningBooleanRead-only. If true, an action is still running.
只读。如果为 true,则表示动作仍在运行中。
ActiveDocumentDocumentThe active (frontmost) document in Illustrator.
当前(前台)Illustrator 文档对象。
ApplicationApplicationRead-only. The Illustrator Application object.
只读。Illustrator 应用程序对象本身。
BrowserAvailableBooleanRead-only. If true, a Web browser is available.
只读。如果为 true,则表示系统可用 Web 浏览器。
BuildNumberStringRead-only. The application’s build number.
只读。应用程序的构建号。
ColorSettingsListVariantRead-only. The list of color-settings files currently available for use.
只读。当前可供使用的颜色设置文件列表。
CoordinateSystemAiCoordinateSystemThe coordinate system currently in use,document or artboard.
当前正在使用的坐标系统,可以是文档坐标系统或画板坐标系统。
DefaultColorSettingsStringRead-only. The default color-settings file for the current application locale.
只读。当前应用程序语言环境下的默认颜色设置文件。
DocumentsDocumentsRead-only. The documents in the application.
只读。应用程序中的所有文档集合。
FlattenerPresetsListVariantRead-only. The list of flattener style names currently available for use.
只读。当前可供使用的展平样式名称列表。
FreeMemoryLongRead-only. The amount of unused memory (in bytes) within the Illustrator partition.
只读。Illustrator 分区中未使用的内存(以字节为单位)数量。
HomeScreenVisibleBooleanRead-only. If true, the Home screen is visible.
只读。如果为 true,则表示主页屏幕可见。
LocaleStringRead-only. The application’s locale.
只读。应用程序的语言环境设置。
NameStringRead-only. The application’s name (not related to the filename of the application file).
只读。应用程序的名称(与应用程序文件名无关)。
PasteRememberLayersBooleanRead-only. If true, the paste operation maintains the layer structure.
只读。如果为 true,则粘贴操作会保留图层结构。
PathStringRead-only. The file path to the application.
只读。应用程序的文件路径。
PDFPresetsListVariant Array of StringRead-only. The list of preset PDF-options names available for use.
只读。当前可供使用的预设 PDF 选项名称列表。
PPDFileListVariant Array of StringsRead-only. The list of PPD files currently available for use.
只读。当前可供使用的 PPD 文件列表。
PreferencesPreferencesRead-only. The application preferences.
只读。应用程序的偏好设置。
PrinterListVariantRead-only. A list of available printers.
只读。可用打印机的列表。
PrintPresetsListVariantRead-only. The list of preset printing-options names currently available for use.
只读。当前可供使用的预设打印选项名称列表。
ScriptingVersionStringRead-only. The version of the Scripting plug-in.
只读。脚本插件版本。
SelectionVariant Array of objectsAll currently selected objects in the active (frontmost) document.
当前(前台)文档中所有选定的对象集合。
StartupPresetsListVariantRead-only. The list of presets available for creating a new document.
只读。用于创建新文档时可选择的预设列表。
TextFontsTextFontsRead-only. The installed fonts.
只读。已安装的所有字体集合。
TracingPresetListVariant Array of StringRead-only. The list of preset tracing-options names available for use.
只读。当前可供使用的预设描摹选项名称列表。
UserInteractionLevelAiUserInteractionL evelThe allowed level of interaction with users in the form of dialogs and message boxes.
允许用户交互级别,即对话框和消息框形式的用户交互程度。
VersionStringRead-only. The version of the Illustrator application
只读。Illustrator 应用程序的版本号。
VisibleBooleanRead-only. If true, the application is visible.只读。如果为 true,则表示应用程序窗口可见。
Application methods
MethodReturnsWhat it does
ConcatenateMatrix (matrix as Matrix,secondMatrix as Matrix)MatrixConcatenates two matrices.
将两个矩阵连接(拼接)在一起。
ConcatenateRotationMatrix (matrix as Matrix,angle as Double)MatrixConcatenates a rotation to a transformation matrix.
向变换矩阵中添加一个旋转。
ConcatenateScaleMatrix (matrix as Matrix,[, scaleX as Double][, scaleY as Double])MatrixConcatenates a scale to a transformation matrix.
向变换矩阵中添加一个缩放变换。
ConcatenateTranslationMatrix (matrix as Matrix,[, deltaX as Double][, deltaY as Double])MatrixConcatenates a translation to a transformation matrix.
向变换矩阵中添加一个平移变换。
ConvertSampleColor(SourceColorSpace as AiImageColorSpace,SourceColor as ColorComponents,DestColorSpace as AiImageColorSpace,ColorConvertPurpose as AiColorConvertPurpose [,SourceHasAlpha as Boolean][,DestHasAlpha as Boolean])array of ColorCom ponentsConverts a sample-component color from one color space to another.
将样本颜色从一个颜色空间转换到另一个颜色空间。
Copy()NothingCopies the current selection to the clipboard.
复制当前选择内容至剪贴板。
Cut()NothingCuts the current selection to the clipboard.
剪切当前选择内容至剪贴板。
DeleteWorkspace(workspaceName as String)BooleanDeletes a workspace.
删除指定的工作区。
DoJavaScript(JavaScriptCode as String,[, Arguments as Variant Array][, ExecutionMode as AiJavaScriptExecutionMode])StringExecutes the specified JavaScript® code.
执行指定的 JavaScript 代码。
DoJavaScriptFile(JavaScriptFile as File,[, Arguments as Variant Array][, ExecutionMode as AiJavaScriptExecutionMode])StringExecutes the specified JavaScript file.
执行指定的 JavaScript 文件。
DoScript(Action as String,From as String[, dialogs as Boolean])NothingPlays an action from the Actions palette.NOTE: Use DoScript only if you intend to run your script from an application external to Illustrator, such as the Windows® Script Host. Calling DoScript when running a script from Illustrator’s File > Scripts menu may yield unexpected results.
播放“动作”面板中的指定动作。注意:仅当您打算从 Illustrator 外部的应用程序(如 Windows Script Host)运行脚本时使用 DoScript。如果在 Illustrator 的“文件 > 脚本”菜单下运行脚本并调用 DoScript,可能会得到意外结果。
GetIdentityMatrix()MatrixReturns an identity matrix.
返回一个单位矩阵。
GetPPDFileInfo(Name as String)PPDFileI nfoGets detailed file information for specified PPD file.
获取指定 PPD 文件的详细信息。
GetPresetFileOfType(PresetType as AiDocumentPresetType)StringReturns the full path to the default document profile for the specified preset type.
返回指定预设类型对应的默认文档配置文件的完整路径。
GetPresetSettings(Preset as String)Document PresetRetrieves the tracing-option settings from the template with a given preset name.
从具有给定预设名称的模板获取描摹选项设置。
GetRotationMatrix([Angle as Double])MatrixReturns a transformation matrix containing a single rotation.NOTE: Requires a value in degrees. For example, 30 rotates the object 30 degrees counterclockwise; -30 rotates the object 30 degrees clockwise.
返回包含单一旋转的变换矩阵。注:参数为度数,例如30表示逆时针旋转30度,-30表示顺时针旋转30度。
GetScaleMatrix([scaleX as Double][, scaleY as Double])MatrixReturns a transformation matrix containing a single scale.NOTE: Requires a value in percentage. For example, 60 scales the object to 60% of its original size; 200 doubles the object’s bounds.
返回包含单一缩放的变换矩阵。注:参数为百分比,例如60表示将对象缩放至原尺寸的60%,200表示将对象放大一倍。
GetScriptableHelpGroup()variantGets the scriptable help group object that represents the search widget in the app bar.
获取代表应用程序顶部搜索小部件的可脚本帮助组对象。
GetTranslationMatrix([deltaX as Double][, deltaY as Double])MatrixReturns a transformation matrix containing a single translation.NOTE: Requires a value in points. For example,{100,200} moves the object 100 pt.to the right and 200 pt. up; a minus before each number moves the object left and down.
返回包含单一平移的变换矩阵。注:参数为点数,例如{100,200}表示将对象向右移动100pt、向上移动200pt;负值表示向反方向移动。
InvertMatrix(matrix as Matrix)MatrixInverts a matrix.
计算并返回一个矩阵的逆矩阵。
IsEqualMatrix(matrix as Matrix,secondMatrix as Matrix)BooleanChecks whether two matrices are equal.
检查两个矩阵是否相等。
IsSingularMatrix(matrix as Matrix)BooleanChecks whether a matrix is singular and cannot be inverted.
检查一个矩阵是否奇异(不可逆)。
LoadColorSettings(fileSpec as String)NothingLoads color settings from specified file, or, if file is empty, turns color management off.
从指定文件加载颜色设置,若文件为空则关闭颜色管理功能。
Open(file as String,[documentColorSpace as AiDocumentColorSpace], [options as Object])DocumentOpens the specified file document.If called to open a pre-Illustrator 9 document that contains both RGB and CMYK colors, supply DocumentColorSpace in order to convert all colors to the specified color space. If not supplied,Illustrator displays a dialog to the user.
打开指定的文件文档。对于包含RGB和CMYK颜色的Illustrator 9之前的文档,在打开时应提供documentColorSpace参数以将所有颜色转换至指定的颜色空间,否则Illustrator会显示对话框询问用户。
PasteNothingPastes the clipboard content into the current document.
将剪贴板内容粘贴到当前文档中。
QuitNothingQuits Illustrator.
退出 Illustrator 应用程序。
RedoNothingRedoes the most recently undone transaction.
恢复最近一次撤销的操作。
Redraw()NothingForces Illustrator to redraw all its windows.
强制 Illustrator 重新绘制其所有窗口。
ResetWorkspaceBooleanResets the current workspace.
重置当前工作区。
SaveWorkspace(workspaceName as String)BooleanSaves a new workspace.
保存新的工作区。
ShowPresets(fileSpec as String)NothingGets the presets from the file.
从文件中获取预设。
SwitchWorkspace(workspaceName as String)BooleanSwitches to a workspace.
切换至指定的工作区。
TranslatePlaceholderText(text as String)NothingTranslates the placeholder text to regular text; a way to enter unicode points in hex values.
将占位符文本转换为常规文本,用于输入Unicode十六进制编码点值。
UndoNothingUndoes the most recent transaction.
撤销最近执行的操作。
Opening a document
Set appRef = CreateObject("Illustrator.Application")
Set docRef = appRef.Open("C:\temp\aFile.ai")
Accessing the selection

In Illustrator, the application’s Selection can be accessed as well as modified. The selection will contain Empty when there are no selected objects. To deselect all objects in the current document, set the

selection to Empty, as the following example shows.

Set appRef = CreateObject("Illustrator.Application")
appRef.activeDocument.Selection = Empty

A reference to a text range is returned when there is an active insertion point in the contents of a TextFrame. Similarly, a reference to a range of text is returned when characters are selected in the contents of a TextFrame.

Executing an action

You can run an action from the Action Palette from a script by using the DoScript method. When you do this, the control returns to your script before the action has completed. Use the ActionIsRunning

property to test for when the action has completed before executing any other VBScript methods (see the Windows.DoAction example). You can also use the Sleep method defined on the WScript object to insert a pause to test this property, as in the following example:

Set appRef = CreateObject("Illustrator.Application")
appRef.DoScript "Opacity 60 (selection)", "Default Actions"
WHILE(appRef.ActionIsRunning)
    WScript.sleep 1000
WEND
msgbox "Done"
Invoking JavaScript

DoJavaScript and DoJavaScriptFile can be used to invoke scripts written in JavaScript for Illustrator.

The first argument to 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(

This example returns the number of open documents.

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

'Duplicates the selected item in the current document to a new document

Set appRef = CreateObject("Illustrator.Application")
If appRef.Documents.Count > 0 Then
    If Not IsEmpty(appRef.ActiveDocument.selection) Then
        appRef.ActiveDocument.Copy
        Set newDocument = appRef.Documents.Add(aiDocumentCMYKColor,250, 400)
        newDocument.Paste
    End If
End If

Page 16

Artboard

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

Artboard properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。Illustrator 应用程序对象本身,表示该画板所属的应用上下文。
ArtboardRectRectSize and position of the artboard.
画板的大小和位置,即画板的矩形区域坐标信息。
NameStringThe unique identifying name of the artboard.
画板的唯一标识名称。
ParentDocumentRead-only. The name of the object that is this Artboard object’s parent.
只读。此 Artboard 对象父级的对象名,即包含该画板的文档对象。
RulerOriginPointRuler origin of the artboard, relative to the left top corner of the artboard.
画板标尺原点,相对于画板左上角的坐标位置。
RulerPARDoublePixel aspect ratio, used in ruler visualization if the units are pixels. Range: 0.1 to 10.0
像素长宽比(Pixel Aspect Ratio),当单位设置为像素时,在标尺可视化中使用。范围:0.1 到 10.0。
ShowCenterBooleanShow center mark.
是否显示中心标记(center mark)。
ShowCrossHairsBooleanShow cross hairs.
是否显示十字线(cross hairs)定位辅助线。
ShowSafeAreasBooleanShow title and action safe areas (for video).
是否显示标题安全区和动作安全区(主要用于视频制作场景)。
Artboard methods
MethodReturnsWhat it does
Delete()NothingDeletes this artboard object. You cannot remove the last artboard in a document.
删除此画板对象。需要注意的是,不能删除文档中的最后一个画板,即任何时候文档至少需要保留一个画板。

page 17

Artboards

A collection of artboards.

Artboards properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。表示该对象所属的Illustrator应用程序对象。
CountLongRead-only. The number of objects in the collection.
只读。表示集合中对象的数量。
ParentDocumentRead-only. The document that contains this object.
只读。包含此对象的文档对象,即该对象所在的父级文档。
Artboards methods
MethodReturnsWhat it does
Add(rect as ArtboardRect)ArtboardCreates a new Artboard object.
根据给定的ArtboardRect参数创建并返回一个新的Artboard对象。
GetActiveArtboardIndex()LongRetrieves the index position of the active artboard in the document
获取文档中当前活动画板在其所在文档中的索引位置。
GetByName(artboardName as String)ArtboardRetrieves an artboard object from the list by its unique identifying name.
通过唯一的名称标识符从列表中检索一个画板对象。
Index(item as DataSets)LongReturns the index position of the object within the collection.
返回集合中指定对象在其内部的索引位置,但此处的“DataSets”类型可能有误,请确认是否应为Artboard类型。
Insert(rect as ArtboardRect,index as Long)NothingCreates a new artboard object and inserts it at the given index in the list.
根据给定的ArtboardRect参数创建一个新的画板对象,并将其插入到列表中的指定索引位置。
Item(itemKey)ArtboardReturns an object reference to the object identified by itemKey (name or index).
通过itemKey(名称或索引)返回对集合中特定Artboard对象的引用。
Remove(index as Long)NothingDeletes an artboard object. You cannot remove the last artboard in a document.
删除指定索引位置处的画板对象。需要注意的是,不能移除文档中的最后一个画板。
SetActiveArtboardIndex (index as Long)NothingMakes a specific artboard active and makes it current in the iteration order.
设置指定索引位置处的画板为活动状态,并使其成为迭代顺序中的当前画板。

page 18

AutoCADFileOptions

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

AutoCADFileOptions properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。表示Illustrator应用程序本身的对象,提供对全局应用级别的功能和设置的访问。
CenterArtworkBooleanIf true, center the artwork that is created on the artboard. Default is true.
如果设为true,则在画板上创建的艺术品将被居中。默认值为true。
GlobalScaleOptionAiAutoCADGlobalScaleOptionHow to scale the drawing on import. Default is 1
定义导入时如何缩放图形。默认值为1,表示按原尺寸导入。
GlobalScalePercentDoubleThe value when globalScaleOption is 2 aiScaleByValue, expressed as a percentage. Range: 0.0 to 100.0 Default is 100.0
当GlobalScaleOption设置为2(aiScaleByValue)时,用百分比表示的缩放值。范围:0.0到100.0,默认值为100.0。
MergeLayersBooleanIf true, the layers of the artwork are merged. Default: false
如果设为true,将合并艺术品的所有图层。默认值为false,即保持图层结构不变。
ParentDocumentRead-only. The document that contains this object.
只读。包含该对象的文档,表示此画板所属的整体文档上下文。
ScaleLineweightsBooleanIf true, scales line weights by the same factor as the rest of the drawing. Default is false.
如果设为true,则线条粗细会按照与其余绘图相同的比例进行缩放。默认值为false。
SelectedLayoutNameStringName of the layout in the drawing to import.
指定要导入图纸中的布局名称。
UnitAiAutoCADUnitThe unit to map to. Default is 3 aiMillimeters.
用于映射单位的目标单位。默认值为3(aiMillimeters),即毫米。
UnitScaleRatioDoubleThe ratio by which to scale while mapping units. Default is 1.0
在单位映射过程中使用的比例因子。默认值为1.0,表示不改变单位比例。

page 19

Brush

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

Brush properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。表示Illustrator应用程序自身的对象,提供了对整个应用级功能和设置的访问权限。
NameStringThe Brush name.
画笔的名称,用于标识和区分不同的画笔样式。
ParentObjectRead-only. The container object.
只读。容器对象,代表该画笔所属的上下文对象,通常是包含此画笔的集合或库。例如,在Illustrator中,这可能是指向包含此画笔的文档或画笔库的对象。
Brush methods
MethodReturnsWhat it does
ApplyTo(artItem as PageItem)NothingApplies the brush to a specific art item.
将此画笔应用于指定的美术项目(Art Item)。该方法会将当前画笔样式应用于给定的PageItem对象,例如路径、形状或其他可以使用画笔描边的Illustrator元素。
Applying a Brush
'Creates a new group, adds a duplicate of each selected item to the group
'then applies a brush to each item in the group
Set appRef = CreateObject("Illustrator.Application")
If appRef.Documents.Count > 0 Then
    If Not IsEmpty(appRef.Selection) Then
        selectedItems = appRef.Selection
        startIndex = LBound(selectedItems)
        endIndex = UBound(selectedItems)
        Set newGroup = appRef.ActiveDocument.GroupItems.Add
        For i = startIndex To endIndex
            Set artItem = selectedItems(i)
            Set dupItem = artItem.Duplicate(newGroup, aiPlaceAtEnd)
            appRef.ActiveDocument.Brushes(2).ApplyTo artItem
        Next
    End If
End If

page 20

Brushes

A collection of brushes in a document.

Brushes properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。Illustrator应用程序对象。表示该集合所属的整个Illustrator应用程序实例。
CountLongRead-only. Long. The number of objects in the collection.
只读。长整型数值。表示集合中对象的数量,即当前包含的对象个数。
ParentObjectRead-only. The document that contains this object.
只读。对象。表示包含此对象的父级对象,通常在Illustrator中指的是包含当前集合的文档对象。这意味着访问此属性会返回一个指向该集合所在文档的引用。
Brushes methods
MethodReturnsWhat it does
Index(item as Brush)LongReturns the index position of the object within the collection.
返回指定画笔对象在集合中的索引位置。给定一个Brush对象作为参数,此方法会返回该画笔在当前集合中所处的索引号。
Item(itemKey)BrushReturns an object reference to the object identified by itemKey (name or index).
通过名称或索引获取并返回集合中特定画笔对象的引用。当提供itemKey作为名称或索引时,该方法会返回对应于该键值的Brush对象实例。
Get all brushes in a document
'Counts the number of brushes in the current document
'and stores in numBrushes
Set appRef = CreateObject("Illustrator.Application")
If appRef.Documents.Count > 0 Then
    numBrushes = appRef.ActiveDocument.Brushes.Count
End If

page 21

CharacterAttributes

Specifies the properties of a character contained in a text frame. A CharacterStyle object associates attributes with a text range. See “CharacterStyle” on page 27.

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

CharacterAttributes properties
PropertyValue TypeWhat it is
AkiLeftDoubleThe amount of inter-glyph space added to the left side of the glyph in Japanese text (in thousandths of an em).
在日语文本中,为字形左侧增加的字间间距量(以千分之一em为单位)。
AkiRightDoubleThe amount of inter-glyph spacing added to the right side of the glyph in Japanese text (in thousandths of an em).
在日语文本中,为字形右侧增加的字间间距量(以千分之一em为单位)。
AlignmentAiStyleRunAlignmentTypeThe character alignment type.
字符对齐方式。
AlternateGlyphsAiAlternateGlyphsFormSpecifies which kind of alternate glyphs are used.
指定使用的替代字形种类。
ApplicationApplicationRead-only. The Illustrator Application object.
只读。指向Adobe Illustrator应用程序的对象,可以访问和控制整个应用程序的功能。
AutoLeadingBooleanIf true, automatic leading is used.
如果为真,则表示使用自动行距。
BaselineDirectionAiBaselineDirectionTypeThe Japanese text baseline direction.
日语文本的基线方向。
BaselinePositionAiFontBaselineOptionThe baseline position of text.
文本的基线位置。
BaselineShiftDoubleThe amount of shift (in points) of the text baseline.
文本基线相对于默认位置的偏移量(以点为单位)。
CapitalizationAiFontCapsOptionSpecifies whether the text is normal, all uppercase, all small caps, or a mix of small caps and lowercase.
指定文本是否为正常、全大写、全小写或小写字母与大写字母混合。
ConnectionFormsBooleanIf true, OpenType® connection forms are used.
如果为真,则表示使用OpenType®连接形式。
ContextualLigatureBooleanIf true, contextual ligatures are used.
如果为真,则表示使用上下文连字。
DiscretionaryLigatureBooleanIf true, discretionary ligatures are used.
如果为真,则表示使用可选连字。
FigureStyleAiFigureStyleTypeThe number style in an OpenType font.
在OpenType字体中的数字样式。
FillColorObjectThe color of the text fill.
文本填充的颜色。
FractionsBooleanIf true, OpenType fractions are used.
如果为真,则使用OpenType分数形式。
HorizontalScaleDoubleThe horizontal scaling factor (as a percentage).
水平缩放因子(以百分比表示)。
ItalicsBooleanIf true, the Japanese font supports italics.
如果为真,则表示日文字体支持斜体样式。
KerningMethodAiAutoKernTypeThe kerning method.
字间距调整方法。
LanguageAiLanguageTypeThe language of the text.
文本的语言类型。
LeadingDoubleThe amount of space between two lines of text, in points.
两行文本之间的间距量(以点为单位)。
LigatureBooleanIf true, ligatures are used.
如果为真,则启用连字功能。
NoBreakBooleanIf true, no break is allowed.
如果为真,则不允许换行断开。
OpenTypePositionAiFontOpenTypePositionOptionThe OpenType baseline position.
OpenType字体的基线位置选项。
OrdinalsBooleanIf true, OpenType ordinals are used.
如果为真,则使用OpenType序数符号。
OrnamentsBooleanIf true, OpenType ornaments are used.
如果为真,则使用OpenType装饰字符。
OverprintFillBooleanIf true, overprint the fill of the text.
如果为真,则允许填充颜色叠印。
OverprintStrokeBooleanIf true, overprinting of the stroke of the text is allowed.
如果为真,则允许描边叠印。
ParentObjectRead-only. The object’s container.
只读。该对象所处的容器。
ProportionalMetricsBooleanIf true, proportional metrics in Japanese OpenType are used.
如果为真,则在日文OpenType中使用比例度量。
RotationDoubleThe character rotation angle.
字符旋转的角度。
SizeDoubleThe font size in points.
字体大小,以点为单位。
StrikeThroughBooleanIf true, characters are struck-through by a line.
如果为真,则字符会被一条线划过。
StrokeColorObjectThe color of the text stroke.
文本描边的颜色。
StrokeWeightDoubleLine width of stroke.
描边线宽。
StylisticAlternatesBooleanIf true, OpenType stylistic alternates are used.
如果为真,则使用OpenType风格替换字符。
SwashBooleanIf true, OpenType swash characters are used.
如果为真,则使用OpenType花饰字符。
TateChuYokoHorizontalLongThe Tate-Chu-Yoko horizontal adjustment in points.
Tate-Chu-Yoko水平调整量,以点为单位。Tate-Chu-Yoko是日文中的一种排版方式,用于调整竖排文本中横写字符的水平位置。
TateChuYokoVerticalLongThe Tate-Chu-Yoko vertical adjustment in points.
Tate-Chu-Yoko垂直调整量,以点为单位。
TextFontTextFontThe font used for the character.
用于字符的字体。
TitlingBooleanIf true, OpenType titling alternates are used.
如果为真,则使用OpenType标题风格替换字符。
TrackingLongThe tracking or range kerning amount in thousandths of an em.
字间距或范围字距调整量,以千分之一em为单位。
TsumeDoubleThe percentage of space reduction around a Japanese character.
日文字体周围空间减缩的百分比。
UnderlineBooleanIf true, characters are underlined.
如果为真,则对字符进行下划线处理。
VerticalScaleDoubleCharacter vertical scaling factor.
字符垂直缩放因子。
WariChuCharactersAfterBreakLongSpecifies how the characters in Wari-Chu text (an inset note in Japanese text) are divided into two or more lines.
指定在Wari-Chu文本(日语文本中的插入注解)中换行后分割字符的方式。
WariChuCharactersBeforeBreakLongSpecifies how the characters in Wari-Chu text (an inset note in Japanese text) are divided into two or more lines.
指定在Wari-Chu文本(日语文本中的插入注解)中换行前分割字符的方式。
WariChuEnabledBooleanIf true, Wari-Chu is enabled.
如果为真,则启用Wari-Chu功能。
WariChuJustificationAiWariChuJustificationTypeThe Wari-Chu justification.
Wari-Chu的对齐方式。
WariChuLineGapLongThe Wari-Chu line gap.
Wari-Chu的行间距。
WariChuLinesLongThe number of Wari-Chu (multiple text lines fit into a space meant for one) lines.
Wari-Chu(多行文本适应单行空间)行的数量。
WariChuScaleDoubleThe Wari-Chu scale.
Wari-Chu的缩放比例。
Setting character attributes
'Opens a document and adds a simple text frame, then
'uses the CharacterAttributes object to increment
'the horizontal and vertical scale of each character.
Set appRef = CreateObject("Illustrator.Application")
Set docRef = appRef.Documents.Add()
Set textRef = docRef.TextFrames.Add()
textRef.Contents = "I'd rather be scripting!"
textRef.Top = 500
textRef.Left = 40
dSize = 100
iCount = textRef.Characters.Count
i = 1
Dim charRef
Do While (i < (iCount + 1))
    dSize = dSize * 1.1
    textRef.TextRange.Characters(i).CharacterAttributes.HorizontalScale = dSize
    textRef.TextRange.Characters(i).CharacterAttributes.VerticalScale = dSize
    i = i + 1
Loop

page 25

Characters

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

Characters properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. Application that the collection belongs to.
只读属性。表示该集合所属的应用程序对象,即这个集合是哪个应用程序的一部分。
CountLongRead-only. Number of elements in the collection.
只读属性。表示集合中元素的数量,即集合内包含的项目的总数。
ParentObjectRead-only. The object’s container.
只读属性。表示该集合所在的容器对象,即此集合直接隶属于哪一个父级对象
Characters methods
MethodReturnsWhat it does
Add(contents as String[, relativeObject as TextFrame][, insertionLocation as AiElementPlacement])TextRangeAdds 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.
在当前文档的指定位置添加包含指定文本内容的新字符。如果未指定位置,则在当前文本选择或插入点之后的文本框中添加新字符。
AddBefore(contents as String)TextRangeAdds a character before the current text selection or insertion point.
在当前文本选择或插入点之前添加一个字符。
Index(itemPtr as TextRange)LongReturns the index position of the object within the collection.
返回给定TextRange对象在集合中的索引位置。
RemoveAll()NothingDeletes every element in the collection.
删除集合中的所有元素,即清空整个集合。
Counting characters
'Counts the number of characters in the current document
'and stores the result in numChars
Set appRef = CreateObject("Illustrator.Application")
If appRef.Documents.Count > 0 Then
    numChars = 0
    For Each textArt In appRef.ActiveDocument.TextFrames
    Set textArtRange = textArt.TextRange
    numChars = numChars + textArtRange.length
    Next
End If

page 27

CharacterStyle

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

CharacterStyle properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. Application to which the collection belongs.
只读。该集合所属的应用程序,即此字符样式是在哪个Illustrator应用中定义的。
CharacterAttributesCharacterAttributesRead-only. The character properties for the style.
只读。表示该字符样式的字符属性集合,包括字体、大小、颜色、行距等各种字符样式相关的详细设定。
NameStringThe character style’s name.
字符样式的名称,用于在Illustrator中标识和引用该样式。
ParentObjectRead-only. The object’s container.
只读。包含当前对象的容器对象,通常是指定字符样式所在的文档或样式集。
CharacterStyle methods
MethodReturnsWhat it does
ApplyTo(textItem as Object[, clearingOverrides as Boolean])NothingApplies the character style to the text object or objects.
将此字符样式应用于指定的文本对象或多个文本对象。可选参数clearingOverrides指明是否在应用样式时清除已存在的自定义格式覆盖,默认情况下,如果不设置该参数,则可能会保留原有的一些格式覆盖设置。
Delete()NothingDeletes the object.
删除当前的字符样式对象。执行此操作后,文档中使用该字符样式的文本将不再应用该样式,除非有其他样式替代它或者恢复为默认样式。

page 28

CharacterStyles

A collection of character styles.

CharacterStyles properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. Application to which the collection belongs.
只读。表示该集合所属的应用程序实例,即这个集合是哪个Adobe Illustrator应用的一部分。
CountLongRead-only. Number of elements in the collection.
只读。表示集合中元素的数量,即集合内包含的项目的总数。
ParentObjectRead-only. The object’s container.
只读。表示该集合所在的容器对象,即此集合直接隶属于哪一个父级对象。例如,在Illustrator中,如果这个集合是一个文档中的图层集合,那么Parent属性将指向该文档对象。
CharacterStyles methods
MethodReturnsWhat it does
Add(Name as String)CharacterStyleCreates a named character style.
通过给定的名称创建一个新的字符样式,并返回该新创建的CharacterStyle对象。
Index(itemPtr as CharacterStyle)LongReturns the index position of the object within the collection.
返回指定CharacterStyle对象在集合中的索引位置,即查找并返回给定CharacterStyle实例在整个集合中所处的位置序号。
Item(itemKey)CharacterStyleReturns an object reference to the object identified by itemKey (name or index).
根据itemKey(可以是名称或索引)返回CharacterStyle对象引用,即通过名称或索引获取并返回集合中的特定字符样式对象。
RemoveAll()NothingDeletes all objects in this collection.
删除当前集合内的所有字符样式对象,清空整个集合。
Create and apply character styles
'Opens a document, adds 3 text frames,
'creates a new character style and applies it to
'each of the text frames
Set appRef = CreateObject("Illustrator.Application")
'Create a new document add a 3 simple text items
Set docRef = appRef.Documents.Add()
Set textRef1 = docRef.TextFrames.Add()
textRef1.Contents = "Scripting is fun!"
textRef1.Top = 700
textRef1.Left = 50
Set textRef2 = docRef.TextFrames.Add()
textRef2.Contents = "Scripting is easy!"
textRef2.Top = 625
textRef2.Left = 100
Set textRef3 = docRef.TextFrames.Add()
textRef3.Contents = "Everyone should script!"
textRef3.Top = 550
textRef3.Left = 150
appRef.Redraw
'Create a new character style
Set charStyle = docRef.CharacterStyles.Add("BigRed")
'Create a red color
Set colorRed = CreateObject("Illustrator.RGBColor")
colorRed.Red = 255
'Set character attributes of the new style
With charStyle.CharacterAttributes
    .Size = 40
    .Tracking = -50
    .Capitalization = 0 'aiNormalCaps
    .FillColor = colorRed
End With
'Apply style to each textFrame in the document
charStyle.ApplyTo textRef1.TextRange
charStyle.ApplyTo textRef2.TextRange
charStyle.ApplyTo textRef3.TextRange

page 30

CMYKColor

A CMYK color specification, used to apply a CMYK color to a layer or art item.

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

CMYKColor properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。表示该颜色对象所属的Adobe Illustrator应用程序实例,提供了访问和控制整个应用程序的功能。
BlackDoubleThe black color value. Range: 0.0 to 100.0
黑色分量值,范围在0.0到100.0之间,用于CMYK色彩模式中的黑色部分强度设置。
CyanDoubleThe cyan color value. Range: 0.0 to 100.0
青色分量值,范围在0.0到100.0之间,用于CMYK色彩模式中的青色部分强度设置。
MagentaDoubleThe magenta color value. Range: 0.0 to 100.0
洋红色分量值,范围在0.0到100.0之间,用于CMYK色彩模式中的洋红色部分强度设置。
YellowDoubleThe yellow color value. Range: 0.0 to 100.0
黄色分量值,范围在0.0到100.0之间,用于CMYK色彩模式中的黄色部分强度设置。
Setting CMYK colors
'Creates a new CMYK color and applies it to the first path item
Set appRef = CreateObject("Illustrator.Application")
Set newCMYKColor = CreateObject("Illustrator.CMYKColor")
'Get a reference to the frontmost path in the document
Set frontPath = appRef.ActiveDocument.PathItems(1)
'Set color values for the CMYK objects
newCMYKColor.Black = 0
newCMYKColor.Cyan = 30.4
newCMYKColor.Magenta = 32
newCMYKColor.Yellow = 0
frontPath.Filled = True
frontPath.fillColor = newCMYKColor

page 31

Color info

An abstract parent class for all color classes used in Illustrator. Subclasses are:

CMYKColor

GradientColor

GrayColor

LabColor

NoColor

PatternColor

RGBColor

SpotColor

page 32

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 paths’ matching property will be updated to the new value.

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

group are not returned when a script asks for the paths in a layer which contains the compound path or group.

CompoundPathItem properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。表示该对象所属的Adobe Illustrator应用程序实例,可用于访问和控制整个应用程序的功能。
ArtworkKnockoutAiKnockoutStateIs this object used to create a knockout? If so, what kind of knockout?
指示此对象是否被用作镂空效果,并且如果是的话,是何种类型的镂空效果。
BlendingModeAiBlendModesThe mode used when compositing an object.
在组合对象时所采用的混合模式,决定对象如何与下方图层的内容相互融合。
ControlBoundsVariant Array of 4 DoublesRead-only. The bounds of the object including stroke width and controls.
只读。包括描边宽度和控制点在内的对象边界范围。
EditableBooleanRead-only. If true, the object is editable.
只读。如果为true,则表示该对象可编辑。
GeometricBoundsVariant Array of 4 DoublesRead-only. The bounds of the object excluding stroke width.
只读。不包括描边宽度的对象边界范围。
HeightDoubleThe height of the object, excluding stroke width, calculated from the GeometricBounds.
对象的高度(排除描边宽度),基于GeometricBounds计算得出。
HiddenBooleanIf true, this object is hidden.
如果为true,则表示该对象已被隐藏。
IsIsolatedBooleanIf true, this object is isolated.
如果为true,则表示该对象已被隔离显示。
LayerLayerRead-only. The layer to which this object belongs.
只读。表示此对象所在的图层。
LeftDoubleThe position of the left side of the item (in points, measured from the left side of the page).
对象左边缘的位置(以点为单位,从页面左边开始测量)。
LockedBooleanIf true, the object is locked.
如果为true,则表示该对象被锁定,不可编辑或移动。
NameStringThe name of this object.
对象的名称。
NoteStringThe note assigned to this object.
分配给此对象的注释文本。
OpacityDoubleThe opacity of the object. Range: 0.0 to 100.0
对象的不透明度,范围在0.0到100.0之间,其中100代表完全不透明。
ParentDocumentRead-only. The document that contains this object.
只读。包含此对象的父级文档。
PathItemsPathItemsRead-only. The path art items in this compound path.
只读。复合路径中的所有路径艺术项目元素。
PositionVariant Array of 2 DoublesThe position (in points) of the top left corner of the item, in the format [x, y]. Does not include stroke weight.
对象左上角的位置(以点为单位),格式为[x, y],不包括描边宽度。
SelectedBooleanIf true, the object is selected.
如果为true,则表示该对象已被选中。
SlicedBooleanIf true, the CompoundPathItem is sliced. Default: false
如果为true,则表示复合路径项被切片处理。默认值为false。
TagsTagsRead-only. The tags contained in this object.
只读。该对象所包含的标签集合。
TopDoubleThe position of the top of the item (in points, measured from the bottom of the page).
对象顶部的位置(以点为单位,从页面底部开始测量)。
URLStringThe value of the Adobe URL tag assigned to this object.
分配给此对象的Adobe URL标签值。
VisibilityVariableVariableThe VisibilityVariable bound to this object.
与此对象绑定的可见性变量。
VisibleBoundsVariant Array of 4 DoublesRead-only. The visible bounds of the object including stroke width.
只读。包括描边宽度在内的对象可见边界范围。
WidthDoubleThe width of the object, excluding stroke width, calculated from the GeometricBounds.
对象的宽度(排除描边宽度),基于GeometricBounds计算得出。
WrapInsideBooleanIf true, the text frame object are wrapped inside this object.
如果为true,则文本框对象将被环绕在这个对象内部。
WrapOffsetDoubleThe offset to use when wrapping text around this object.
当环绕此对象排列文本时使用的偏移量。
WrappedBooleanIf true, wrap text frame objects around this object (text frame must be above the object).
如果为true,则允许文本框对象围绕此对象进行环绕排版(前提是文本框位于该对象上方)。
ZOrderPositionLongRead-only. The position of this art item within the stacking order of the group or layer (Parent) that contains the art item.
只读。此艺术项目在其所在的组或图层(父级容器)内堆叠顺序中的位置索引。
CompoundPathItem methods
MethodReturnsWhat it does
Copy()NothingCopies the compound path to the clipboard. The associated document must be the frontmost document.
复制复合路径到剪贴板。要求与该对象关联的文档必须是当前最前端的文档。
Cut()NothingCuts the compound path onto the clipboard. The associated document must be the frontmost document.
将复合路径剪切到剪贴板。同样需要关联文档为最前端文档。
Delete()NothingDeletes the object.
删除该复合路径对象。
Duplicate([relativeObject as Object],[insertionLocation as AiElementPlacement])ObjectDuplicates the compound path,optionally specifying the location and position for the copy.
复制复合路径,可选地指定副本的位置和插入点。
Move(relativeObject as Object,insertionLocation as AiElementPlacement)NothingMoves the object, specifying the new location and position.
移动对象,指定新的位置和排列方式。
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])NothingScales the compound path where scaleX is the horizontal scaling factor (as a percentage) and scaleY is the vertical scaling factor; 100.0 = 100%
按指定的比例因子(水平缩放比例scaleX和垂直缩放比例scaleY)缩放复合路径;100.0表示不缩放(即100%)。还可以选择是否同时改变对象的位置、填充图案、填充渐变、描边图案及线条宽度,并可以选择缩放基准点。
Rotate(angle as Double,[, changePositions as Boolean][, changeFillPatterns as Boolean][, changeFillGradients as Boolean][, changeStrokePattern as Boolean][, rotateAbout as AiTransformation])NothingRotates 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.
根据给定的角度逆时针或顺时针旋转艺术项目。可以设置是否同时变换对象的位置、填充图案、填充渐变和描边图案,以及选择旋转中心点。
Transform(transformationMatrix as Matrix,[, changePositions as Boolean][, changeFillPatterns as Boolean][, changeFillGradients as Boolean][, changeStrokePattern as Boolean][, changeLineWidths as Double][, transformAbout as AiTransformation])NothingTransforms the compound path by applying the specified transformation matrix.
通过应用指定的转换矩阵来变换复合路径。同样可以控制是否改变对象的位置、填充图案、填充渐变、描边图案和线条宽度,以及选择变换基准点。
Translate([deltaX as Double][, deltaY as Double][, transformObjects as Boolean][, transformFillPatterns as Boolean][, transformFillGradients as Boolean][, transformStrokePatterns as Boolean])NothingRepositions the compound path relative to the current position,where deltaX is the horizontal offset and deltaY is the vertical offset.
根据给定的横向偏移量deltaX和纵向偏移量deltaY重新定位复合路径相对于当前位置的位置。也可以选择是否同时变换对象、填充图案、填充渐变和描边图案。
ZOrder(zOrderCmd as AiZOrderMethod)NothingArranges the compound path’s position in the stacking order of the group or layer (Parent) that contains the object.
调整复合路径在包含此对象的组或图层中的堆叠顺序。
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.

'Selects path items in the current document that are not
'compound paths
Set appRef = CreateObject("Illustrator.Application")
counter = 0
If appRef.Documents.Count > 0 Then
    If appRef.ActiveDocument.PathItems.Count > 0 Then
        For Each pathArt In appRef.ActiveDocument.PathItems
            If (Not TypeName(pathArt.Parent) = "CompoundPathItem") Then
                pathArt.Selected = True
                counter = counter + 1
            Else
                pathArt.Selected = False
            End If
        Next
    End If
End If
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.

'Creates a new compound path item, adds 3 new
'path items, then sets the stroke of the compound path
Set appRef = CreateObject("Illustrator.Application")
Set frontDocument = appRef.ActiveDocument
Set activeLayer = frontDocument.activeLayer
Set newCompoundPath = activeLayer.CompoundPathItems.Add
'Create the path items
Set newPath = newCompoundPath.PathItems.Add
newPath.SetEntirePath Array(Array(30, 50), Array(30, 100))
Set newPath = newCompoundPath.PathItems.Add
newPath.SetEntirePath Array(Array(40, 100), Array(100, 100))
Set newPath = newCompoundPath.PathItems.Add
newPath.SetEntirePath Array(Array(100, 110), Array(100, 300))
'Set the stroke of the compound path
newPath.Stroked = True
newPath.StrokeWidth = 3.5
newPath.StrokeColor = frontDocument.Swatches(8).Color

page 37

CompoundPathItems

A collection of compound paths.

CompoundPathItems properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。该集合所属的Adobe Illustrator应用程序对象,可用于访问和控制整个应用程序的功能。
CountLongRead-only. The number of objects in the collection.
只读。表示集合中包含的对象数量。
ParentDocumentRead-only. The document that contains this object.
只读。包含当前对象的父级文档对象,即这个集合所在的上下文是某个Illustrator文档。
CompoundPathItem methods
MethodReturnsWhat it does
Add()CompoundPathItemCreates a new CompoundPathItem object.
创建并返回一个新的复合路径项目(CompoundPathItem)对象。
Index(item as CompoundPathItem)LongReturns the index position of the object within the collection.
返回指定的复合路径项目(CompoundPathItem)在集合中的索引位置。
Item(itemKey)CompoundPathItemReturns an object reference to the object identified by itemKey (name or index).
通过itemKey(可以是名称或索引)返回一个指向集合中特定复合路径项目对象的引用。
RemoveAll()NothingDeletes all objects in this collection.
删除当前集合中的所有复合路径项目对象,清空整个集合。
Counting compound paths
'Counts the compound path items in the current document and
'stores in numCPaths
Set appRef = CreateObject("Illustrator.Application")
If appRef.Documents.Count > 0 Then
    numCPaths = appRef.ActiveDocument.Layers(1).CompoundPathItems.Count
End If

page 38

DataSet

A set of data used for dynamic publishing. A dataset allows you to collect a number of variables and their dynamic data into one object. To create a DataSet object, you must have at least one variable bound to an art item.

For more information, see the Variable class and the section on “Dynamic Objects and Symbols” in Adobe Illustrator 2024 Scripting Guide.

For a sample script that uses a DataSet object, see DataSets.

DataSet properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。表示该数据集所属的Adobe Illustrator应用程序对象,可以用来访问和控制整个应用程序的功能。
NameStringThe name of the DataSet.
数据集的名称,用于标识和区分不同的数据集。
ParentDocumentRead-only. The name of the object that is this DataSet object’s parent.
只读。表示此数据集对象的父级对象名称,即包含此数据集的Illustrator文档对象。
DataSet methods
MethodReturnsWhat it does
Delete()NothingDeletes the object.
删除该数据集对象。
Display()NothingDisplays the DataSet.
显示或激活此数据集,使其在Illustrator中可见并可供编辑。
Update()NothingUpdates the DataSet.
更新数据集的内容,通常用于与外部数据源同步,确保数据显示为最新的状态。

page 39

DataSets

A collection of DataSet objects.

DataSets properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。表示该数据集所属的Adobe Illustrator应用程序对象,通过它可以访问整个Illustrator应用的功能和属性。
CountLongRead-only. The number of datasets in the collection.
只读。表示集合中数据集的数量,即当前文档或上下文中包含的数据集总数。
ParentDocumentRead-only. The name of the object that is this DataSet object’s parent.
只读。表示此数据集对象的父级对象名称,即包含这个数据集的文档对象。
DataSets methods
MethodReturnsWhat it does
Add()DataSetCreates a new DataSet object.
创建并添加一个新的数据集(DataSet)对象到集合中。
Index(item as DataSets)LongReturns the index position of the object within the collection.
返回指定数据集(DataSets)在当前集合中的索引位置。
Item(itemKey)DataSetReturns an object reference to the object identified by itemKey (name or index).
通过itemKey(可以是名称或索引)返回集合中特定数据集(DataSet)对象的引用。
RemoveAll()NothingDeletes all objects in this collection.
从集合中删除所有数据集对象,清空整个集合。
Creating datasets
'Creates two variables (visibility and text),
'creates two datasets using different variable
'values then displays each dataset
Set appRef = CreateObject("Illustrator.Application")
Set docRef = appRef.Documents.Add()
'Create a visibility variable
Set itemRef = docRef.PathItems.Rectangle(600, 200, 150, 150)
Set colorRef = CreateObject("Illustrator.RGBColor")
colorRef.Red = 255
itemRef.FillColor = colorRef
Set visibilityVar = docRef.Variables.Add()
visibilityVar.Kind = 2 'aiVisibility
itemRef.VisibilityVariable = visibilityVar
'Create a text variable
Set textRef = docRef.TextFrames.Add
textRef.Contents = "Text Variable, dataset 1"
textRef.Top = 400
textRef.Left = 200
Set textVar = docRef.Variables.Add
textVar.Kind = 3 'aiTextual
textRef.ContentVariable = textVar
'Create dataset 1
Set ds1 = docRef.DataSets.Add()
'Change data and create dataset 2
itemRef.Hidden = True
textRef.Contents = "Text Variable, dataset 2"
Set ds2 = docRef.DataSets.Add()
'Display datasets
ds1.Display
ds2.Display

page 41

Document

An Illustrator document. Documents are contained in the Application object.

一份Illustrator文档。文档包含在Application对象中。

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.

默认文档设置(那些以“Default”开头的属性)是全局设置,它们会影响当前打开的文档。请确保仅在文档打开状态下修改这些默认属性。请注意,如果在创建新对象之前将默认属性设置为所需值,您可以简化脚本编写,从而无需指定诸如FillColor和Stroked等具有相应默认属性的属性,从而提高脚本效率。

A document’s DocumentColorSpace, Height, and Width can be set only when the document is created. Once a document is created, these properties cannot be changed.

文档的DocumentColorSpace、Height和Width属性只能在创建文档时设置。一旦文档创建完成,这些属性就无法更改。

The frontmost document can be referred to as either AppRef.ActiveDocument or AppRef.Documents(1).

最前面的文档可以使用AppRef.ActiveDocument或AppRef.Documents(1)来引用。

Document properties
PropertyValue typeWhat it is
ActiveDataSetDataSetThe active DataSet object in the document.
文档中的当前活动数据集对象。
ActiveLayerLayerThe active Layer in the document.
文档中的当前活动图层。
ActiveViewViewRead-only. The document’s current View.
只读。文档当前的视图状态。
ApplicationApplicationRead-only. The Illustrator Application object.
只读。Illustrator 应用程序对象,表示与该文档相关的主应用程序。
ArtboardsArtboardsRead-only. All artboards in the document.
只读。文档中所有画板的集合。
BrushesBrushesRead-only. The Brushes contained in the document.
只读。文档中包含的所有画笔(刷子)对象的集合。
CharacterStylesCharacterStylesRead-only. The list of character styles in this document.
只读。文档中所有字符样式的列表。
CompoundPathItemsCompoundPathItemsRead-only. The CompoundPathItems contained in the document.
只读。文档中包含的所有复合路径项目的集合。
CropBoxVariant Array of 4 DoublesThe 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.
文档输出时裁剪框的边界坐标数组。文档默认没有裁剪框,要读取此属性需先设置 CropBox。
CropStyleAiCropOptionsThe style of the document’s cropping box.
文档裁剪框的样式。
DataSetsDataSetRead-only. A DataSets collection in the document.
只读。文档中数据集集合。
DefaultFillColorColor infoThe Color to fill new paths if default filled is true.
如果默认填充为 true,则用于填充新路径的颜色信息。
DefaultFilledBooleanIf true, a new path are filled.
如果为 true,则新创建的路径默认会被填充颜色。
DefaultFillOverprintBooleanIf true, the art beneath a filled object are overprinted by default.
如果为 true,则默认情况下填充的对象会覆盖其下方的艺术内容。
DefaultStrokeCapAiStrokeCapDefault type of line capping for paths created.
新创建路径的默认线端样式。
DefaultStrokeColorColor infoThe stroke color for new paths if default stroked is true.
如果默认描边为 true,则用于描边新路径的颜色信息。
DefaultStrokedBooleanIf true, the new path are stroked.
如果为 true,则新创建的路径默认会被描边。
DefaultStrokeDashesVariant Array of DoublesThe default lengths for dashes and gaps in dashed lines, starting with the first dash length, followed by the first gap length,and so on.
默认虚线和间隙长度的数组,按顺序列出第一个虚线段长度、第一个间隙长度,以此类推。
DefaultStrokeDashOffsetDoubleThe default distance into the dash pattern at which the pattern are started for new paths.
对于新路径,开始应用虚线模式时相对于起点的偏移量。
DefaultStrokeJoinAiStrokeJoinDefault type of joints in new paths.
新创建路径的默认线接合样式。
DefaultStrokeMiterLimitDoubleWhen 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.
当默认的线接合样式设置为尖角时,此属性指定何时将接合转换为斜角(倒角)样式。默认的斜接限制为4表示当尖角长度达到描边宽度的四倍时,接合方式从尖角变为斜角。范围:1至500;值为1表示使用斜角接合。
DefaultStrokeOverprintBooleanIf true, the art items beneath a stroked object are overprinted by default.
如果为 true,则默认情况下描边对象下的艺术内容会被覆盖打印。
DefaultStrokeWidthDoubleThe default width of stroke for new paths.
新路径的默认描边宽度。
DocumentColorSpaceAiDocumentColorSpaceRead-only. The color specification system to use for this document’s color space.
只读。文档颜色空间使用的颜色规范系统。
FullNameStringRead-only. The file associated with the document, which includes the complete path to the file.
只读。与文档关联的文件名及其完整路径。
GeometricBoundsVariant Array of 4 DoublesRead-only. The bounds of the illustration excluding the stroke width of any objects in the document.
只读。排除文档中任何对象描边宽度后,插图的边界框坐标数组。
GradientsGradientsRead-only. The Gradients collection contained in the document.
只读。文档中包含的所有渐变集合。
GraphicStylesGraphicStylesRead-only. The GraphicStyles contained in the document.
只读。文档中包含的所有图形样式集合。
GraphItemsGraphItemsRead-only. The GraphItems collection contained in the document.
只读。文档中包含的所有图表项目集合。
GroupItemsGroupItemsRead-only. The GroupItems collection contained in the document.
只读。文档中包含的所有群组项目的集合。
HeightDoubleRead-only. The height of the document, calculated from the GeometricBounds.
只读。根据几何边界计算出的文档高度。
InkListVariant ArrayRead-only. The list of inks in this document.
只读。文档中的油墨列表。
KinsokuSetObjectRead-only. The Kinsoku set of characters that cannot begin or end a line of Japanese text.
只读。日语文本中不能开始或结束一行的禁则字符集。
LayersLayersRead-only. The layers contained in the document.
只读。文档中包含的所有图层集合。
LegacyTextItemsLegacyTextItemsRead-only. The legacy text items in the document.
只读。文档中存在的旧版文本项集合。
MeshItemsMeshItemsRead-only. The mesh art items contained in the document.
只读。文档中包含的所有网格艺术项目集合。
MojikumiSetObjectRead-only. A list of predefined Mojikumi sets that specify the spacing for the layout and composition of Japanese text.
只读。预定义的用于指定日语文本布局和排版间距的 Mojikumi 集合列表。
NameStringRead-only. The document’s name (not the complete file path to the document).
只读。文档的名称(不包括文档的完整文件路径)。
NonNativeItemsNonNativeItemsRead-only. The non-native art items in this document.
只读。文档中非原生艺术项的集合。
OutputResolutionDoubleRead-only. The current output resolution for the document in dots per inch (dpi).
只读。文档当前的输出分辨率,单位为每英寸点数(dpi)。
PageItemsPageItemsRead-only. The PageItems (contains all art item classes) contained in the document.
只读。文档中包含的所有页面项目(包含了所有艺术项目类别)的集合。
PageOriginVariant Array of 2 DoublesThe zero-point of the page in the document without margins, relative to the overall height and width.
只读。文档中页面零点(无页边距)相对于整体高度和宽度的位置数组。
ParagraphStylesParagraphStylesRead-only. The list of paragraph styles in this document.
只读。文档中所有段落样式的列表。
ParentApplicationRead-only. The application that contains this document.
只读。包含该文档的应用程序对象。
PathStringRead-only. The file associated with the document, which includes the complete path to the file.
只读。与文档关联的文件及其完整路径。
PathItemsPathItemsRead-only. The PathItems contained in this document.
只读。此文档中包含的所有路径项目集合。
PatternsPatternsRead-only. The patterns contained in this document.
只读。此文档中包含的所有图案集合。
PlacedItemsPlacedItemsRead-only. The PlacedItems contained in this document.
只读。此文档中包含的所有置入项目集合。
PluginItemsPluginItemsRead-only. The PluginItems contained in this document.
只读。此文档中包含的所有插件项集合。
PrintTilesBooleanRead-only. If true, this document is tiled when printed.
只读。如果为 true,则表示此文档在打印时会被分块(平铺)。
RasterEffectSettingsRadialRepeatConfigThe document’s raster effect settings.
文档的栅格效果设置。
RasterItemsRasterItemsRead-only. The raster items contained in this document.
只读。此文档中包含的所有栅格项目集合。
RulerOriginVariant Array of 2 DoublesThe zero-point of the rulers in the document relative to the bottom left corner.
相对于左下角,文档中标尺的零点坐标数组。
RulerUnitsAiRulerUnitsRead-only. The default measurement units for the rulers in the document.
只读。文档中标尺使用的默认度量单位。
SavedBooleanIf true, the document has not been changed since the last time it was saved.
如果为 true,则表示自上次保存以来,文档未发生任何更改。
SelectionVariant Array of objectsThe array of references to the objects in this document’s current selection.
当前文档中所选对象引用的数组。
ShowPlacedImagesBooleanRead-only. If true, placed images are displayed in the document.
只读。如果为 true,则表示在文档中显示置入的图像。
SplitLongPathsBooleanRead-only. If true, long paths are split when printing.
只读。如果为 true,则表示在打印时长路径会被分割。
SpotsSpotsRead-only. The SpotColors contained in this document.
只读。此文档中包含的所有专色集合。
StationeryBooleanRead-only. If true, the file is a stationery file.
只读。如果为 true,则表示该文件是一个信纸文件。
StoriesStoriesRead-only. The story items in this document.
只读。此文档中的故事项目集合。
SwatchesSwatchesRead-only. The swatches in this document.
只读。此文档中的调色板集合。
SwatchGroupsSwatchGroupsRead-only. The swatch groups in this document.
只读。此文档中的调色板组集合。
SymbolItemsSymbolItemsRead-only. The symbol items in this document.
只读。此文档中的符号项目集合。
SymbolsSymbolsRead-only. The symbols in this document.
只读。此文档中的符号集合。
TagsTagsRead-only. The tags in this document.
只读。此文档中的标签集合。
TextFramesTextFramesRead-only. The text frames in this document.
只读。此文档中的文本框架集合。
TileFullPagesBooleanRead-only. If true, full pages are tiled when printing this document.
只读。如果为 true,则表示在打印此文档时会平铺整个页面。
UseDefaultScreenBooleanRead-only. If true, the printer’s default screen is used when printing this document.
只读。如果为 true,则表示在打印此文档时将使用打印机的默认网点大小。
VariablesVariablesRead-only. The variables in this document.
只读。此文档中的变量集合。
VariablesLockedBooleanIf true, the Variables in this document are locked.
如果为 true,则表示此文档中的变量被锁定,不可编辑或修改。
ViewsViewsRead-only. The views in this document.
只读。此文档中的视图集合。
VisibleBoundsVariant Array of 4 DoublesRead-only. The visible bounds of the document, including stroke width of any objects in the illustration.
只读。包括插图中所有对象描边宽度在内的可见边界坐标数组。
WidthDoubleRead-only. The width of this document, calculated from the GeometricBounds.
只读。根据几何边界计算出的文档宽度。
XMPStringStringThe XMP metadata packet associated with this document.
与此文档关联的XMP(可扩展元数据平台)元数据包字符串内容。
Document methods
MethodReturnsWhat it does
Arrange([layoutStyle as AiDocumentLayoutStyle])NothingArranges multiple documents in the given layout style.
按照给定的布局样式排列多个文档。
Activate()NothingBrings the first window associated with the document to the front.
将与该文档关联的第一个窗口激活并置于最前端。
Close([Saving as AiSaveOptions])NothingCloses the document.
关闭文档,可选择是否保存更改。
Capture(ImageFile as File,windowSize as Point)NothingCaptures the current document window to the target TIFF image file.
抓取当前文档窗口内容并保存为指定的目标TIFF图像文件中。
ConvertCoordinate(Coordinate as Point,Source as AiCoordinateSystem,Destination as AiCoordinateSystem)NothingConverts the coordinate system used for a single point between artboard and document coordinate systems.
在画板坐标系统和文档坐标系统之间转换单个点的坐标系统。
Copy()NothingCopies the current selection in the document to the clipboard; the associated document must be the frontmost document.
复制当前文档中的选定内容到剪贴板,要求该文档是当前最前面的文档。
Cut()NothingCuts the current selection in the document to the clipboard; the associated document must be the frontmost document.
剪切当前文档中的选定内容到剪贴板,要求该文档是当前最前面的文档。
Export(ExportFile as String,ExportFormat as AiExportType,[Options as Object])NothingExports the document to the specified file using one of the export file formats. Options for various formats are collected in ExportOptionsFormat objects. The appropriate file extension is automatically appended to the file name, except for Photoshop® documents. For these, you must include the file extension ( .psd) in the file specification.
使用指定的导出格式将文档导出到指定的文件。针对不同格式的选项被收集在ExportOptionsFormat对象中。对于除Photoshop®文档以外的所有格式,会自动添加相应的文件扩展名。对于Photoshop文档,需要在文件规范中包含文件扩展名(.psd)。
ExportPDFPreset(File as String)NothingExports the current PDF preset values to the file.
将当前PDF预设值导出到指定文件。
ExportPerspectiveGridPreset(File as String)NothingExports the current perspective grid preset values to the file.
将当前透视网格预设值导出到指定文件。
ExportPrintPreset(File as String)NothingExports the current print preset values to the file.
将当前打印预设值导出到指定文件。
ExportVariables(Filename as String)NothingExports the current variables from this document to the file.
将当前文档中的变量导出到指定文件。
FitArtboardToSelectedArt([Index as Long])booleanResizes the artboard at the given index to fit currently selected art. Index default is 0. Returns true on success.
根据当前选中的艺术元素调整指定索引处画板大小以适应其内容。默认索引为0。成功时返回true。
GetPerspectiveActivePlane()AiPerspectiveGridPlaneTypeRetrieves the active plane of the active perspective grid of the document.
获取文档中活动透视网格的活动平面。
GetScreenMode ()NormalScreenMode
FullScreenWithMenuMode
FullScreenNoMenuMode
PresentationMode
The mode of display for this view.
获取当前视图的显示模式。
GetViewMode ()OverprintPreview
PixelPreview
DefaultPreview
The view mode for this view.
获取当前视图的查看模式。
HidePerspectiveGrid()booleanHides the current active grid for the document. If no grid is visible, does nothing. Returns true if a grid is hidden.
隐藏当前文档的活动透视网格。如果透视网格未显示,则不执行操作,并在成功隐藏时返回true。
ImageCapture(ImageFile as File,[ClipBounds as Rect],[Options as ImageCaptureOptions])NothingCaptures the artwork content within the clipping boundaries in this document as a raster image, and writes the image data to a specified file.
If the bounds parameter is omitted, captures the entire artwork.
将此文档内指定裁剪边界的矢量艺术内容捕捉为光栅图像,并将图像数据写入到指定文件中。若省略bounds参数,则捕获整个艺术品内容。
ImportCharacterStyles(FileSpec as String)NothingLoads the character styles from the Illustrator file.
从Illustrator文件加载字符样式。
ImportParagraphStyles(FileSpec as String)NothingLoads the paragraph styles from the Illustrator file.
从Illustrator文件加载段落样式。
ImportPDFPreset(FileSpec as String[, ReplacingPreset as Boolean])NothingLoads all PDF presets from a file.
从文件中加载所有PDF预设,可选是否替换现有预设。
ImportPerspectiveGridPreset(FileSpec as String[, PerspectivePreset as String])NothingLoads a named perspective-grid preset from a file, or, if no name is given, all presets in the file.
从文件中加载命名的透视网格预设,若未提供名称,则加载文件中的所有预设。
ImportPrintPreset(PrintPreset as String FileSpec as String)NothingLoads the named print preset from the file.
从文件中加载指定名称的打印预设。
ImportVariables(Filename as String)NothingImports Variables from the specified file into this document.
从指定文件导入变量到当前文档。
IsRulerVisible ()booleanIf true, the ruler is visible.
如果为true,则表示标尺可见。
IsTransparencyGridVisible ()booleanIf true, the transparency grid is visible.
如果为true,则表示透明网格可见。
Paste()NothingPastes 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.
将剪贴板的内容粘贴到当前文档的当前图层中;如果文档是最前面的,则粘贴后的所有对象保持选中状态。
PrintOut(Options as PrintOptions)NothingPrints the document.
打印文档。
Rasterize(SourceArt as Variant,[, ClipBounds as Rect,][,Options as RasterizeOptions])PageItemRasterizes the source art(s) within the specified clip bounds. The source art(s) is disposed of as a result of the rasterization.
根据指定的裁剪边界对源艺术元素进行栅格化处理。栅格化后,源艺术元素会被丢弃并以PageItem形式返回结果。
RearrangeArtboards([ArtboardLayout as AiDocumentArtboardLayout, ArtboardRowsOrCols as Long,ArtboardSpacing as Long,ArtboardMoveArtwork as Boolean])booleanRearranges artboards in the document. All arguments are optional. Default layout style is aiGridByRow.The second argument specifies the number of rows or columns, as appropriate for the chosen layout style, in the range[1…DocNumArtboards-1], or 1(the default) for single row/column layouts.Spacing is a number of pixels, default 20.When last argument is true (the default), artwork is moved with the artboards.
重新排列文档中的画板。所有参数都是可选的,默认布局样式为aiGridByRow。第二个参数指定了根据所选布局样式所需的行数或列数,在[1…DocNumArtboards-1]范围内,对于单行/单列布局默认为1。间距是以像素为单位的数值,默认为20。最后一个参数为true(默认值)时,随画板移动其中的艺术作品。
Save()NothingSaves the document in its current location.
保存当前文档至其当前位置。
SaveAs([SaveIn as String][, Options as:EPSSaveOptions/IllustratorSaveOptions/PDFSaveOptions])NothingSaves the document in the specified file as an Illustrator, EPS, or PDF file.
将文档以Illustrator、EPS或PDF格式保存到指定的文件中。
SelectObjectsOnActiveArtboard()booleanSelects the objects on the currently active artboard. Returns true on success.
选择当前活动画板上的对象。成功时返回true。
SelectPerspectivePreset(PresetPreset as String)booleanSelects a predefined preset to define grid for the current document. Returns true on success.
选择预定义的透视网格预设,用于为当前文档定义透视网格。成功时返回true。
SetPerspectiveActivePlane(PerspectiveGridPlane as AiPerspectiveGridPlaneType)booleanSets the active plane of the active perspective grid of the document. Returns true on success.
设置文档当前活动透视网格的活动平面。成功时返回true。
ShowPerspectiveGrid()booleanShows the current active grid for the document, or if no grid is active, shows the default grid. Returns true on success.
显示当前文档的活动透视网格;如果尚未激活任何透视网格,则显示默认透视网格。成功时返回true。
WindowCapture(ImageFile as String,WindowSize as Point)NothingCaptures the current document to the target TIFF image file.
将当前文档窗口内容捕获并保存为目标TIFF图像文件。
WriteAsLibrary(File,libraryType)File AiLibraryTypeWrites the document to a file as a library of specified type.
将文档写入一个文件,作为指定类型的库文件。
Closing documents

If you close the document, you should set your document reference to Nothing to prevent your script accidentally trying to access closed documents.

'Closes the frontmost document without saving

Set appRef = CreateObject("Illustrator.Application")
Set docRef = appRef.Documents(1)
docRef.Close 2' aiDoNotSaveChanges
Set docRef = Nothing
Creating a document with defaults

'Sets the default stroke and fill in the current document to false

Set appRef = CreateObject("Illustrator.Application")
If (appRef.Documents.Count = 0) Then
    Set frontDocument = appRef.Documents.Add
Else
    Set frontDocument = appRef.Documents(1)
End If
frontDocument.DefaultFilled = False
frontDocument.DefaultStroked = False

page 50

Documents

A collection of documents.

Documents properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。Illustrator应用程序对象。这提供了对整个Illustrator应用程序的访问权限,可用于执行全局操作或查询应用程序级别的属性。
CountLongRead-only. The number of objects in the collection.
只读。集合中对象的数量。表示当前集合中包含的元素或对象的总数。
ParentObjectRead-only. The parent of this object.
只读。该对象的父级对象。这是指当前对象所在的上级对象,比如一个集合可能是另一个对象的成员,那么这个“Parent”属性就指向那个上级对象。在Illustrator中,这可能是指定对象属于的图层、文档、画板或者其他容器类对象。
Documents methods
MethodReturnsWhat it does
Add([documentColorSpace As AiDocumentColorSpace][, width as Double][, height as Double][, numArtBoards as Long][, artboardLayout as AiDocumentArtboardLayout] [, artboardSpacing as Double][, artboardRowsOrCols as Long])DocumentCreates a new document using optional parameters and returns a reference to the new document.
通过可选参数创建一个新的文档,如颜色空间、宽度、高度、画板数量、画板布局、画板间距和画板行数或列数,并返回对新创建文档的引用。
AddDocument(startupPreset as String[, presetSettings as DocumentPreset][, showOptionsDialog as Boolean)DocumentCreates a document from the preset, replacing any provided setting values, and returns a reference to the new document.
使用预设设置创建一个文档,可以替换提供的任何预设值,并显示选项对话框(如果需要),然后返回对新创建文档的引用。
Index(item as Document)LongReturns the index position of the object within the collection.
返回集合中指定文档对象在其所在位置的索引号。
Item(itemKey)DocumentReturns an object reference to the object identified by itemKey (name or index).
根据itemKey(名称或索引号)返回对集合中特定文档对象的引用。
Creating a document with a color space
python
'Creates a new RGB document
Set appRef = CreateObject("Illustrator.Application")
appRef.Documents.Add 1   'aiDocumentRGBColor

DocumentPreset

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

DocumentPreset properties
PropertyValue typeWhat it is
ArtboardLayoutAiDocumentArtboardLayoutThe layout of artboards in the new document. Default: AiGridByRow
新建文档中画板的布局方式。默认值:AiGridByRow(按行排列)
ArtboardRowsOrColsLongThe number of rows (for rows layout) or columns (for column layout) of artboards. Range: 1 to (NumArtboards - 1) or 1 for single row or column layouts. Default: 1
新建文档中画板的行数(对于行布局)或列数(对于列布局)。范围:1 到 (NumArtboards - 1)或在单行或单列布局时为1。默认值:1
ArtboardSpacingDoubleThe spacing between artboards in the new document. Default: 20.0
新建文档中画板之间的间距。默认值:20.0(单位通常为点)
ApplicationApplicationRead-only. The Illustrator Application object.
只读。Illustrator应用程序对象。
DocumentColorSpaceAiDocumentColorSpaceThe color space for the new document.
新建文档的颜色空间设置。
DocumentPreviewModeAiDocumentPreviewModeThe preview mode for the new document.
新建文档的预览模式设置。
DocumentRasterResolutionAiDocumentRasterResolutionThe raster resolution for the new document.
新建文档的栅格分辨率设置。
DocumentTitleStringThe document title.
文档的标题。
DocumentTransparencyGridAiDocumentTransparencyGridThe transparency grid color for the new document.
新建文档的透明网格颜色设置。
DocumentUnitsAiRulerUnitsThe ruler units for the new document.
新建文档的标尺单位设置。
HeightDoubleThe height in points. Default is 792.0
文档的高度,单位为点。默认值:792.0(即11英寸)
NumArtboardsLongThe number of artboards for the new document. Range: 1 to 100. Default: 1
新建文档中的画板数量。范围:1到100。默认值:1
WidthDoubleThe width in points. Default is 612.0
文档的宽度,单位为点。默认值:612.0(即8.5英寸)

EPSSaveOptions

Options that may be supplied when saving a document as an Illustrator EPS file. EPSSaveOptions can be supplied only in conjunction with the document SaveAs method. All properties are optional.

EPSSaveOptions properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。表示Illustrator应用程序对象本身。
ArtboardRangestringIf SaveMultipleArtboards is true, this is considered for multi-asset extraction, which specifies the artboard range. An empty string extracts all the artboards.Default: empty string
如果SaveMultipleArtboards为真,则在提取多资产时考虑此设置,用于指定要提取的艺术板范围。空字符串表示提取所有艺术板。默认值:空字符串
CMYKPostScriptBooleanIf true, CMYK PostScript® is used.
如果为真,则使用CMYK PostScript®格式。
CompatibilityAiCompatibilityIllustrator version compatibility for the EPS file format.Default: 24
EPS文件格式的Illustrator版本兼容性。默认值:24(即Illustrator 24版兼容)
CompatibleGradientPrintingBooleanIf true, a raster item of the gradient or gradient mesh are created so the object can be printed on PostScript level 2 printers. Default: false
如果为真,在PostScript Level 2打印机上打印渐变或渐变网格时,会创建一个栅格项以确保对象可以被打印。默认值:false
EmbedAllFontsBooleanIf true, fonts are included in the EPS file.
如果为真,则将字体嵌入到EPS文件中。
EmbedLinkedFilesBooleanIf true, linked image files are included in the saved document.
如果为真,则将链接的图像文件包含在保存的文档中。
FlattenOuputAiOutputFlatteningHow should transparency be flattened for file formats older than Illustrator 9 or greater.
指定对于早于Illustrator 9版本或更高版本的文件格式如何处理透明度压平。
IncludeDocumentThumbnailsBooleanIf true, the thumbnail image of the EPS artwork is included.
如果为真,则包含EPS作品的缩略图。
OverprintAiPDFOverprintThe style of overprinting. Default: 1
覆印样式。默认值:1
PostScriptAiEPSPostScriptLevel Enum Specifies the PostScript level to use when saving the file.
指定保存文件时使用的PostScript级别。
PreviewAiEPSPreviewFormat for the EPS preview image.
EPS预览图像的格式。
SaveMultipleArtboardsbooleanIf true, all artboards or range of artboards are saved. Default: false
如果为真,则保存所有艺术板或指定范围内的艺术板。默认值:false
Saving to EPS
#Saves the current document to dest in EPS format
#dest contains the full path and file name to save to
Sub exportFileAsEPS (dest)
    Set appRef = CreateObject("Illustrator.Application")
    Set newSaveOptions = CreateObject("Illustrator.EPSSaveOptions")
    If appRef.Documents.Count > 0 Then
        newSaveOptions.CMYKPostScript = True
        newSaveOptions.EmbedAllFonts = True
        Set frontDocument = appRef.ActiveDocument
        frontDocument.SaveAs dest, newSaveOptions
    End If
End Sub

page 54

ExportForScreens

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

ExportForScreensType
PropertyValue typeWhat it is
toFolderFile pathThe folder where the exported documents/assets/artboards are saved.
导出的文档/资产/艺术板保存的目标文件夹。
se_jpeg100/se_jpeg2 0/se_jpeg50/se_jpeg8 0/se_pdf/se_png24/s e_png8/se_svgFile typeThe file type in which the document is exported. For example, ExportForScreensType.se_jpeg100.
指定要导出的文档的文件类型。例如:ExportForScreensType.se_jpeg100表示以JPEG格式且质量为100%导出。
withOptionsAnyOptions for the file type specified. For further information,please refer to ExportOptionsJPEG, ExportOptionsPNG24, ExportOptionsPNG8, ExportOptionsSVG
指定文件类型的相关导出选项。具体信息请参考ExportOptionsJPEG、ExportOptionsPNG24、ExportOptionsPNG8和ExportOptionsSVG等类中提供的选项。
itemtoexportItem to exportAn item that needs to be exported. For example, a document, artboard, or asset.
需要导出的项目,可以是文档、艺术板或某个资产。
filenameprefixStringString prepended to each file name.
添加到每个导出文件名前缀的字符串。
ExportForScaleType
PropertyValue typeWhat it is
FactorLongScale artwork by factors like 1x, 2x, 3x and so on, where 1x means 72 ppi.
通过倍数(如1x、2x、3x等)来缩放艺术作品,其中1x表示72 ppi。
HeightLongScale artwork by specifying artwork height in pixels like 100px, 124px etc. Width of the artwork is adjusted automatically to maintain the aspect ratio.
通过指定像素高度(如100px、124px等)来缩放艺术作品,宽度会自动调整以保持宽高比。
ResolutionLongScale artwork by specifying resolution in ppi like 72 ppi, 100 ppi, 144 ppi etc
通过指定分辨率(如72 ppi、100 ppi、144 ppi等)来缩放艺术作品。
WidthLongScale artwork by specifying artwork width in pixels like 100px, 124px etc. Height of the artwork is adjusted automatically to maintain the aspect ratio.
通过指定像素宽度(如100px、124px等)来缩放艺术作品,高度会自动调整以保持宽高比。

page 55

ExportOptionsAutoCAD

Options for exporting a document as an AutoCAD file, used with the Document Export method. All properties are optional.

When you export a document, the default file extension (DWG) is appended automatically. You should not include a file extension in the file specification. To override the default AutoCAD export format, use the ExportFileFormat property.

ExportOptionsAutoCAD properties
PropertyValue typeWhat it is
AlterPathsForAppearanceBooleanIf true, paths are altered (if needed) to maintain appearance.Default: false
如果为真,则在必要时调整路径以保持外观。默认:false
ApplicationApplicationRead-only. The Illustrator Application object.
只读属性。Illustrator应用程序对象,提供对Illustrator应用本身的操作访问权限。
ColorsAiAutoCADColorsThe number of colors to export into the AutoCAD file.
导出到AutoCAD文件中的颜色数量设置。
ConvertTextToOutlinesBooleanIf true, text is converted to outlines. Default: false
如果为真,则将文本转换为轮廓。默认:false
ExportFileFormatAiAutoCADExportFileFormatThe file format to which to export. Default: 1
指定要导出的文件格式。默认:1(代表某个特定的AutoCAD格式)
ExportOptionAiAutoCADExportOptionWhether to preserve appearance or editability during export. Default: 1
控制在导出过程中是否保留图形外观或可编辑性。默认:1(表示某种预设选项)
ExportSelectedArtOnlyBooleanIf true, only selected artwork is exported. Default: false
如果为真,则仅导出选定的艺术品。默认:false
RasterFormatAiAutoCADRasterFormatThe format in which to export raster art.
指定导出栅格图像的格式。
ScaleLineweightsBooleanIf true, line weights are scaled by the same scaling factor as the rest of the drawing. Default: false
如果为真,则按照与图纸其余部分相同的缩放因子来缩放线宽。默认:false
UnitAiAutoCADUnitMeasurement units from which to map.
测量单位,用于确定从何种单位映射至AutoCAD中。
UnitScaleRatioDoubleThe ratio by which to scale output.
输出的比例系数,即缩放输出的比例大小。
VersionAiAutoCADCompatibilityThe release of AutoCAD to export to. Default: 5 ’aiAutoCADRelease24
指定要导出到的AutoCAD版本。默认:5 ‘aiAutoCADRelease24’(表示兼容AutoCAD Release 24或类似版本)

page 56

ExportOptionsGIF

Options that may be supplied when exporting a document as a GIF file. See the Document Export method for additional details.

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

ExportOptionsGIF properties
PropertyValue typeWhat it is
AntiAliasingBooleanIf true, the exported image is anti-aliased. Default: true
如果为真,则导出的图像会进行抗锯齿处理,以改善边缘平滑度。默认:true
ApplicationApplicationRead-only. The Illustrator Application object.
只读属性。Illustrator应用程序对象,提供了对整个Illustrator应用的操作访问权限。
ArtBoardClippingBooleanIf true, the exported image is clipped to the art board. Default: false
如果为真,则导出的图像将被裁剪到画板边界内。默认:false
ColorCountLongThe number of colors in the exported image’s color table. Range: 2 to 256. Default: 128
导出图像颜色表中颜色的数量。范围:2至256,默认:128
ColorDitherAiColorDitherMethodThe method used to dither colors in the exported image. Default: &H4466736E
在导出图像中使用的颜色抖动方法。默认:&H4466736E(代表某种特定的抖动算法)
ColorReductionAiColorReductionMethodThe method used to reduce the number of colors in the exported image.Default: &H536C7476
用于减少导出图像中颜色数量的方法。默认:&H536C7476(表示某种颜色减色算法)
DitherPercentLongThe amount that the colors of the exported image are dithered, where 100.0 is 100%
导出图像的颜色抖动程度,100.0代表100%。
HorizontalScaleDoubleThe horizontal scaling factor applied to the exported image, where 100.0 is 100%. Default: 100.0
应用于导出图像的水平缩放因子,100.0代表100%缩放(即无缩放)。默认:100.0
InfoLossPercentLongThe level of information loss allowed during compression, where 100.0 is 100%. Default: 0
允许在压缩过程中损失的信息级别,100.0代表100%(即最大允许信息损失)。默认:0
InterlacedBooleanIf true, the exported image is interlaced. Default: false
如果为真,则导出的图像采用交错显示模式。默认:false(非交错显示)
MatteBooleanIf true, the art board is matted with a color. Default: true
如果为真,则使用指定颜色为画板添加边框或背景填充(即“垫片”效果)。默认:true
MatteColorRGBColorThe color to use when matting the art board. Default: white
用于给画板添加边框或背景填充的颜色。默认:白色
SaveAsHTMLBooleanIf true, the exported image is saved with an accompanying HTML file. Default: false
如果为真,则导出的图像会伴随一个HTML文件一起保存。默认:false(仅保存图像文件而不生成HTML文件)
TransparencyBooleanIf true, the exported image uses transparency. Default: true
如果为真,则导出的图像会保留并使用透明度信息。默认:true(即图像支持透明效果)
VerticalScaleDoubleThe vertical scaling factor applied to the exported image, where 100.0 is 100%. Default: 100.0
应用于导出图像的垂直缩放因子,100.0代表100%缩放(即无缩放)。默认:100.0
WebSnapLongHow much should the color table be changed to match the web palette, where 100 is maximum. Default: 0
表示颜色表应调整的程度以匹配网页调色板,100为最大程度匹配。默认:0(表示不进行调整以匹配网页调色板)
Exporting as GIF
#Exports the current document as GIF to dest
#dest contains the full path and file name to save to
Sub exportFileAsGIF (dest)
    Set appRef = CreateObject("Illustrator.Application")
    Set gifExportOptions = CreateObject("Illustrator.ExportOptionsGIF")
    If appRef.Documents.Count > 0 Then
        gifExportOptions.AntiAliasing = False
        gifExportOptions.ColorCount = 64
        gifExportOptions.ColorDither = 1147564910 #aiDiffusion
        Set docRef = appRef.ActiveDocument
        Call docRef.Export (dest, 6, gifEportOptions) #6 = aiGIF
    End If
End Sub

page 58

ExportOptionsJPEG

Options that may be supplied when exporting a document as a JPEG file. See the Document Export method for additional details.

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

ExportOptionsJPEG
PropertyValue typeWhat it is
AntiAliasingBooleanIf true, the exported image is anti-aliased. Default: true
如果为真,则导出的图像进行抗锯齿处理,以提升边缘平滑度。默认:true
ApplicationApplicationRead-only. The Illustrator Application object.
只读属性。表示Illustrator应用程序本身的对象引用,提供了对整个Illustrator应用的操作访问权限。
ArtBoardClippingBooleanIf true, the exported image is clipped to the art board. Default: false
如果为真,则导出的图像会被裁剪至画板大小。默认:false
BlurAmountDoubleThe amount of blur to apply to the exported image. Range: 0.0 to 2.0. Default: 0.0
应用于导出图像的模糊程度。范围:0.0到2.0,默认:0.0(即不添加模糊效果)
HorizontalScaleDoubleThe horizontal scaling factor applied to the exported image, where 100.0 is 100%. Default: 100.0
应用于导出图像的水平缩放因子,100.0代表100%缩放(即无缩放)。默认:100.0
MatteBooleanIf true, the art board is matted with a color. Default: true
如果为真,则在导出时使用指定颜色为画板添加边框或背景填充。默认:true
MatteColorRGBColorThe color to use when matting the art board. Default: white
用于给画板添加边框或背景填充的颜色。默认:白色
OptimizationBooleanIf true, the exported image is optimized for web viewing. Default: true
如果为真,则导出的图像会针对网页查看进行优化。默认:true
QualitySettingLongThe quality of the exported image. Range: 0 to 100. Default: 30
导出图像的质量设置。范围:0到100,默认:30(质量级别越高,图像细节保留越多,文件可能越大)
SaveAsHTMLBooleanIf true, the exported image is saved with an accompanying HTML file. Default: false
如果为真,则导出的图像会伴随一个HTML文件一起保存。默认:false(仅保存图像文件而不生成HTML文件)
VerticalScaleDoubleThe vertical scaling factor applied to the exported image, where 100.0 is 100%. Default: 100.0
应用于导出图像的垂直缩放因子,100.0代表100%缩放(即无缩放)。默认:100.0
Exporting to JPEG
#Exports the current document as JPEG to dest
#dest contains the full path and file name to save to
Sub exportFileAsJPEG (dest)
    Set appRef = CreateObject("Illustrator.Application")
    Set jpegExportOptions = CreateObject("Illustrator.ExportOptionsJPEG")
    If appRef.Documents.Count > 0 Then
        jpegExportOptions.AntiAliasing = False
        jpegExportOptions.QualitySetting = 70
        Set docRef = appRef.ActiveDocument
        Call docRef.Export (dest, 1, jpegExportOptions) ' 1 = aiJPEG
    End If
End Sub

page 60

ExportOptionsPhotoshop

Options that may be supplied when exporting a document as an Adobe Photoshop® file. See the Document Export method for additional details.

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

All properties are optional.

ExportOptionsPhotoshop properties
PropertyValue typeWhat it is
AntiAliasingBooleanIf true, the exported image is anti-aliased. Default: true
如果设置为true,则导出的图像将进行抗锯齿处理,以消除边缘像素的锯齿效果。默认:true
ApplicationApplicationRead-only. The Illustrator Application object.
只读属性。表示Illustrator应用程序自身的对象,用于访问和操作整个Illustrator应用。
ArtboardRangestringIf SaveMultipleArtboards is true, this is considered for multi-asset extraction, which specifies the artboard range. An empty string extracts all the artboards. Default: empty string
如果SaveMultipleArtboards设为true,此属性用于多资产提取时指定要导出的艺术板范围。空字符串表示提取所有艺术板。默认:空字符串
EditableTextBooleanIf true, text objects are exported as editable text layers. Default: true
若为true,则文本对象在导出时会作为可编辑的文字层保存。默认:true
EmbedICCProfileBooleanIf true, an ICC profile are embedded in the exported file. Default: false
若为true,则会在导出文件中嵌入ICC色彩配置文件。默认:false
ImageColorSpaceAiImageColorSpaceThe color space of the exported file.
MaximumEditabilityBooleanIf true, preserve as much of the original document’s structure as possible when exporting. Default: true
若为true,在导出过程中尽可能保留原始文档结构以便后期编辑。默认:true
ResolutionDoubleThe resolution of the exported file in dots per inch. Range: 72 to 2400. Default: 150
导出文件的分辨率,单位为每英寸点数(DPI)。范围:72至2400,默认:150 DPI
SaveMultipleArtboardsbooleanIf true, all artboards or range of artboards are saved. Default: false
若为true,则保存所有或指定范围内的多个艺术板。默认:false(仅保存当前选择的艺术板)
WarningsBooleanIf true, a warning dialog are displayed because of conflicts in the export settings. Default: true
若为true,当因导出设置冲突而产生警告时,将显示警告对话框。默认:true
WriteLayersBooleanIf true, the document layers are preserved in the exported file. Default: true
若为true,则在导出文件中保持文档中的图层结构。默认:true(即保留下各图层信息)
Exporting to Photoshop

This example exports the current document as a Photoshop 5 file with layers.

#Exports the current document as PSD (Photoshop) to dest
#dest contains the full path and file name to save to
Sub exportFileAsPSD (dest)
    Set appRef = CreateObject("Illustrator.Application")
    Set psdExportOptions = CreateObject("Illustrator.ExportOptionsPhotoshop")
    If appRef.Documents.Count > 0 Then
        psdExportOptions.Resolution = 150
        Set docRef = appRef.ActiveDocument
        Call docRef.Export (dest, 2, psdExportOptions)  #2 = aiPhotoshop
    End If
End Sub

CHAPTER 1: VBScript Object Reference ExportOptionsPNG8 62

page 62

ExportOptionsPNG8

Options that may be supplied when exporting a document as an 8-bit PNG file. See the Document Export method for additional details.

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

ExportOptionsPNG8 properties
PropertyValue typeWhat it is
AntiAliasingBooleanIf true, the exported image is anti-aliased. Default: true
如果为 true,则导出的图像会进行抗锯齿处理。默认值:true
ApplicationApplicationRead-only. The Illustrator Application object.
只读。Illustrator 应用程序对象。
ArtBoardClippingBooleanIf true, the exported image is clipped to the art board. Default: false
如果为 true,导出的图像将被裁剪至画板内。默认值:false
ColorCountLongThe number of colors in the exported image’s color table. Range: 2 to 256. Default: 128
导出图像颜色表中的颜色数量。范围:2 至 256。默认值:128
ColorDitherAiColorDitherMethodThe method used to dither colors in the exported image. Default: &H4466736E
用于在导出图像中抖动颜色的方法。默认值:&H4466736E
ColorReductionAiColorReductionMethodThe method used to reduce the number of colors in the exported image.Default: &H536C7476
用于减少导出图像中颜色数量的方法。默认值:&H536C7476
DitherPercentLongSpecifies how much the colors of the exported image are dithered, where 100.0 is 100%
指定导出图像的颜色的抖动程度,其中 100.0 表示 100%
HorizontalScaleDoubleThe horizontal scaling factor applied to the exported image, where 100.0 is 100%. Default: 100.0
应用于导出图像的水平缩放因子,其中 100.0 表示不缩放(100%)。默认值:100.0
InterlacedBooleanIf true, the exported image are interlaced. Default: false
如果为 true,则导出的图像将以交错方式显示。默认值:false
MatteBooleanIf true, the art board is matted with a color. Default: true
如果为 true,则画板边缘会被特定颜色填充(打底色)。默认值:true
MatteColorRGBColorThe color to use when matting the art board. Default: white
用于填充画板背景的颜色。默认值:白色
SaveAsHTMLBooleanIf true, the exported image is saved with an accompanying HTML file. Default: false
如果为 true,则导出的图像将与一个配套的 HTML 文件一起保存。默认值:false
TransparencyBooleanIf true, the exported image uses transparency. Default: true
如果为 true,则导出的图像将包含透明度信息。默认值:true
VerticalScaleDoubleThe vertical scaling factor applied to the exported image, where 100.0 is 100%. Default: 100.0
应用于导出图像的垂直缩放因子,其中 100.0 表示不缩放(100%)。默认值:100.0
WebSnapLongSpecifies how much the color table are changed to match the Web palette, where 100 is maximum. Default: 0
指定颜色表改变的程度以匹配网页安全色盘,其中 100 表示最大匹配程度。默认值:0
Exporting to PNG8

This example exports the current document as a PNG8 file.

'Exports the current document as PNG8 to dest
'dest contains the full path and file name to save to
Sub exportFileAsPNG (dest)
    Set appRef = CreateObject("Illustrator.Application")
    Set png8ExportOptions = CreateObject("Illustrator.ExportOptionsPNG8")
    If appRef.Documents.Count > 0 Then
        png8ExportOptions.AntiAliasing = False
        png8ExportOptions.Interlaced = True
        Set docRef = appRef.ActiveDocument
        Call docRef.Export (dest, 4, png8ExportOptions) ' 4 = aiPNG8
    End If
End Sub

page 64

ExportOptionsPNG24

Options that may be supplied when exporting a document as a 24-bit PNG file. See the Document Export method for additional details.

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

ExportOptionsPNG24 properties
PropertyValue typeWhat it is
AntiAliasingBooleanIf true, the exported image is anti-aliased. Default: true
若设置为 true,则导出的图像会应用抗锯齿效果,使得边缘更平滑。默认值:true
ApplicationApplicationRead-only. The Illustrator Application object.
只读属性。表示Illustrator应用程序自身的一个引用或实例。
ArtBoardClippingBooleanIf true, the exported image is clipped to the art board. Default: false
如果该值为 true,则在导出图像时将裁剪至画板边界内。默认值:false
HorizontalScaleDoubleThe horizontal scaling factor applied to the exported image, where 100.0 is 100%. Default: 100.0
应用于导出图像的水平缩放比例,100.0 表示不缩放(即原尺寸的100%)。默认值:100.0
MatteBooleanIf true, the art board is matted with a color. Default: true
若设为 true,则会在画板周围添加一个颜色边框(垫底色)。默认值:true
MatteColorRGBColorThe color to use when matting the art board. Default: white
用于填充画板背景边框的颜色。默认值:白色
SaveAsHTMLBooleanIf true, the exported image is saved with an accompanying HTML file. Default: false
若设置为 true,则导出图像的同时还会生成一个配套的HTML文件。默认值:false
TransparencyBooleanIf true, the exported image uses transparency. Default: true
若设置为 true,则导出的图像将包含透明度信息。默认值:true
VerticalScaleDoubleThe vertical scaling factor applied to the exported image, where 100.0 is 100%. Default: 100.0
应用于导出图像的垂直缩放比例,100.0 表示不缩放(即原尺寸的100%)。默认值:100.0
Exporting to PNG24

This example exports the current document as a PNG24 file with specific options.

#Exports current document as PNG24 to dest
#dest contains the full path and file name to save to
Sub exportFileAsPNG (dest)
    Set appRef = CreateObject("Illustrator.Application")
    Set png24ExportOptions = CreateObject("Illustrator.ExportOptionsPNG24")
    If appRef.Documents.Count > 0 Then
        png24ExportOptions.AntiAliasing = False
        png24ExportOptions.Transparency = False
        Set docRef = appRef.ActiveDocument
        Call docRef.Export (dest, 5, png24ExportOptions)  #5 = aiPNG24
    End If
End Sub

page 66

ExportOptionsSVG

Options that may be supplied when exporting a document as a SVG file. See the Document Export method for additional details.

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

ExportOptionsSVG properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。Illustrator应用程序的对象,用于访问和操作整个Illustrator应用。
ArtboardRangeStringA range of artboards to save, if SaveMultipleArtboards is true. A comma-delimited list of artboard names., or the empty string to save all artboards. Default: empty string
如果SaveMultipleArtboards设为true,则指定要保存的艺术板范围。以逗号分隔的艺术板名称列表,或者空字符串表示保存所有艺术板。默认:空字符串
CompressedBooleanIf true, the exported file is compressed. Default: false
如果设置为true,则导出的文件将被压缩。默认:false(即不压缩)
CoordinatePrecisionLongThe decimal precision for element coordinate values.Range: 1 to 7. Default: 3
元素坐标值的小数精度。范围:1到7,默认:3
CSSPropertiesAiSVGCSSPropertyLocationSpecifies how the CSS properties of the document are included in the exported file
指定文档中的CSS属性如何包含在导出的文件中。
DocumentEncodingAiSVGDocumentEncodingSpecifies how the text in the document is encoded. Default: 1
指定文档中文本的编码方式。默认:1(对应某个特定的文本编码格式)
DTDAiSVGDTDVersionThe SVG version to which the file should conform.Default: 2
指定导出文件应遵循的SVG版本。默认:2(通常指SVG 1.1或更高版本)
EmbedRasterImagesBooleanIf true, all raster images contained in the document are embedded in the saved file.
如果为true,则文档中包含的所有栅格图像都会嵌入到保存的文件中。
FontSubsettingAiSVGFontSubsettingThe font glyphs included in the export file.
指定导出文件中包含的字体字形子集。
FontTypeAiSVGFontTypeThe type of font included in the exported file. Default: 1 aiCEFFont
指定导出文件中包含的字体类型。默认:1 aiCEFFont(通常指使用SVG内嵌字体,如SVG中的SVG字体或CFF OpenType字体)
IncludeFileInfoBooleanIf true, the XMP (Extensible Metadata Platform) metadata are included in the output file. Default: false
如果设置为true,则在输出文件中包含XMP(Extensible Metadata Platform)元数据信息。默认:false(即不包含XMP元数据)
IncludeUnusedStylesBooleanIf true, save unused styles in the exported file. Default: false
如果设置为true,则在导出文件中保存未使用的样式。默认:false(即不保存未使用的样式)
IncludeVariablesAndDatasetsBooleanIf true, Variables and Datasets are included. Default:false
如果设置为true,则变量和数据集将被包含在导出内容中。默认:false(即不包含变量和数据集)
OptimizeForSVGViewerBooleanIf true, the Adobe namespace is included. Default: false
如果设置为true,则在文件中包含Adobe命名空间以优化与Adobe SVG Viewer的兼容性。默认:false
PreserveEditabilityBooleanIf true, preserve Illustrator editing capability when exporting the document.Default: false
如果设置为true,则在导出文档时保留Illustrator的编辑能力。默认:false(即可能丢失部分编辑功能)
SaveMultipleArtboardsbooleanIf true, save the artboards specified by artboardRange in the exported file. Default: false
如果设置为true,则按照ArtboardRange指定的艺术板范围,在导出文件中保存多个艺术板。默认:false(仅保存当前选择的艺术板)
SlicesBooleanIf true, preserve slice data in exported document. Default: false
如果设置为true,则在导出文档中保留切片数据。默认:false(即不保存切片数据)
SVGAutoKerningBooleanIf true, SVG automatic kerning is allowed in the file. Default:false
如果设置为true,则允许文件中使用SVG自动字间距调整。默认:false(即不启用SVG自动字间距调整)
SVGTextOnPathBooleanIf true, the SVG text-on-path construct is allowed in the file. Default: false
如果设置为true,则允许文件中使用SVG文本沿路径排列的功能。默认:false(即不允许文本沿路径排列)
Exporting to SVG
#Exports the current document as SVG to dest
#dest contains the full path and file name to save to
Sub exportFileAsSVG (dest)
    Set appRef = CreateObject("Illustrator.Application")
    Set svgExportOptions = CreateObject("Illustrator.ExportOptionsSVG")
    If appRef.Documents.Count > 0 Then
        svgExportOptions.EmbedRasterImages = True
        svgExportOptions.FontSubsetting = 7 #aiAllGlyphs
        Set docRef = appRef.ActiveDocument
        Call docRef.Export (dest, 3, svgExportOptions) #3 = aiSVG
    End If
End Sub

page 68

ExportOptionsTIFF

Options that may be supplied when exporting a document as a TIFF file. See the Document Export method for additional details.

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

All properties are optional.

ExportOptionsTIFF properties
PropertyValue typeWhat it is
AntiAliasingbooleanIf true, the exported image should be anti-aliased. Default: true
如果设置为true,则导出的图像将进行抗锯齿处理,以提高边缘平滑度。默认:true
ArtboardRangestringIf SaveMultipleArtboards is true, this is considered for multi-asset extraction, which specifies the artboard range. An empty string extracts all the rtboards. Default: empty string
如果SaveMultipleArtboards设为true,则此属性用于多资产提取时指定要导出的艺术板范围。空字符串表示提取所有艺术板。默认:空字符串
ByteOrderAiTIFFByteOrderThe byte order to use in the new file.
在新文件中使用的字节顺序(通常是LittleEndian或BigEndian)。
ImageColorSpaceAiImageColorSpaceThe color space of the exported file. Default: aiImageRGB
导出文件的颜色空间。默认:aiImageRGB(即RGB颜色空间)
IZWCompressionbooleanIf true, use IZW compression in the new file.
如果设置为true,则在新文件中使用IZW压缩算法。
Resolutionnumber (double)Resolution of the exported file in dots per inch (dpi). Range: 72.0 to 2400.0. Default: 150.0
导出文件的分辨率,单位为每英寸点数(DPI)。范围:72.0至2400.0,默认:150.0 DPI
SaveMultipleArtboardsbooleanIf true, all artboards or range of artboards are saved. Default: false
如果设置为true,则保存所有或指定范围内的多个艺术板。默认:false(仅保存当前选择的艺术板)
Exporting to TIFF format
#Exports the current document as TIFF to dest
#dest contains the full path and file name to save to
Sub exportFileAsTIFF (dest)
    Set appRef = CreateObject("Illustrator.Application")
    Set tiffExportOptions = CreateObject("Illustrator.ExportOptionsTIFF")
    If appRef.Documents.Count > 0 Then
        tiffExportOptions.imageColorSpace = 2 #aiImageRGB
        tiffExportOptions.resolution = 150
        tiffExportOptions.lZWCompression = true
        Set docRef = appRef.ActiveDocument
        Call docRef.Export (dest, 9, tiffExportOptions)  #9 = aiTIFF
    End If
End Sub

page 69

ExportOptionsWebP

Options for exporting a document as a WebP fileSee 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.

All properties are optional.

ExportOptionsWebP properties
PropertyValue typeWhat it is
antiAliasingAntiAliasingMethodThe type of antialiasing method of the exported image. Default - AntiAliasingMethod.TypeOptimized.
导出图像的抗锯齿方法类型。默认:AntiAliasingMethod.TypeOptimized(优化型抗锯齿)
losslessCompressionbooleanIndicates whether to have lossless or lossy compression.
指示是否采用无损压缩或有损压缩方式。
imageQualitynumber (long)In lossy compression, indicates the quality of the exported image. Default - 100 Range - 0 to 100
在有损压缩时,表示导出图像的质量等级。默认:100 范围:0到100
isTransparentbooleanIf true, the exported image use transparency. Default - true.
如果为true,则导出的图像将使用透明度效果。默认:true
embedICCProfilebooleanIf true, an ICC profile should be embedded in the exported file. Default - true.
如果为true,则应在导出文件中嵌入ICC色彩配置文件。默认:true
pPInumber (double)Resolution of the exported file in pixels per inch (ppi). Default - 72.0 Range - 4.0 to 2400.0
导出文件的分辨率,单位为每英寸像素数(PPI)。默认:72.0 范围:4.0至2400.0
matteColorRGBColorMatte color to be used for background if image is not transparent
如果图像不透明,则用于背景填充的颜色(即衬底色)。
typenamestringThe class name of the referenced object.
引用对象的类名称。通常用于标识对象的实际类型。
Exporting to WebP format

//Exports current document to dest as a WebP file with specified options, dest contains

the full path including the file name

function exportFileToWebP (dest) {
    if ( app.documents.length > 0 ) {
        var exportOptions = new ExportOptionsWebP();
        var type = ExportType.WEBP;
        var fileSpec = new File(dest);
        exportOptions.isTransparent = true;
        exportOptions.imageQuality = 100;
        app.activeDocument.exportFile( fileSpec, type, exportOptions );
    }
}

CHAPTER 1: VBScript Object Reference FreeHandFileOptions 70

page 70

FreeHandFileOptions

Options for opening a FreeHand file.

FreeHandFileOptions properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。Illustrator应用程序对象,提供了对整个应用程序的访问。
ConvertTextToOutlinesBooleanIf true, converts all text to outlines. Default: false
如果设置为 true,则在打开文档时会将所有文本转换为轮廓(路径)。默认值:false
ImportSinglePageBooleanIf true, imports only the page specified in the PageToOpen property. Default: true
如果设置为 true,则仅导入指定在 PageToOpen 属性中的页面。适用于打开多页文档的情况。默认值:true
PageToOpenLongThe number of the page to import when opening a multipage document. Valid only when ImportSinglePage is true.
当 ImportSinglePage 设置为 true 时,表示要从一个多页文档中打开的页面编号。仅在 ImportSinglePage 为真时有效。
ParentDocumentRead-only. The document that contains this object.
只读。包含此对象的文档对象引用,提供对此对象所在文档上下文的访问。

page 71

FXGSaveOptions

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

FXGSaveOptions properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。Illustrator应用程序对象,提供对整个应用程序的访问和控制。
ArtboardRangestringIf SaveMultipleArtboards is true, this is considered for multi-asset extraction, whichspecifies the artboard range. An empty string extracts all the artboards. Default: empty string
如果SaveMultipleArtboards设置为 true,则用于多资源提取时指定画板范围。空字符串表示提取所有画板。默认值:空字符串
BlendsPolicyAiBlendsExpandPolicyThe policy used by FXG to expand blends. Default:AiAutomaticallyConvertBlends
FXG 扩展混合模式时所采用的策略,默认为 AiAutomaticallyConvertBlends(自动转换混合效果)。
DownsampleLinkedImagesbooleanIf true, linked images are downsampled (at 72 dpi).Default: false
若为 true,则链接的图像会被降采样至 72 dpi。默认值:false
FiltersPolicyAiFiltersPreservePolicyThe policy used by FXG to preserve filters. Default: 3
FXG 保留滤镜效果时采用的策略,默认为某个特定值(这里未明确指出,默认值应查阅文档确认)。
GradientsPolicyAiGradientsPreservePolicyThe policy used by FXG to preserve gradients. Default:4aiAutomaticallyConvertGradients
FXG 保留渐变时采用的策略,默认为 AiAutomaticallyConvertGradients(自动转换渐变)。
IncludeUnusedSymbolsbooleanIf true, unused symbols are included. Default: false
若为 true,则包含未使用的符号。默认值:false
PreserveEditingCapabilitiesbooleanIf true, the editing capabilities of FXG are preserved. Default: true
若为 true,则在 FXG 中保留编辑功能。默认值:true
SaveMultipleArtboardsbooleanIf true, all artboards or range of artboards are saved. Default: false
若为 true,则保存所有画板或指定范围内的画板。默认值:false
TextPolicyAiTextPreservePolicyThe policy used by FXG to preserve text. Default:4aiAutomaticallyConvertText
FXG 保留文本时采用的策略,默认为 AiAutomaticallyConvertText(自动转换文本)。
VersionAiFXGVersionThe version of the FXG file format to create. Default: 2
创建 FXG 文件格式的版本号。默认值:2

page 72

Gradient

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

Gradient properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。Illustrator 应用程序对象,提供对整个 Illustrator 应用程序的访问和控制。
GradientStopsGradientStopsRead-only. The gradient stops contained in this gradient.
只读。该渐变中包含的所有渐变停止点,即渐变颜色和位置的集合。
NameStringThe gradient’s name.
此渐变的名称,用于标识和在库中引用该渐变。
ParentDocumentRead-only. The document that contains this gradient.
只读。包含此渐变的文档对象,表明该渐变是属于哪个特定Illustrator文档的资源。
TypeAiGradientTypeThe kind of the gradient, either radial or linear.
渐变的类型,可以是径向渐变(radial)或线性渐变(linear),定义了颜色过渡的方向和形状。
Gradient methods
MethodReturnsWhat it does
Delete()NothingDeletes the object.
Creating and applying a gradient
'Creates a new gradient in the current document with 2
'gradient stops, then applies the gradient to the front-
'most path item
Set appRef = CreateObject("Illustrator.Application")
Set frontDocument = appRef.ActiveDocument
'Create a color for both ends of the gradient
Set startColor = CreateObject("Illustrator.RGBColor")
Set endColor = CreateObject("Illustrator.RGBColor")
startColor.Red = 0
startColor.Green = 100
startColor.Blue = 255
endColor.Red = 220
endColor.Green = 0
endColor.Blue = 100
'Create a new gradient
'new gradients always have 2 stops
Set newGradient = frontDocument.Gradients.Add
newGradient.Name = "Gradient created from script"
newGradient.Type = 1   'aiLinearGradient
'Modify the first gradient stop.
Set locationSpecification = newGradient.GradientStops(1)
locationSpecification.RampPoint = 30
locationSpecification.MidPoint = 60
locationSpecification.Color = startColor
'Modify the last gradient stop.
'The MidPoint for the last gradient stop is ignored
Set locationSpecification = newGradient.GradientStops(2)
locationSpecification.RampPoint = 80
locationSpecification.Color = endColor
'construct an Illustrator.GradientColor object referring to the
'newly created gradient
Set ColorOfGradient = CreateObject("Illustrator.GradientColor")
ColorOfGradient.Gradient = newGradient
'now get the frontmost path item and
'apply the new gradient as its fill
Set topPath = frontDocument.PathItems(1)
topPath.Filled = True
topPath.fillColor = ColorOfGradient

page 74

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
PropertyValue typeWhat it is
AngleDoubleThe gradient vector angle in degrees.
渐变矢量的角度,以度为单位。这用于定义线性渐变的方向。
ApplicationApplicationRead-only. The Illustrator Application object.
只读。Illustrator 应用程序对象,提供了对整个 Illustrator 应用程序的访问和控制功能。
GradientGradientReference to the object defining the gradient.
引用定义渐变的对象。这个属性通常指向一个具体的渐变实例,该实例定义了颜色过渡的详细信息。
HiliteAngleDoubleThe gradient hilite vector angle in degrees.
高亮渐变矢量的角度,同样以度为单位。这用于定义在某些特定情况下(如选择状态)的渐变方向变化。
HiliteLengthDoubleThe gradient hilite vector length.
高亮渐变矢量的长度,决定渐变高亮部分的扩散范围。
LengthDoubleThe gradient vector length.
渐变矢量的长度,影响渐变在填充区域中的延伸程度。
MatrixMatrixAn additional transformation matrix to manipulate the gradient path.
额外的变换矩阵,用于操纵渐变路径。通过此矩阵可以进一步调整渐变的位置、旋转等特性。
OriginVariant Array of 2 DoublesThe gradient vector origin.
渐变矢量的起点,由包含两个双精度浮点数(X 和 Y 坐标)的数组表示。它定义了渐变开始应用的位置。
Changing a gradient color
'Creates a new RGB color then applies it as the color
'at the first gradient stop of the first gradient
Set appRef = CreateObject("Illustrator.Application")
Set frontDocument = appRef.Documents.Add(1) ' aiDocumentRGBColor
'Get a reference to the gradient that you want to change
Set firstGradient = frontDocument.Gradients(1)
'Create the new color
Set startColor = CreateObject("Illustrator.RGBColor")
startColor.Red = 0
startColor.Green = 255
startColor.Blue = 0
firstGradient.GradientStops(1).Color = startColor

CHAPTER 1: VBScript Object Reference

page 75

Gradients

A collection of Gradient objects in a document.

Gradients properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。Illustrator应用程序对象,提供了对整个Illustrator应用程序的访问和控制功能。
CountLongRead-only. The number of objects in the collection.
只读。集合中包含的对象数量,用于表示当前集合中有多少个元素或项目。
ParentDocumentRead-only. The parent document of this object.
只读。该对象所属的父文档对象,表明这个集合是属于哪个特定Illustrator文档的一部分。
Gradients methods
MethodReturnsWhat it does
Add()GradientCreates a new object
创建并添加一个新的渐变对象到集合中,并返回新创建的渐变对象。
Index(item as Gradient)LongReturns the index position of the object within the collection.
传入一个Gradient对象,返回该对象在集合中的索引位置(即它在集合中的顺序编号)。
Item(itemKey)GradientReturns an object reference to the object identified by itemKey (name or index).
根据传入的键(可以是名称或索引)返回集合中对应对象的引用。如果集合是一个渐变库,则可以通过名称或索引来获取指定的渐变对象。
RemoveAll()NothingDeletes all objects in this collection.
删除集合中所有的对象,清空整个集合。此操作不会返回任何值。
Removing a gradient

'Deletes the first gradient in the current document
Set appRef = CreateObject("Illustrator.Application")
Set frontDocument = appRef.ActiveDocument
'Get a reference to the gradient that you want to delete
Set gradientToDelete = frontDocument.Gradients(1)
'Now delete the gradient using the collection
frontDocument.Gradients.Remove gradientToDelete

page 76

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
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。Illustrator应用程序对象,提供了对整个Illustrator应用的访问和控制功能。
ColorColor infoThe color linked to this gradient stop.
与该渐变停止点关联的颜色。包含颜色的具体RGB、CMYK或其他色彩模式的数值信息。
MidpointDoubleThe distance between two GradientStops, in percentage. Range: 13.0 to 87.0
两个相邻GradientStops之间的距离百分比。范围:13.0到87.0,用于在渐变中定义中间颜色的位置。
OpacityDoubleThe opacity value for the gradient stop. Range: 0.0 to 100.0
渐变停止点的不透明度值。范围:0.0(完全透明)到100.0(完全不透明)。
ParentDocumentRead-only. The document that contains this gradient stop.
只读。包含此渐变停止点所在的文档对象,表明该渐变停止点是属于哪个特定Illustrator文档资源的一部分。
RampPointDoubleThe location of the color in the blend. Range: 0.0 to 100.0, where 100.0 is 100%
颜色在渐变中的位置。范围:0.0到100.0,其中100.0代表渐变路径长度的100%。这个值决定了渐变颜色变化的关键点。
GradientStop methods
MethodReturnsWhat it does
Delete()NothingDeletes the object.

CHAPTER 1: VBScript Object Reference

page 77

GradientStops

A collection of GradientStop objects in a specific gradient.

GradientStops properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
CountLongRead-only. The number of objects in the collection.
ParentDocumentRead-only. The document that contains this object.
GradientStops methods
MethodReturnsWhat it does
Add()GradientStopCreates a new object
Index(item as GradientStop)LongReturns the index position of the object within the collection.
Item(itemKey)GradientStopReturns an object reference to the object identified by itemKey (name or index).
RemoveAll()NothingDeletes all objects in this collection.
Adding a new gradient stop
'Adds a new gray gradient stop to an existing gradient
Set appRef = CreateObject("Illustrator.Application")
Set frontDocument = appRef.ActiveDocument
'Get a reference to the gradient that you want to change
Set changeGradient = frontDocument.Gradients(1)
'Get a reference to the gradient stop that is the last one
'before you add a new gradient stop
originalCount = changeGradient.GradientStops.Count
Set lastStop = changeGradient.GradientStops(originalCount)
'add the new gradient stop
Set newStop = changeGradient.GradientStops.Add
'Set the values of the new gradient stop. move the original
'last gradient stop a bit to the left, and
'insert the new gradient stop at the old gradient stop's position
newStop.RampPoint = lastStop.RampPoint
lastStop.RampPoint = lastStop.RampPoint - 10
'Create a new color to apply to the newly created gradient stop
'choose a Gray tint value of 70%
Set newStopColor = CreateObject("Illustrator.GrayColor")
newStopColor.Gray = 70
newStop.Color = newStopColor

page 79

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
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
NameStringThe GraphicStyle name.
ParentDocumentRead-only. The document that contains this object.
GraphicStyle methods
MethodReturnsWhat it does
ApplyTo(artItem as PageItem)NothingApplies the GraphicStyle to a specific art item.
将此GraphicStyle应用到指定的PageItem(页面项目),例如路径、组或文本对象,从而改变其外观样式。
MergeTo(artItem as PageItem)NothingMerges this style into the current styles of a specified art item.
将此GraphicStyle合并至指定的PageItem当前已有的样式中,即将此样式属性叠加到目标对象现有的样式上,而不是完全替代原有样式。
Delete()NothingDeletes the object.
删除这个GraphicStyle对象,从文档中移除该样式,并且所有关联此样式的艺术项目将不再应用该样式。
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.

'Creates a new group item, adds a duplicate of each
'selected item to the group then applies a graphic style
'to the group
Set appRef = CreateObject("Illustrator.Application")
If appRef.Documents.Count > 0 Then
    If Not IsEmpty(appRef.Selection) Then
        mySelection = appRef.Selection
        endIndex = UBound(mySelection)
        startIndex = LBound(mySelection)
        Set newGroup = appRef.ActiveDocument.GroupItems.Add
        For i = startIndex To endIndex
            Set artItem = mySelection(i)
            Set dupItem = artItem.Duplicate(newGroup, aiPlaceAtEnd)
            appRef.ActiveDocument.GraphicStyles(2).ApplyTo dupItem
        Next
    End If
End If

CHAPTER 1: VBScript Object Reference

page 79

GraphicStyles

A collection of graphic styles in a document.

GraphicStyles properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
CountLongRead-only. The number of objects in the collection.
ParentDocumentRead-only. The document that contains this object.
GraphicStyles methods
MethodReturnsWhat it does
Index(item as GraphicStyle)LongReturns the index position of the object within the collection.
传入一个GraphicStyle对象,返回该对象在集合中的索引位置。此方法帮助你获取指定样式的在当前集合中的排列顺序编号。
Item(itemKey)GraphicStyleReturns an object reference to the object identified by itemKey (name or index).
根据传入的键(可以是名称或索引)返回集合中对应的GraphicStyle对象引用。这允许你通过样式名称或其在集合中的索引来访问和操作特定的图形样式对象。
RemoveAll()NothingDeletes all objects in this collection.
删除当前集合中的所有GraphicStyle对象,清空整个集合。调用此方法后,集合将不再包含任何元素。
Counting graphic styles
'Counts the number of graphic styles in the current document
'and stores in numStyles
Set appRef = CreateObject("Illustrator.Application")
If appRef.Documents.Count > 0 Then
    numStyles = appRef.ActiveDocument.GraphicStyles.Count
End If

page 81

GraphItem

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

GraphItem properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。Illustrator应用程序对象,提供了对整个Illustrator应用程序的访问和控制功能。
ArtworkKnockoutAiKnockoutStateIs this GraphItem used to create a knockout, and if so, what kind.
指示此GraphItem是否用于创建镂空效果及镂空的具体类型。
BlendingModeAiBlendModesThe mode used when compositing an object.
设置该对象在合成时所采用的混合模式(如叠加、正片叠底等)。
ContentVariableVariableThe 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.
与此GraphItem关联的内容变量。绑定前无需设置ContentVariable的类型,Illustrator会自动将其设置为AiGraph类型。
ControlBoundsVariant Array of 4 DoublesRead-only. The bounds of the object including stroke width and controls.
只读。包含描边宽度和控件在内的对象边界范围。
EditableBooleanRead-only. If true, the GraphItem is editable.
只读。如果为true,则表示此GraphItem可编辑。
GeometricBoundsVariant Array of 4 DoublesRead-only. The bounds of the GraphItem excluding stroke width.
只读。不包括描边宽度的GraphItem边界范围。
HeightDoubleThe height of the GraphItem, calculated on the GeometricBounds.
基于GeometricBounds计算出的GraphItem高度。
HiddenBooleanIf true, this GraphItem is hidden.
如果为true,则表示此GraphItem被隐藏。
IsIsolatedBooleanIf true, this GraphItem is isolated.
如果为true,则表示此GraphItem处于隔离状态。
LayerLayerRead-only. The Layer to which this GraphItem belongs.
只读。此GraphItem所属的图层。
LeftDoubleThe position of the left side of the GraphItem (in points, measured from the left side of the page).
GraphItem左侧边缘的位置(以点为单位,从页面左边缘开始测量)。
LockedBooleanIf true, this GraphItem is locked.
如果为true,则表示此GraphItem已被锁定,不可编辑。
NameStringThe name of this GraphItem.
此GraphItem的名称。
NoteStringThe note assigned to this GraphItem.
分配给此GraphItem的注释信息。
OpacityDoubleThe opacity of the GraphItem. Range: 0.0 to 100.0
GraphItem的不透明度,范围:0.0到100.0。
ParentLayer or GridRepeatConfigRead-only. The parent of this GraphItem.
只读。此GraphItem的父级对象,可能是图层或某种网格重复配置。
PositionVariant Array of 2 DoublesThe position (in points) of the top left corner of the item in the format [x, y]. Does not include stroke weight.
项目左上角位置的坐标数组(格式为[x, y]),以点为单位,不包含描边宽度。
SelectedBooleanIf true, this GraphItem is selected.
如果为true,则表示此GraphItem当前被选中。
SlicedBooleanIf true, this GraphItem is sliced. Default: false
如果为true,表示此GraphItem被切片处理。默认值:false
TagsTagsRead-only. The collection of Tags contained in this GraphItem.
只读。此GraphItem包含的标签集合,用于组织和标记图形元素。
TopDoubleThe position of the top of the item (in points, measured from the bottom of the page).
项目顶部的位置(以点为单位,从页面底部开始测量)。
URLStringThe value of the Adobe URL tag assigned to this GraphItem.
分配给此GraphItem的Adobe URL标签的值,可用于超链接功能。
VisibilityVariableVariableThe 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.
与此GraphItem关联的可见性变量。绑定前无需设置VisibilityVariable的类型,Illustrator会自动将其设置为AiVisibility类型。
VisibleBoundsVariant Array of 4 DoublesRead-only. The visible bounds of the GraphItem including stroke width.
只读。包括描边宽度在内的GraphItem可见边界范围。
WidthDoubleThe width of the GraphItem, based on the GeometricBounds.
基于GeometricBounds计算出的GraphItem宽度。
WrapInsideBooleanIf true, the text frame object is wrapped inside this object.
如果为true,表示文本框对象将被包裹在这个对象内部。
WrapOffsetDoubleThe offset to use when wrapping text around this object.
当文本环绕此对象时使用的偏移量,控制文本与该对象的距离。
WrappedBooleanIf true, wrap text frame objects around this object (text frame must be above the object).
如果为true,则允许文本框对象围绕此对象进行环绕排版(要求文本框在该对象之上)。
ZOrderPositionLongRead-only. The position of this GraphItem within the stacking order of the GroupItem or Layer (Parent) that contains the GraphItem.
只读。表示此GraphItem在其所在GroupItem或Layer(父级)中的堆叠顺序位置,即层叠顺序中的索引。
GraphItem methods
MethodReturnsWhat it does
Copy()NothingCopies the GraphItem to the clipboard; the associated document must be the frontmost document.
复制GraphItem到剪贴板,操作时关联的文档必须是前台最活跃的文档。
Cut()NothingCuts the GraphItem to the clipboard;the associated document must be the frontmost document.
剪切GraphItem到剪贴板,同样要求关联文档为当前最前面的文档。
Delete()NothingDeletes the object.
删除此对象。
Duplicate([relativeObject as Object],[insertionLocation as AiElementPlacement])ObjectDuplicates the art item, optionally specifying the location and position for the copy.
复制图形元素,并可选择指定复制后的插入位置和对齐方式。
Move(relativeObject as Object,insertionLocation as AiElementPlacement)NothingMoves the art item, specifying the new location and position.
移动图形元素,指定新的位置和对齐方式。
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])NothingScales the GraphItem where scaleX is the horizontal scaling factor and scaleY is the vertical scaling factor. 100.0 = 100%
按给定的水平缩放因子scaleX和垂直缩放因子scaleY缩放图形元素。100.0表示100%不缩放,可以同时选择是否改变位置、填充图案、填充渐变、描边图案及线宽等属性,并可指定缩放中心点。
Rotate(angle as Double,[, changePositions as Boolean][, changeFillPatterns as Boolean][, changeFillGradients as Boolean][, changeStrokePattern as Boolean][, rotateAbout as AiTransformation])NothingRotates the GraphItem relative to the current rotation; counter-clockwise if the Angle value is positive, clockwise if the value is negative.
围绕当前旋转角度以顺时针或逆时针对图形元素进行旋转。如果角度值为正,则逆时针旋转;如果为负,则顺时针旋转。可以设置是否更改位置、填充图案、填充渐变、描边图案等相关属性,并指定旋转中心点。
Transform(transformationMatrix as Matrix,[, changePositions as Boolean][, changeFillPatterns as Boolean][, changeFillGradients as Boolean][, changeStrokePattern as Boolean][, changeLineWidths as Double][, transformAbout as AiTransformation])NothingTransforms the GraphItem by applying a transformation matrix.
通过应用一个转换矩阵来变换图形元素。可以控制是否改变位置、填充图案、填充渐变、描边图案及线宽等属性,并指定转换中心点。
Translate([deltaX as Double][, deltaY as Double][, transformObjects as Boolean][, transformFillPatterns as Boolean][, transformFillGradients as Boolean][, transformStrokePatterns as Boolean])NothingRepositions the GraphItem relative to the current position, where deltaX is the horizontal offset and deltaY is the vertical offset.
相对当前位置重新定位图形元素,其中deltaX为水平偏移量,deltaY为垂直偏移量。可以选择是否变换与该元素相关的其他属性。
ZOrder(zOrderCmd as AiZOrderMethod)NothingArranges the GraphItem’s position in the stacking order of the group or layer (Parent) of this object.
调整图形元素在组或图层中的堆叠顺序,即其在父级容器内的前后层次关系。
Rotating graph items
'Rotates each graph item in the current document 90 degrees.
Set appRef = CreateObject("Illustrator.Application")
'Rotate each graph item 90 degrees
For Each graphRef In appRef.ActiveDocument.GraphItems
    graphRef.Rotate 90
Next
appRef.Redraw

page 85

GraphItems

A collection of GraphItem objects.

GraphItems properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
CountLongRead-only. The number of objects in the collection.
ParentDocumentRead-only. The document that contains this object.
GraphItems methods
MethodReturnsWhat it does
Index(item as GraphItem)LongReturns the index position of the object within the collection.
Item(itemKey)GraphItemReturns an object reference to the object identified by itemKey (name or index).
RemoveAll()NothingDeletes all objects in this collection.

page 86

GrayColor

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

GrayColor properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。Illustrator应用程序对象,提供了对整个Adobe Illustrator应用程序的访问和控制功能。
GrayDoubleThe tint of the gray. Range: 0.0 to 100.0, where 0.0 is black and 100.0 is white.
灰色的深浅度(色调)。范围:0.0至100.0,其中0.0表示黑色,100.0表示白色。该属性通常用于定义或获取一个单色灰度值的颜色信息。
Changing word color to gray
'Sets the fill color of the first word in the document to gray
Set appRef = CreateObject("Illustrator.Application")
Set textColor = CreateObject("Illustrator.GrayColor")
'Get a reference to the first word in the active document
Set text = appRef.ActiveDocument.TextFrames(1).TextRange
Set firstWord = text.Words(1)
'Create the new color
textColor.Gray = 45
firstWord.CharacterAttributes.fillColor = textColor

page 87

GridRepeatConfig

Specifies grid repeat art configuration options.
指定网格重复艺术的配置选项。

GridRepeat properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。表示Illustrator应用程序自身的对象,提供了对整个应用程序的访问和控制能力。
columnFlipTypeAiRepeatGridShiftFlipTypeColumn flip type of grid repeat art. Default value: NoSF
网格重复艺术中的列翻转类型。默认值:NoSF(不进行水平翻转)。
horizontalSpacingdoubleSpacing between each rows. Default value: 10
行与行之间的间距。默认值为10个单位。
patternTypeAiRepeatGridShiftFlipTypeShifts type of grid repeat art. Default value: NoSF
网格重复艺术的平移类型。默认值:NoSF(不进行平移)。
rowFlipTypeAiRepeatGridShiftFlipTypeRow flip type of grid repeat art. Default value: NoSF
网格重复艺术中的行翻转类型。默认值:NoSF(不进行垂直翻转)。
verticalSpacingdoubleSpacing between each columns. Default value: 10
列与列之间的间距。默认值为10个单位。

page 88

GridRepeatItem

Specifies grid repeat item options.

GridRepeatItem properties
PropertyValue typeWhat it is
parentobjectRead-only. The object’s container.
只读。表示该对象所在的容器,即父级对象,它可以是更高层级的复合图形、图层或者其他可以包含路径项的容器结构。
GridConfigGridRepeatConfigRead-only. Grid repeat configuration for repeat art.
只读。网格重复配置信息,针对重复艺术(Pattern或Repeat Grid)设置的具体参数,如平移、翻转等行为方式以及间距等布局属性。
URLStringThe value of the Adobe URL tag assigned to this path item.
分配给此路径项(可能是图形、图像或其他元素)的Adobe URL标签值,通常用于链接到外部资源或者嵌入元数据信息。
WidthDoubleThe width of the grid repeat item, based on the GeometricBounds.
基于几何边界(GeometricBounds)计算出的网格重复项目宽度,这是指单个重复单元格在横向上的尺寸大小。
GridRepeatItem methods
MethodReturnsWhat it does
duplicate([relativeObject as object][,insertionLocation as Object])GridRepeatItemCreates a duplicate of the selected object.
创建选定对象的副本。此方法会复制指定的网格重复项目,并可选择性地将其插入到相对对象或指定的位置中,然后返回新创建的网格重复项目实例。
move(relativeObject as Object,insertionLocation as AiElementPlacement)GridRepeatItemMoves the object.
移动对象。此方法将当前的网格重复项目移动到相对于另一个对象的位置上,具体位置由AiElementPlacement参数决定。执行后返回被移动的网格重复项目实例本身。
setGridConfiguration(config as GridRepeatConfig, state as AiGridRepeatUpdate)StringUpdates the grid repeat art.
更新网格重复艺术配置。该方法用于设置或修改当前网格重复项目的配置信息(如翻转、平移等行为),使用给定的GridRepeatConfig对象作为新的配置数据,并根据AiGridRepeatUpdate状态来控制如何应用这些更改。方法执行成功后通常会返回一个表示操作结果的字符串信息。

page 89

GridRepeatItems

Specifies a collection of grid repeat items.

GridRepeatItems properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
parentobjectRead-only. The object’s container.
countlongRead-only. The number of elements in the collection.
GridRepeatItems methods
MethodReturnsWhat it does
Add(SourceArt as Object,[Config as GridRepeatConfig])GridRepeatItemCreates a grid repeat art
创建网格重复艺术。此方法从给定的源对象(SourceArt)创建一个新的网格重复项目,并可选地应用一个自定义的网格配置(GridRepeatConfig)。成功创建后,该方法会返回新生成的网格重复项目实例(GridRepeatItem)。
RemoveAll()NothingDeletes all elements.
删除所有元素。此方法用于清空或删除当前容器中的所有网格重复项目或其他相关元素。执行此操作后,不会返回任何值(即返回值类型为无:Nothing)。

page 90

AiGridRepeatUpdate

Represents which property of grid repeat gets updated.

GridRepeatUpdate properties
PropertyValue typeWhat it is
AiGridAllconstantUpdates all the properties of grid repeat art.
用于更新网格重复艺术的所有属性。调用此属性可能触发对整个网格布局及其所有相关属性的全局重新计算和同步。
AiHorizontalSpacingconstantUpdates spacing between rows of grid repeat artwork.
用于更新网格重复艺术品中行与行之间的间距。设置此属性会更改网格布局中同一行内相邻元素之间的水平间距。
AiVerticalSpacingconstantUpdates spacing between columns of grid repeat artwork.
更新网格重复艺术品中列与列之间的间距。设置此属性会更改网格布局内不同列之间相邻元素的垂直间距大小。

page 91

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
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。指向Illustrator应用程序本身的对象,用于访问和控制整个应用程序的功能。
ArtworkKnockoutAiKnockoutStateIs this object used to create a knockout, and if so, what kind.
该对象是否被用于创建镂空效果,如果是的话,属于哪种类型的镂空。
BlendingModeAiBlendModesThe mode used when compositing an object.
在组合对象时所采用的混合模式。
ClippedBooleanIf true, the GroupItem is clipped to the clipping mask.
如果为真,则表示此GroupItem(组项目)受到剪切蒙版的剪裁。
CompoundPathItemsCompoundPathItemsRead-only. The CompoundPathItems contained in this GroupItem.
只读。该GroupItem中包含的所有复合路径项目的集合。
ControlBoundsVariant Array of 4 DoublesRead-only. The bounds of the object including stroke width and controls.
只读。包括描边宽度和控件在内的对象边界范围。
EditableBooleanRead-only. If true, this GroupItem is editable.
只读。如果为真,则表示这个GroupItem可以被编辑。
GeometricBoundsVariant Array of 4 DoublesRead-only. The bounds of the object excluding stroke width.
只读。不包括描边宽度的对象边界范围。
GraphItemsGraphItemsRead-only. The raster items contained in this GroupItem.
只读。该GroupItem中包含的所有栅格图像项目的集合。
GroupItemsGroupItemsRead-only. The GroupItems contained in this GroupItem.
只读。该GroupItem中嵌套的其他组项目的集合。
HeightDoubleThe height of the GroupItem, based on the GeometricBounds.
基于GeometricBounds计算出的GroupItem的高度。
HiddenBooleanIf true, this GroupItem is hidden.
如果为真,则表示此GroupItem被隐藏。
IsIsolatedBooleanIf true, this object is isolated.
如果为真,则表示此对象已被隔离。
LayerLayerRead-only. The layer to which this GroupItem belongs.
只读。此GroupItem所属的图层对象。
LeftDoubleThe position of the left side of the GroupItem (in points, measured from the left side of the page).
GroupItem左边缘的位置(以点为单位,从页面左侧开始测量)。
LegacyTextItemsLegacyTextItemsRead-only. The legacy text items in the group.
只读。该组中的遗留文本项目。
LockedBooleanIf true, this GroupItem is locked.
如果为真,则表示此GroupItem已被锁定,无法进行编辑操作。
MeshItemsMeshItemsRead-only. The MeshItems contained in this GroupItem.
只读。该GroupItem中包含的所有网格项目的集合。
NameStringThe name of this GroupItem.
此GroupItem的名称。
NonNativeItemsNonNativeItemsRead-only. The non-native art items in this group.
只读。此组中包含的非原生艺术项目(如导入的SVG或PDF内容)。
NoteStringThe note assigned to this GroupItem.
分配给此GroupItem的注释。
OpacityDoubleThe opacity of the object. Range: 0.0 to 100.0
对象的不透明度。范围:0.0到100.0,表示从完全透明到完全不透明。
PageItemsPageItemsRead-only. The PageItems contained in this GroupItem.
只读。此GroupItem中包含的所有页面项目的集合。
ParentDocumentRead-only. The document that contains this GroupItem.
只读。包含此GroupItem的父级文档对象。
PathItemsPathItemsRead-only. The PathItems contained in this GroupItem.
只读。此GroupItem中包含的所有路径项目的集合。
PlacedItemsPlacedItemsRead-only. The PlacedItems contained in this GroupItem.
只读。此GroupItem中包含的所有置入(如图片)项目的集合。
PluginItemsPluginItemsRead-only. The PluginItems contained in this GroupItem.
只读。此GroupItem中包含的由插件生成的项目的集合。
PositionVariant Array of 2 DoublesThe position (in points) of the top left corner of the item in the format [x, y]. Does not include stroke weight.
对象左上角的位置(以点为单位),格式为[x, y]。不包括描边宽度。
RasterItemsRasterItemsRead-only. The RasterItems contained in this GroupItem.
只读。此GroupItem中包含的所有栅格图像项目的集合。
SelectedBooleanIf true, this GroupItem is selected.
如果为真,则表示此GroupItem被选中。
SlicedBooleanIf true, this GroupItem is sliced. Default: false
如果为真,则表示此GroupItem已被切片处理。默认值为false。
SymbolItemsSymbolItemsRead-only. The SymbolItems contained in this GroupItem.
只读。此GroupItem中包含的所有符号项目的集合。
TagsTagsRead-only. The tags contained in this GroupItem.
只读。此GroupItem中包含的所有标签。
TextFramesTextFramesRead-only. The TextFrame objects contained in this GroupItem.
只读。此GroupItem中包含的所有文本框对象的集合。
TopDoubleThe position of the top of the item (in points, measured from the bottom of the page).
该对象顶部的位置(以点为单位,从页面底部开始测量)。
URLStringThe value of the Adobe URL tag assigned to this GroupItem.
分配给此GroupItem的Adobe URL标签的值。
VisibilityVariableVariableThe Variable bound to this GroupItem.
与此GroupItem关联的变量。
VisibleBoundsVariant Array of 4 DoublesRead-only. The visible bounds of the GroupItem including stroke width.
只读。包括描边宽度在内的可见边界范围。
WidthDoubleThe width of the GroupItem, based on the GeometricBounds.
基于GeometricBounds计算出的GroupItem的宽度。
WrapInsideBooleanIf true, the text frame object are wrapped inside this object.
如果为真,表示文本框对象会被包裹在这个对象内部。
WrapOffsetDoubleThe offset to use when wrapping text around this object.
当环绕此对象排列文本时使用的偏移量。
WrappedBooleanIf true, wrap text frame objects around this object (text frame must be above the object).
如果为真,表示文本框对象会围绕此对象排列(前提是文本框位于该对象上方)。
ZOrderPositionLongRead-only. The position of this group item within the stacking order of the group or layer (Parent) that contains this group item.
只读。此GroupItem在其所在群组或层(父级)中的堆叠顺序位置。
GroupItem methods
MethodReturnsWhat it does
Copy()NothingCopies the GroupItem to the clipboard; the associated document must be the frontmost document.
复制GroupItem到剪贴板,要求关联的文档是当前最前端文档。
Cut()NothingCuts the GroupItem to the clipboard; the associated document must be the frontmost document.
剪切GroupItem到剪贴板,同样要求关联的文档位于前台。
Delete()NothingDeletes the object.
删除该对象。
Duplicate([relativeObject as Object],[insertionLocation as AiElementPlacement])ObjectDuplicates the art item, optionally specifying the location and position for the copy.
复制艺术项目,可选地指定副本的位置和排列方式。
Move(relativeObject as Object,insertionLocation as AiElementPlacement)NothingMoves the art item, specifying the new location and position.
移动艺术项目到新的位置。
Paste()NothingInserts 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.
在GroupItem开始处插入剪贴板的内容。只能粘贴到活动文档中包含的群组内。
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])NothingScales the art item where scaleX is the horizontal scaling factor and scaleY is the vertical scaling factor; 100.0 = 100%
按指定的水平和垂直缩放因子缩放艺术项目;100.0表示100%比例不变。
Rotate(angle as Double,[, changePositions as Boolean][, changeFillPatterns as Boolean][, changeFillGradients as Boolean][, changeStrokePattern as Boolean][, rotateAbout as AiTransformation])NothingRotates 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.
以当前旋转为基础,根据给定的角度(正值为逆时针,负值为顺时针)旋转艺术项目。
Transform(transformationMatrix as Matrix[, changePositions as Boolean][, changeFillPatterns as Boolean][, changeFillGradients as Boolean][, changeStrokePattern as Boolean][, changeLineWidths as Double][, transformAbout as AiTransformation])NothingTransforms the art item by applying a transformation matrix.
应用一个变换矩阵来转换艺术项目。
Translate([deltaX as Double][, deltaY as Double][, transformObjects as Boolean][, transformFillPatterns as Boolean][, transformFillGradients as Boolean][, transformStrokePatterns as Boolean])NothingRepositions the art item relative to the current position, where deltaX is the horizontal offset and deltaY is the vertical offset.
根据给定的水平和垂直偏移量相对于当前位置重新定位艺术项目。
ZOrder(zOrderCmd as AiZOrderMethod)NothingArranges the art item’s position in the stacking order of the group or layer (Parent) of this object.
调整艺术项目在所属群组或图层(父级)中的堆叠顺序。
Creating a group

It is easy to modify all of the objects contained in a group. This example demonstrates how to simplify your operations on multiple objects by creating a group to contain them.

'Creates a new group in the current document, containing
'a path item, and a text item
Set appRef = CreateObject("Illustrator.Application")
'Create a new group in the active document.
'This will be the group that holds the new triangle art
Set triangleGroup = appRef.ActiveDocument.GroupItems.Add
'Create a triangle and add text inside the group
Set trianglePath = triangleGroup.PathItems.Add
trianglePath.SetEntirePath Array(Array(100, 100), Array(300, 100), Array(200,
Tan(1.0471975) * 100 + 100))
Set captionText = triangleGroup.TextFrames.Add
captionText.Position = Array(100, 100)
captionText.Contents = "A triangle"

page 95

GroupItems

A collection of GroupItem objects.

GroupItems properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。指向Illustrator应用程序本身的对象,提供了对整个应用程序功能的访问权限。
CountLongRead-only. The number of objects in the collection.
只读。表示集合中包含的对象数量。
ParentDocumentRead-only. The document that contains this object.
只读。包含当前对象的父级文档对象,即这个对象所在的文档。
GroupItems methods
MethodReturnsWhat it does
Add()GridRepeatConfigCreates a new object.
创建一个新的对象实例。
CreateFromFile(imagefile as String)GridRepeatConfigCreates a GroupItem from a vector graphics file.
从矢量图形文件创建一个GroupItem对象。
Index(item as GroupItem)LongReturns the index position of the object within the collection.
返回集合中指定的GroupItem对象在其所在位置的索引号。
Item(itemkey)GridRepeatConfigReturns an object reference to the object identified by itemkey (name or index).
通过itemkey(名称或索引)返回对集合中特定GridRepeatConfig对象的引用。
RemoveAll()NothingDeletes all objects in this collection.
删除此集合中的所有对象实例。
Importing a file using GroupItems

The following script shows how you can import a JPEG document using the CreateFromFile function. Before running this script you have to create a one-page PDF file and put it in the location.

C:\temp\AiExport.jpg.

'Adds a new group item to the document from a file (dest)
'dest contains the full path and file name of the file
Sub embedPDF (dest)
Set appRef = CreateObject("Illustrator.Application")
Set importedGroup = appRef.ActiveDocument.GroupItems.CreateFromFile (dest)
End Sub

page 96

IllustratorSaveOptions

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

IllustratorSaveOptions properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。指向Illustrator应用程序自身的对象,提供对整个应用程序的访问权限。
ArtboardRangestringIf SaveMultipleArtboards is true (which is valid only for Illustrator 13 or earlier), the document is considered for multi-asset extraction, which specifies an artboard range. An empty string extracts all artboards. Default: empty string
如果SaveMultipleArtboards为true(仅适用于Illustrator 13或更早版本),则该文档被视为多资产提取目标,并指定一个画板范围。空字符串表示提取所有画板。默认值:空字符串
CompatibilityAiCompatibilityVersion of the Illustrator file format to create. Default: 24’ aiIllustrator24
指定要创建的Illustrator文件格式版本。默认值:24’ aiIllustrator24
CompressedBoolean(Illustrator version 10 or later) If true, the saved file is compressed. Default: true
(Illustrator版本10或更高)如果为true,则保存的文件将被压缩。默认值:true
EmbedICCProfileBooleanIf true, an ICC profile is embedded in the saved file.
如果为true,则在保存的文件中嵌入ICC色彩配置文件。
EmbedLinkedFilesBooleanIf true, linked image files are included in the saved document (only valid for SaveOptions that specify an Illustrator compatibility of version 7 or later).
如果为true,则链接的图像文件将包含在保存的文档中(仅适用于指定Illustrator兼容性版本7或更高版本的SaveOptions)。
FlattenOutputAiOutputFlatteningSpecifies how transparency is flattened for file formats older than Illustrator 9.
为比Illustrator 9版本更旧的文件格式指定如何展平透明度。
FontSubsetThresholdDoubleInclude a subset of fonts when less than this percentage of characters is used in the document (valid for Illustrator 9 or newer file format).
当文档中使用字符的比例低于此百分比时,将包含字体子集(适用于Illustrator 9或更新版本的文件格式)。
PDFCompatibleBooleanIf true, save as a PDF compatible file (version 10 or later). Default: true
如果为true,则以PDF兼容文件格式保存(适用于版本10或更高)。默认值:true
SaveMultipleArtboardsbooleanIf true, all artboards or range of the artboards are saved. Valid for Illustrator 13 or earlier.
如果为true,则保存所有画板或指定范围内的一系列画板。有效于Illustrator 13及更早版本。
Saving to Illustrator 8 format

This example illustrates how to save the frontmost document as Illustrator 8 format. Because the document is saved as a version earlier than 9, the example specifies how to convert opacity by breaking paths up into sub-paths to preserve the appearance of the illustration.

'Saves current document in Illustrator format to dest with certain options
'specified in the script, dest contains the full path and file name to save to
Sub exportfileToAi (dest)
Set appRef = CreateObject("Illustrator.Application")
Set saveOptions = CreateObject("Illustrator.IllustratorSaveOptions")
saveOptions.Compatibility = 8'aiIllustrator8
saveOptions.FlattenOutput = 1'aiPreserveAppearance
appRef.Documents(1).SaveAs dest, saveOptions
End Sub

page 98

ImageCaptureOptions

Options for image capture, used with the ImageCapture method. All properties are optional.
这些属性是在使用Illustrator等图形编辑软件中的ImageCapture方法时,可选的图像捕获选项。在调用该方法以导出或抓取画板内容为图像文件时,可以根据需要设置以下参数:

ImageCaptureOptions properties
PropertyValue typeWhat it is
AntiAliasingBooleanIf true, the image result is anti-aliased. Default: false
如果为true,则生成的图像结果进行抗锯齿处理。默认值:false
ApplicationApplicationRead-only. The Illustrator Application object.
只读。指向Illustrator应用程序自身的对象,提供对整个应用程序的访问权限。
MatteBooleanIf true, the artboard is matted with a color. Default: false
如果为true,则使用颜色为画板添加边框或衬底(即马特效果)。默认值:false
MatteColorRGBColorThe color to use for the artboard matte. Default: white
用于画板马特效果的颜色,默认情况下是白色。
ResolutionDoubleThe resolution of the captured image file in points-per-inch (PPI), in the range 72.0 to 2400.0. Default: 150
捕获图像文件的分辨率,单位为每英寸点数(PPI),范围在72.0到2400.0之间。默认值:150
TransparencyBooleanIf true, the image result is transparent. Default: false
如果为true,则生成的图像结果包含透明度信息。默认值:false

CHAPTER 1: VBScript Object Reference

page 99

Ink

Provides information about the ink name and related information.
提供有关油墨名称及其相关信息的信息。

Ink properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。指向Adobe Illustrator应用程序自身的对象,提供对整个应用程序功能的访问权限。
InkInfoInkInfoThe ink information.
包含有关特定墨水详细信息的对象,包括但不限于其化学成分、颜色特性以及在印刷流程中的使用方式等。
NameStringThe ink’s name.
墨水的名称,通常是一个标识符或标签,用于区别不同的墨水种类,如Pantone色号、CMYK四色组合或特殊效果墨水的名称。

page 100

InkInfo

Specifies ink properties.

InkInfo properties
PropertyValue typeWhat it is
AngleDoubleThe ink’s screen angle in degrees. Range: -360 to 360
油墨的网点角度,单位为度。范围:-360至360
ApplicationApplicationRead-only. The Illustrator Application object.
只读。指向Illustrator应用程序本身的对象,提供对整个应用程序功能的访问权限。
CustomColorObjectThe color of the custom ink.
表示自定义油墨的颜色信息。
DensityDoubleThe neutral density. Minimum: 0.0
中性灰密度,最小值为0.0。
DotShapeStringThe dot shape name.
网点形状的名称。
FrequencyDoubleThe ink’s frequency. Range: 0.0 to 1000.0
油墨的网点频率,范围:0.0至1000.0。
KindAiInkTypeThe ink type.
油墨的类型,例如CMYK、专色或其他类型。
PrintingStatusAiInkPrintStatusThe ink printing status.
油墨的打印状态,如已启用、禁用等。
TrappingAiTrappingTypeThe trapping type.
该油墨所采用的陷印类型,用于解决印刷过程中不同颜色油墨交接处可能出现的问题。
TrappingOrderLongThe order of trapping for the ink. Range: 1 to 4 for CMYK
当应用于CMYK油墨时,该油墨在陷印处理中的顺序,范围是从1到4分别对应C、M、Y、K四色。
List inks in a document
'Gets the details of each ink in this document
'and displays them in a text frame
Set appRef = CreateObject("Illustrator.Application")
'create a new document and simple text frame
Set docRef = appRef.Documents.Add()
Set textRef = docRef.TextFrames.Add()
textRef.Top = docRef.Height - 100
textRef.Left = 100
'collect data from each Ink and InkInfo object
For Each inkRef In appRef.ActiveDocument.InkList
    sInks = sInks & inkRef.Name
    sInks = sInks & vbCrLf & vbTab
    sInks = sInks & "Frequency = " & inkRef.InkInfo.Frequency
    sInks = sInks & vbCrLf & vbTab
    sInks = sInks & "Density = " & inkRef.InkInfo.Density
    sInks = sInks & vbCrLf
Next
textRef.Contents = sInks
appRef.Redraw

page 102

InsertionPoint

A location between characters, used to insert new text objects. An insertion point is contained in an InsertionPoints collection.
插入点位于两个字符之间,可用于添加新的文本元素。这样的插入点被包含在一个InsertionPoints集合内。

InsertionPoint properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。指向Adobe Illustrator应用程序本身的对象,允许访问和控制整个应用程序的功能。
CharactersCharactersRead-only. All of the characters in the text range.
只读。该文本范围内的所有单个字符的集合。
LinesLinesRead-only. All the lines in this text range.
只读。该文本范围内包含的所有文本行的集合。
ParagraphsParagraphsRead-only. All of the paragraphs in this text range.
只读。该文本范围内所有段落的集合。
ParentObjectRead-only. The object’s container.
只读。此对象所处的容器对象。
StoryStoryRead-only. The story of the text range.
只读。与该文本范围相关的文本故事(文本框或文章)。
TextRangesTextRangesRead-only. All of the text in this text range.
只读。该文本范围内的所有文本子集的集合。可以通过创建新的文本范围来进一步细分文本内容。
WordsWordsRead-only. All of the words in this text range.
只读。该文本范围内所有单词的集合。

page 103

InsertionPoints

A collection of InsertionPoint objects.

InsertionPoints properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。指向Adobe Illustrator应用程序本身的对象,允许访问和控制整个应用程序的功能。
CountLongRead-only. Number of elements in the collection.
只读。集合中元素的数量。
ParentTextFrameRead-only. The object’s container.
只读。该对象所处的容器对象,即包含此对象的文本框。
InsertionPoints methods
MethodReturnsWhat it does
Index(itemPtr as TextRange)LongReturns the index position of the object within the collection.
通过给定的TextRange对象返回该对象在集合中的索引位置。
Item(itemKey)InsertionPointGets an element from the collection by itemKey (name or index).
根据itemKey(名称或索引)从集合中获取一个元素,这里返回的是InsertionPoint对象。
Using insertion point to add spaces
'Creates a new document, adds a text frame then
'uses insertion points to add a space between all characters
Set appRef = CreateObject("Illustrator.Application")
'create a new document and text frame
Set docRef = appRef.Documents.Add()
Set textRef = docRef.TextFrames.Add()
textRef.Contents = "Wouldn't you rather be scripting?"
textRef.Top = 400
textRef.Left = 100
textRef.TextRange.CharacterAttributes.Size = 20
appRef.Redraw
i = 2
Do While (i < textRef.InsertionPoints.Count)
    textRef.InsertionPoints(i).Characters.Add (" ")
    i = i + 2
Loop

page 104

LabColor

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

LabColor properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。指向Adobe Illustrator应用程序本身的对象,允许访问和控制整个应用程序的功能。
ADoubleThe a (red-green) color value. Range -128.0–128.0. Default: 0.0
代表颜色的a(红-绿)分量值。范围在-128.0至128.0之间,默认值为0.0。
BDoubleThe b (yellow-blue) color value. Range -128.0–128.0. Default: 0.0
代表颜色的b(黄-蓝)分量值。范围同样在-128.0至128.0之间,默认值为0.0。
LDoubleThe l (lightness) color value. Range -128.0–128.0. Default: 0.0
代表颜色的亮度(lightness)值。范围同样在-128.0至128.0之间,默认值为0.0。

page 105

Layer

A layer in an Illustrator document. Layers may contain nested layers, which are called sublayers in the user interface.
在Illustrator文档中,图层可以包含嵌套的图层,这些在用户界面中被称为子图层。

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对象包含了该图层中的所有页面项目作为元素。在编写脚本时,你可以通过Layer对象或Document对象来访问PageItems作为其元素。只有位于该图层内的页面项目才能通过Layer对象进行访问。若要查看不同图层中的页面项目,则需要通过Document对象来获取它们。

Layer properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。指向Adobe Illustrator应用程序自身的对象,用于访问和控制整个应用程序的功能。
ArtworkKnockoutAiKnockoutStateIs this Layer used to create a knockout, and if so, what kind.
指示该图层是否被用作镂空效果的一部分,如果是的话,是哪种类型的镂空效果。
BlendingModeAiBlendModesThe mode used when compositing an object.
在组合对象时所采用的混合模式。
ColorRGBColorThe Layer’s selection mark color.
该图层的选择标记颜色。
CompoundPathItemsCompoundPathItemsRead-only. The CompoundPathItems contained in this layer.
只读。该图层中包含的所有复合路径项目的集合。
DimPlacedImagesBooleanIf true, placed images are rendered as dimmed in this layer.
如果为真,则此图层中的置入图像将以淡化形式显示。
GraphItemsGraphItemsRead-only. The GraphItems collection contained in this layer.
只读。该图层中包含的所有图形项目的集合。
GroupItemsGroupItemsRead-only. The GroupItems contained in this layer.
只读。该图层中包含的所有组项目的集合。
HasSelectedArtworkBooleanIf true, an object in this Layer has been selected; setting this property to false deselects all objects in the layer.
如果为真,则表示此图层中有对象被选中;将此属性设置为false则会取消选中该图层内所有对象。
IsIsolatedBooleanIf true, this Layer is isolated.
如果为真,则表示此图层已被隔离。
LayersLayersRead-only. The Layers contained in this layer.
只读。该图层中嵌套的子图层集合。
LegacyTextItemsLegacyTextItemsRead-only. The legacy text items contained in this layer.
只读。该图层中包含的所有遗留文本项目的集合。
LockedBooleanIf true, this layer is editable.
如果为真,则表示此图层被锁定,不可编辑。
MeshItemsMeshItemsRead-only. The MeshItems contained in this layer.
只读。该图层中包含的所有网格项目的集合。
NameStringThe name of this layer.
该图层的名称。
NonNativeItemsNonNativeItemsThe non-native art items in this layer.
该图层中包含的所有非原生艺术项目的集合(如导入的SVG或PDF内容)。
OpacityDoubleThe opacity of the layer. Range: 0.0 to 100.0
图层的不透明度。范围:0.0到100.0,其中100.0代表完全不透明。
PageItemsPageItemsRead-only. The PageItems contained in this layer.
只读。该图层中包含的所有页面项目的集合。
ParentDocument or LayerRead-only. The document or Layer that contains this layer.
只读。包含此图层的父级文档或图层。
PathItemsPathItemsRead-only. The PathItems contained in this layer.
只读。该图层中包含的所有路径项目的集合。
PlacedItemsPlacedItemsRead-only. The PlacedItems contained in this layer.
只读。该图层中包含的所有置入(如图片)项目的集合。
PluginItemsPluginItemsRead-only. The PluginItems contained in this layer.
只读。该图层中包含的由插件生成的项目的集合。
PreviewBooleanIf true, this layer is displayed using preview mode.
如果为真,则表示此图层在预览模式下显示。
PrintableBooleanIf true, this layer is printed when printing the document.
如果为真,则表示打印文档时会打印出这个图层的内容。
RasterItemsRasterItemsRead-only. The RasterItems contained in this layer.
只读。该图层中包含的所有栅格图像项目的集合。
SlicedBooleanIf true, this layer is sliced.
如果为真,则表示此图层已被切片处理。
SymbolItemsSymbolItemsRead-only. The SymbolItems contained in this layer.
只读。该图层中包含的所有符号项目的集合。
TextFramesTextFramesRead-only. The TextFrames contained in this layer.
只读。该图层中包含的所有文本框对象的集合。
VisibleBooleanIf true, this layer is visible.
如果为真,则表示此图层可见;否则,将被隐藏。
ZOrderPositionLongRead-only. The position of this layer within the stacking order of Layers in the document
只读。表示此图层在文档内所有图层层叠顺序中的位置。
Layer methods
MethodReturnsWhat it does
Delete()NothingDeletes the object.
删除该图层对象。
Move(relativeObject as Object,insertionLocation as AiElementPlacement)NothingMoves the art item, specifying the new location and position.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.
移动设计元素,指定新的位置和排列方式。此操作不会改变对象在画板上的物理位置,但会改变Illustrator绘制对象的顺序以及对象的包含层次结构。根据指定的插入位置将对象放置到相应的容器中,并将其置于所有同类对象之后。
Paste()NothingPastes the contents of the clipboard into the Layer; if the associated document is the frontmost then all pasted objects remain selected after the paste.
将剪贴板内容粘贴到图层上;如果关联的文档处于最前端,则粘贴后所有新粘贴的对象仍保持选中状态。
ZOrder(zOrderCmd as AiZOrderMethod)NothingArranges the Layer’s position in the stacking order of Layers in this document
按照指定的方式调整该图层在当前文档内所有图层层叠顺序中的位置。其中zOrderCmd参数是AiZOrderMethod类型,可以用来指定将图层前置、后置、置顶或置底等操作。
Count layers in a document
'Counts the number of layers in the current document
'and stores in countOfLayers
Set appRef = CreateObject("Illustrator.Application")
'Get a reference to the layers, and obtain the total number
Set frontDocument = appRef.ActiveDocument
countOfLayers = frontDocument.Layers.Count

page 108

Layers

A collection of Layer objects.

Layers properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。表示当前层所属的Adobe Illustrator应用程序对象,可以访问和控制整个应用程序的功能。
CountLongRead-only. The number of objects in the collection.
只读。表示集合中包含的对象数量,即该层级下的子元素个数。
ParentObjectRead-only. The object that contains this Layer (can be another Layer).
只读。表示包含此图层的对象,可能是另一个图层或者是文档等容器对象,即父级层或顶层容器。
Layers methods
MethodReturnsWhat it does
Add()LayerCreates a new object.
创建并返回一个新的图层对象。调用此方法后,新创建的图层会添加到当前集合中。
Index(item as Layer)LongReturns the index position of the object within the collection.
返回指定图层在当前集合中的索引位置。给定一个图层作为参数,该方法将查找该图层在集合中的顺序位置,并以数字形式返回其索引值。
RemoveAll()NothingDeletes all objects in this collection.
删除当前集合内的所有图层对象,清空整个集合。调用此方法后,当前集合下所有的图层都将被移除。
Deleting layers
'Deletes all layers containing a specified string in their name
Set appRef = CreateObject("Illustrator.Application")
searchString = "Temp"
'Loop through all open documents
layersDeleted = 0
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
            layersDeleted = layersDeleted + 1
        End If
    Next
Next

page 109

LegacyTextItem

A text object created in Illustrator CS (version 10) or earlier, which is uneditable until converted. To convert legacy text, see ConvertToNative.
在Illustrator CS(版本10)或更早版本中创建的文本对象,在转换之前是不可编辑的。要转换旧版文本,请参考“ConvertToNative”方法。

You can view, move, and print legacy text, but you cannot edit it. Legacy text has an “x” through its bounding box when selected.
您可以查看、移动和打印旧版文本,但不能对其进行编辑。当旧版文本被选中时,其边框框内会有个“x”标识。

LegacyTextItem properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。表示该LegacyTextItem所属的Adobe Illustrator应用程序对象,提供了对整个Illustrator应用进行控制和访问的功能。
ArtworkKnockoutAiKnockoutStateIs this object used to create a knockout, and if so, what kind.
指示此对象是否用于创建镂空效果,如果是,则表明是何种类型的镂空效果。
BlendingModeAiBlendModesThe mode used when compositing an object.
在合成对象时所使用的混合模式,定义了对象与其他图层内容如何相互融合。
ControlBoundVariant Array of 4 DoublesRead-only. The bounds of the object including stroke width and controls.
只读。包括描边宽度和控制点在内的对象边界范围。
ConvertedBooleanRead-only. If true, the legacy text has been updated to a native text frame item.
只读。如果为true,则表示已将旧版文本更新为原生文本框项目。
EditableBooleanRead-only. If true, this item is editable.
只读。如果为true,则表示该文本项可以被编辑。
GeometricBoundsVariant Array of 4 DoublesRead-only. The bounds of the object excluding stroke width.
只读。不包括描边宽度的对象边界范围。
HeightDoubleThe height of the LegacyTextItem excluding stroke width, based on the GeometricBounds.
LegacyTextItem的高度,不包括描边宽度,基于GeometricBounds计算得出。
HiddenBooleanIf true, this object is hidden.
如果为true,则表示此对象处于隐藏状态。
IsIsolatedBooleanIf true, this object is isolated.
如果为true,则表示此对象被隔离显示。
LayerLayerRead-only. The layer to which this LegacyTextItem belongs.
只读。表示此LegacyTextItem所在的图层。
LeftDoubleThe position of the left side of the item (in points, measured from the left side of the page).
对象左边缘的位置(以点为单位,从页面左边开始测量)。
LockedBooleanIf true, this LegacyTextItem is locked.
如果为true,则表示此LegacyTextItem被锁定,不可编辑或移动。
NameStringThe name of this LegacyTextItem.
此LegacyTextItem的名称。
NoteStringThe note assigned to this LegacyTextItem.
分配给此LegacyTextItem的注释。
OpacityDoubleThe opacity of the object. Range: 0.0 to 100.0
对象的不透明度,范围在0.0到100.0之间,其中100代表完全不透明。
ParentObjectRead-only. The object that contains this LegacyTextItem.
只读。包含此LegacyTextItem的对象,可能是文档或其他容器对象。
PositionVariant Array of 2 DoublesThe position (in points) of the top left corner of the item in the format [x, y]. Does not include stroke weight.
对象左上角的位置,格式为[x, y],不包括描边宽度。单位为点。
SelectedBooleanIf true, this object is selected.
如果为true,则表示该对象已被选中。
SlicedBooleanIf true, this LegacyTextItem is sliced.
如果为true,则表示此LegacyTextItem被切片处理。
TagsTagsRead-only. The tags contained in this LegacyTextItem.
只读。存储在该LegacyTextItem中的所有标签信息。
TopDoubleThe top position of this LegacyTextItem.
此LegacyTextItem的顶部位置。
URLStringThe value of the Adobe URL tag assigned to this LegacyTextItem.
分配给此LegacyTextItem的Adobe URL标签值。
VisibilityVariableVariableThe Variable bound to this LegacyTextItem.
与此LegacyTextItem绑定的可见性变量。
VisibleBoundsVariant Array of 4 DoublesRead-only. The visible bounds of the LegacyTextItem including stroke width.
只读。包括描边宽度在内的LegacyTextItem可见边界范围。
WidthDoubleThe width of the LegacyTextItem excluding stroke width, based on the GeometricBounds.
LegacyTextItem的宽度,不包括描边宽度,基于GeometricBounds计算得出。
WrapInsideBooleanIf true, the text frame object are wrapped inside this object.
如果为true,则文本框对象将被环绕在这个LegacyTextItem内部。
WrapOffsetDoubleThe offset to use when wrapping text around this object.
当环绕此LegacyTextItem排列文本时使用的偏移量。
WrappedBooleanIf true, wrap text frame objects around this object (text frame must be above the object).
如果为true,则允许文本框对象围绕此LegacyTextItem进行环绕排版(前提是文本框位于该LegacyTextItem上方)。
ZOrderPositionLongRead-only. The position of this art item within the stacking order of the group or layer (Parent) that contains the art item.
只读。指示此艺术项目在其所在的组或图层(Parent)内堆叠顺序中的位置索引。
LegacyTextItem methods

Method

Returns

What it does

ConvertToNative

()

GridRepea tConfig

Converts the legacy text item to a text frame and deletes the

original legacy text.

Copy

()

Nothing

Copies the legacy text item to the clipboard; the associated document must be the

frontmost document.

Cut

()

Nothing

Cuts the legacy text item to the clipboard; the associated

document must be the

frontmost document.

Duplicate

([relativeObject as Object],

[insertionLocation as AiElementPlacement])

Object

Duplicates the art item,

optionally specifying the

location and position for the

copy.

CHAPTER 1: VBScript Object Reference LegacyTextItem 111

Method

Returns

What it does

Delete

()

Nothing

Deletes the object.

Move

(relativeObject as Object,

insertionLocation as AiElementPlacement)

Nothing

Moves the art item, specifying the new location and position.

Resize

(scaleX as Double,

scaleY as Double

[, changePositions as Boolean]

[, changeFillPatterns as Boolean]

[, changeFillGradients as Boolean] [, changeStrokePattern as Boolean] [, changeLineWidths as Double]

[, scaleAbout as AiTransformation])

Nothing

Scales the art item where

scaleX is the horizontal scaling factor and scaleY is the vertical scaling factor; 100.0 = 100%

Rotate

(angle as Double,

[, changePositions as Boolean]

[, changeFillPatterns as Boolean]

[, changeFillGradients as Boolean]

[, changeStrokePattern as Boolean]

[, rotateAbout as AiTransformation])

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.

Transform

(transformationMatrix as Matrix,

[, changePositions as Boolean]

[, changeFillPatterns as Boolean]

[, changeFillGradients as Boolean]

[, changeStrokePattern as Boolean]

[, changeLineWidths as Double]

[, transformAbout as AiTransformation])

Nothing

Transforms the art item by

applying a transformation

matrix.

Translate

([deltaX as Double]

[, deltaY as Double]

[, transformObjects as Boolean]

[, transformFillPatterns as Boolean]

[, transformFillGradients as Boolean]

[, transformStrokePatterns as Boolean])

Nothing

Repositions the art item relative to the current position, where deltaX is the horizontal offset and deltaY is the vertical offset.

ZOrder

(zOrderCmd as AiZOrderMethod)

Nothing

Arranges the art item’s position in the stacking order of the

group or layer (Parent) of this object.

CHAPTER 1: VBScript Object Reference

page 112

LegacyTextItems

A collection of LegacyText items.

LegacyTextItems properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
CountLongRead-only. Number of elements in the collection.
ParentObjectRead-only. The object’s container.
LegacyTextItems methods
MethodReturnsWhat it does
ConvertToNative()BooleanCreates text frames from all legacy text items; the original legacy text items are deleted.Returns true if successful.
Index(itemPtr as LegacyTextItem)LongReturns the index position of the object within the collection.
Item(itemKey)LegacyTextItemReturns an object reference to the object identified by itemKey (name or index).
RemoveAll()NothingDeletes all objects in this collection.

page 113

Lines

A collection of TextRange objects corresponding to a line of text.

Lines properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
CountLongRead-only. Number of elements in the collection.
ParentObjectRead-only. The object’s container.
Lines methods
MethodReturnsWhat it does
Index(itemPtr as TextRange)LongReturns the index position of the object within the collection.
Item(itemKey)TextRangeReturns an object reference to the object identified by itemKey (name or index).
RemoveAll()NothingDeletes all objects in this collection.
Counting lines
#Creates an area text item, adds some text, resizes
#the width of the path item containing the text item
#then counts the number of lines and stores in lineCount
#Create area text
textToPlace = "Scripting with Illustrator is fun and easy."
Set appRef = CreateObject("Illustrator.Application")
Set docRef = appRef.Documents.Add()
Set itemRef = docRef.PathItems.Rectangle(500, 200, 50, 300)
Set textRef = docRef.TextFrames.AreaText(itemRef)
textRef.Contents = textToPlace
appRef.Redraw
#Change the path's width and display line count
itemRef.Width = 300
lineCount = textRef.Lines.Count
appRef.Redraw

page 114

Matrix

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

Matrices are used in conjunction with the Transform method and as a property of a number of objects. You can generate an original matrix using the Application methods getIdentityMatrix,getTranslationMatrix, getScaleMatrix, or getRotationMatrix. 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.

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

Matrix properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。Illustrator应用程序对象,提供了对整个Illustrator应用的全局访问和控制功能。
MValueADoubleMatrix property a.
矩阵属性a。在图形变换矩阵中代表水平缩放和平移的元素,通常与X轴坐标相关的缩放有关。
MValueBDoubleMatrix property b.
矩阵属性b。在二维图形变换矩阵中,用于表示旋转和剪切效果,影响垂直方向上的水平位移或倾斜。
MValueCDoubleMatrix property c.
矩阵属性c。同样在二维图形变换矩阵中,表示旋转和剪切效果,影响水平方向上的垂直位移或倾斜。
MValueDDoubleMatrix property d.
矩阵属性d。矩阵中的垂直缩放和平移元素,通常与Y轴坐标相关的缩放有关。
MValueTXDoubleMatrix property tx.
矩阵属性tx。在变换矩阵中代表沿X轴的平移量。
MValueTYDoubleMatrix property ty.
矩阵属性ty。在变换矩阵中代表沿Y轴的平移量。
Applying transformations with a matrix
#Creates a new translation and rotation matrix then
#applies it to all items in the current document
Set appRef = CreateObject("Illustrator.Application")
#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
For Each artItem In appRef.ActiveDocument.PageItems
    artItem.Transform totalMatrix
Next

page 115

MeshItem

A gradient mesh art item. Mesh items cannot be created from a script, but can be copied and pasted.

MeshItem properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。Illustrator应用程序对象,提供了对整个Illustrator应用的访问和控制权限。
ArtworkKnockoutAiKnockoutStateIs this object used to create a knockout, and if so, what kind.
指示该对象是否用于创建镂空效果及其类型(例如,不透明度、剪切或普通镂空)。
BlendingModeAiBlendModesThe mode used when compositing an object.
定义此对象与其他对象合成时使用的混合模式(如正常、溶解、正片叠底等)。
ControlBoundsVariant Array of 4 DoublesRead-only. The bounds of the object including stroke width and controls.
只读。包括描边宽度和控制点在内的对象边界范围(左下角X、左下角Y、右上角X、右上角Y)。
EditableBooleanRead-only. If true, this MeshItem is editable.
只读。如果为真,则表示该网格项是可以编辑的。
GeometricBoundsVariant Array of 4 DoublesRead-only. The bounds of the object excluding stroke width.
只读。排除描边宽度后对象本身的几何边界范围(左下角X、左下角Y、右上角X、右上角Y)。
HeightDoubleThe height of the MeshItem, based on the GeometricBounds.
基于几何边界的网格项高度。
HiddenBooleanIf true, this MeshItem is hidden.
如果为真,则表示该网格项是隐藏的,不可见。
IsIsolatedBooleanIf true, this object is isolated.
如果为真,则表示此对象已被隔离,具有独立视图层。
LayerLayerRead-only. The Layer to which this MeshItem belongs.
只读。该网格项所属的图层。
LeftDoubleThe position of the left side of the item (in points, measured from the left side of the page).
项目左侧边缘的位置(以点为单位,从页面左边算起)。
LockedBooleanIf true, this MeshItem is locked.
如果为真,则表示该网格项被锁定,无法编辑。
NameStringThe name of this MeshItem.
网格项的名称。
NoteStringThe note assigned to this MeshItem.
分配给该网格项的注释文本。
OpacityDoubleThe opacity of the object. Range 0.0 to 100.0
对象的不透明度百分比,范围在0.0到100.0之间。
ParentobjectRead-only. The object that contains this MeshItem.
只读。包含此网格项的对象。
PositionVariant Array of 2 DoublesThe position (in points) of the top left corner of the item in the format [x, y]. Does not include stroke weight.
项目的左上角位置(以点为单位,格式为[x, y]),不包括描边宽度。
SelectedBooleanIf true, this MeshItem is selected.
如果为真,则表示该网格项当前处于选中状态。
SlicedBooleanIf true, this MeshItem is sliced.
如果为真,则表示该网格项已被切片处理,适用于输出至网页或其他交互媒体。
TagsTagsRead-only. The tags contained in this MeshItem.
只读。该网格项所包含的所有标签。
TopDoubleThe position of the top of the item (in points,measured from the bottom of the page).
项目顶部边缘的位置(以点为单位,从页面底部向上计算)。
URLStringThe value of the Adobe URL tag assigned to this MeshItem.
分配给此网格项的Adobe URL标签值。
VisibilityVariableVariantThe Variable bound to this MeshItem.
与此网格项绑定的变量,可能影响其可见性状态。
VisibleBoundsVariant Array of 4 DoublesRead-only. The visible bounds of the MeshItem including stroke width.
只读。包括描边宽度在内的网格项可见边界范围。
WidthDoubleThe width of the MeshItem, based on the GeometricBounds.
基于几何边界的网格项宽度。
WrapInsideBooleanIf true, the text frame object are wrapped inside this object.
如果为真,则表示文字框内的文本将被包裹在这个对象内部。
WrapOffsetDoubleThe offset to use when wrapping text around this object.
当环绕此对象排列文本框对象时使用的偏移量。
WrappedBooleanIf true, wrap text frame objects around this object (text frame must be above the object).
如果为真,则表明文本框对象会绕着这个对象进行环绕排版(前提是文本框位于该对象之上)。
ZOrderPositionLongRead-only. The position of this art item within the stacking order of the group or layer (Parent) that contains the art item.
只读。此艺术项在其所在组或图层中的堆叠顺序位置。
MeshItem methods
MethodReturnsWhat it does
Copy()NothingCopies the mesh item to the clipboard; the associated document must be the frontmost document.
复制网格项到剪贴板;关联文档必须是最前面的活动文档。
Cut()NothingCuts the mesh item to the clipboard; the associated document must be the frontmost document.
剪切网格项到剪贴板;关联文档必须是最前面的活动文档。
Delete()NothingDeletes the object.
删除该对象。
Duplicate([relativeObject as Object],[insertionLocation as AiElementPlacement])ObjectDuplicates the art item, optionally specifying the location and position for the copy.
复制艺术项,可选指定复制内容的位置和插入位置。
Move(relativeObject as Object,insertionLocation as AiElementPlacement)NothingMoves the art item, specifying the new location and position.
移动艺术项至新位置,并指定其在新位置中的插入方式。
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])NothingScales the art item where scaleX is the horizontal scaling factor and scaleY is the vertical scaling factor; 100.0 = 100%
缩放艺术项,其中scaleX为水平缩放因子,scaleY为垂直缩放因子,100.0表示100%。可以同时选择是否改变元素的位置、填充图案、填充渐变、描边图案以及线宽,并可指定缩放中心点。
Rotate(angle as Double,[, changePositions as Boolean][, changeFillPatterns as Boolean][, changeFillGradients as Boolean][, changeStrokePattern as Boolean][, rotateAbout as AiTransformation])NothingRotates 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.
根据当前旋转角度旋转艺术项。若角度值为正,则逆时针旋转;若为负,则顺时针旋转。可以选择是否更改元素位置、填充图案、填充渐变及描边图案,并可指定旋转中心点。
Transform(transformationMatrix as Matrix,[, changePositions as Boolean][, changeFillPatterns as Boolean][, changeFillGradients as Boolean][, changeStrokePattern as Boolean][, changeLineWidths as Double][, transformAbout as AiTransformation])NothingTransforms the art item by applying a transformation matrix.
通过应用一个变换矩阵来转换艺术项。
Translate([deltaX as Double][, deltaY as Double][, transformObjects as Boolean][, transformFillPatterns as Boolean][, transformFillGradients as Boolean][, transformStrokePatterns as Boolean])NothingRepositions the art item relative to the current position, where deltaX is the horizontal offset and deltaY is the vertical offset.
相对于当前位置重新定位艺术项,其中deltaX是水平偏移量,deltaY是垂直偏移量。可以选择是否同时转换元素、填充图案、填充渐变及描边图案。
ZOrder(zOrderCmd as AiZOrderMethod)NothingArranges the art item’s position in the stacking order of the group or layer (Parent) of this object.
调整艺术项在其所在组或图层中的堆叠顺序(层级)。
Locking mesh items
#Locks all mesh items in the current document
Set appRef = CreateObject("Illustrator.Application")
For Each meshItem In appRef.ActiveDocument.MeshItems
    meshItem.Locked = True
Next

page 118

MeshItems

A collection of gradient mesh art items.

MeshItems properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
CountLongRead-only. Number of elements in the collection.
ParentObjectRead-only. The object’s container.
MeshItems methods
MethodReturnsWhat it does
Index(itemPtr as MeshItem)LongReturns the index position of the object within the collection.
Item(itemKey)MeshItemReturns an object reference to the object identified by itemKey (name or index).
RemoveAll()NothingDeletes all objects in this collection.
Copying mesh items between documents

To run this script, have two open documents:

b One document should contain at least one MeshItem.

b The other document can be empty. Make the empty document the frontmost before running the script.

#Copies all mesh items from one document
#to another, with an offset position
Set appRef = CreateObject("Illustrator.Application")
Set sourceDocument = appRef.Documents(1)
Set targetDocument = appRef.Documents.Add
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
        Exit For
    End If
    Set newMeshItem = targetSelection(0)
    newMeshItem.Position = Array(100, 400 + locationOffset)
    locationOffset = locationOffset + 50
Next

page 120

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
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
Removing a fill color
#Creates 2 overlapping, filled path items, then
#sets the top item to "NoColor" to make the bottom item visible.
Set appRef = CreateObject("Illustrator.Application")
Set docRef = appRef.Documents.Add()
Set itemRef1 = docRef.PathItems.Rectangle(500, 200, 200, 100)
Set itemRef2 = docRef.PathItems.Rectangle(550, 150, 200, 200)
Set colorRef = CreateObject("Illustrator.RGBColor")
colorRef.Blue = 255
itemRef1.FillColor = colorRef
colorRef.Red = 255
colorRef.Blue = 0
itemRef2.FillColor = colorRef
appRef.Redraw
#Create a nocolor object and assign it to the top object
Set noColorRef = CreateObject("Illustrator.NoColor")
itemRef2.FillColor = noColorRef
appRef.Redraw

page 121

NonNativeItem

A non-native artwork item.

NonNativeItem properties

This class inherits all properties of the page item class.

PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。Illustrator应用程序对象,提供了对整个Illustrator应用的访问和控制权限。
ArtworkKnockoutAiKnockoutStateIndicates whether this object is used to create a knockout, and if so, what kind.
指示该对象是否被用来创建镂空效果及其类型(例如:不透明度、剪切或普通镂空)。
BlendingModeAiBlendModesThe mode used when compositing an object.
定义此对象在合成时使用的混合模式(如正常、溶解、正片叠底等)。
ControlBoundsVariant Array of 4 DoublesRead-only. The bounds of the object, including stroke width and controls.
只读。包含描边宽度及控制点在内的对象边界范围(左下角X坐标、左下角Y坐标、右上角X坐标、右上角Y坐标)。
EditableBooleanRead-only. If true, this object is editable.
只读。如果为true,则表示该对象是可编辑的。
GeometricBoundsVariant Array of 4 DoublesRead-only. The bounds of the object, excluding stroke width.
只读。排除描边宽度后对象的实际几何边界范围(左下角X坐标、左下角Y坐标、右上角X坐标、右上角Y坐标)。
HeightDoubleThe height of the object, based on GeometricBounds.
基于GeometricBounds计算出的对象高度。
HiddenBooleanIf true, this object is hidden.
如果为true,则表示该对象当前处于隐藏状态。
IsIsolatedBooleanIf true, this object is isolated.
如果为true,则表示该对象已隔离,拥有独立视图层。
LayerLayerRead-only. The layer to which this object belongs.
只读。该对象所属的图层。
LeftDoubleThe position of the left side of the item (in points, measured from the left side of the page).
项目左侧边缘的位置(以点为单位,从页面左边算起)。
LockedBooleanIf true, this object is locked
如果为true,则表示该对象被锁定,不可编辑。
NameStringThe name of this object.
对象的名称。
NoteStringThe note assigned to this object.
分配给该对象的注释文本。
OpacityDoubleThe opacity of the object. Range: 0.0 to 100.0
对象的不透明度百分比,范围在0.0至100.0之间。
ParentobjectRead-only. The object that contains this object.
只读。包含此对象的父级容器对象。
PositionVariant Array of 2 DoublesThe position (in points) of the top left corner of the item in the format [x, y]. Does not include stroke weight.
项目的左上角位置(以点为单位,格式为[x, y]),不包括描边宽度。
SelectedBooleanIf true, this object is selected.
如果为true,则表示该对象当前已被选中。
SlicedBooleanIf true, this object is sliced.
如果为true,则表示该对象已被切片处理,适用于网页或其他交互媒体输出。
TagsTagsRead-only. The tags contained in this object.
只读。该对象所包含的所有标签。
TopDoubleThe position of the top of the item (in points, measured from the bottom of the page).
项目顶部边缘的位置(以点为单位,从页面底部向上计算)。
URLStringThe value of the Adobe URL tag assigned to this object.
分配给此对象的Adobe URL标签值。
VisibilityVariableVariableThe Variable bound to this object.
与此对象绑定的变量,可能影响其可见性状态。
VisibleBoundsVariant Array of 4 DoublesRead-only. The visible bounds of the object including stroke width.
只读。包括描边宽度在内的对象可见边界范围。
WidthDoubleThe width of the object, based on GeometricBounds.
基于GeometricBounds计算出的对象宽度。
WrapInsideBooleanIf true, the text frame object are wrapped inside this object.
如果为true,则表示文本框内的文本将被包裹在这个对象内部。
WrapOffsetDoubleThe offset to use when wrapping text around this object.
当环绕此对象排列文本框对象时使用的偏移量。
WrappedBooleanIf true, the text frame objects are wrapped around this object (text frame must be above the object).
如果为true,则表明文本框对象会绕着这个对象进行环绕排版(前提是文本框位于该对象之上)。
ZOrderPositionLongRead-only. The position of this art item within the stacking order of the group or layer (Parent) that contains the art item.
只读。此艺术项在其所在组或图层中的堆叠顺序位置。
NonNativeItem methods
MethodReturnsWhat it does
Copy()NothingCopies the item to the clipboard;the associated document must be the frontmost document.
将对象复制到剪贴板,关联的文档必须是当前最前面的文档。
Cut()NothingCuts the item to the clipboard; the associated document must be the frontmost document.
将对象剪切到剪贴板,关联的文档必须是当前最前面的文档。
Delete()NothingDeletes the object.
删除该对象。
Duplicate([relativeObject as Object],[insertionLocation as AiElementPlacement])ObjectDuplicates the art item, optionally with the location and position for the copy.
复制艺术项目,并可以选择性地指定副本的位置和插入位置。
Move(relativeObject as Object,insertionLocation as AiElementPlacement)NothingMoves the art item to a new location and position.
将艺术项目移动至新位置,并指定其在新位置中的插入方式。
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])NothingScales the art item where scaleX is the horizontal scaling factor and scaleY is the vertical scaling factor; 100.0 = 100%
按指定的水平缩放因子scaleX和垂直缩放因子scaleY缩放艺术项目;100.0表示100%缩放。可以同时选择是否改变元素的位置、填充图案、填充渐变、描边图案以及线宽,并可指定缩放中心点。
Rotate(angle as Double,[, changePositions as Boolean][, changeFillPatterns as Boolean][, changeFillGradients as Boolean][, changeStrokePattern as Boolean][, rotateAbout as AiTransformation])NothingRotates 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.
根据当前旋转角度相对地旋转艺术项目。若角度值为正,则逆时针旋转;若为负,则顺时针旋转。可以选择是否更改元素位置、填充图案、填充渐变及描边图案,并可指定旋转中心点。
Transform(transformationMatrix as Matrix,[, changePositions as Boolean][, changeFillPatterns as Boolean][, changeFillGradients as Boolean][, changeStrokePattern as Boolean][, changeLineWidths as Double][, transformAbout as AiTransformation])NothingTransforms the art item by applying a transformation matrix.
通过应用一个变换矩阵来转换艺术项目。
Translate([deltaX as Double][, deltaY as Double][, transformObjects as Boolean][, transformFillPatterns as Boolean][, transformFillGradients as Boolean][, transformStrokePatterns as Boolean])NothingRepositions the art item relative to the current position, where deltaX is the horizontal offset and deltaY is the vertical offset.
根据给定的水平偏移量deltaX和垂直偏移量deltaY相对于当前位置重新定位艺术项目。可以选择是否同时转换元素、填充图案、填充渐变及描边图案。
ZOrder(zOrderCmd as AiZOrderMethod)NothingArranges the art item’s position in the stacking order of the group or layer (Parent) of this object.
调整艺术项目在其所在组或图层(父级)中的堆叠顺序。

page 124

NonNativeItems

A collection of non-native items.

NonNativeItems properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
CountLongRead-only. The number of objects in the collection.
ParentDocumentRead-only. The document that contains this object.
NonNativeItems methods
MethodReturnsWhat it does
Index(item as GraphicStyle)LongReturns the index position of the object within the collection.
Item(itemKey)NonNativeItemReturns an object reference to the object identified by itemKey (name or index).
RemoveAll()NothingDeletes all objects in this collection.

page 125

OpenOptions

Options to use when opening files in Illustrator.

OpenOptions properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。Illustrator应用程序对象,提供对整个应用程序的访问和控制权。
ConvertCropAreaToArboardbooleanOptional. Convert crop areas to artboards when opening a legacy document in Illustrator CS4 or later. When false, crop areas are discarded.Default: true.
可选。在Illustrator CS4或更高版本中打开旧版文档时,将裁剪区域转换为画板。当设置为false时,裁剪区域会被丢弃。默认值:true。
ConvertTilesToArboardbooleanOptional. Convert print tiles to artboards when opening a legacy document in Illustrator CS4 or later. Default: false.
可选。在Illustrator CS4或更高版本中打开旧版文档时,将打印拼贴区域转换为画板。默认值:false。
CreateArtboardWithArtworkBoundingBoxbooleanOptional. Create an artboard with the dimensions of the bounding box of the artwork when opening a legacy document in llustrator CS4 or later. Default: false.
可选。在Illustrator CS4或更高版本中打开旧版文档时,根据作品的边界框尺寸创建一个画板。默认值:false。
OpenAsAiLibraryTypeOpens the file as an Illustrator library.
以Illustrator库的形式打开文件。
ParentDocumentRead-only. The document that contains this object.
只读。包含此对象的父级文档对象。
PreserveLegacyArtboardbooleanOptional. Preserve legacy artboards when opening a legacy document in Illustrator CS4 or later. Default: true.
可选。在Illustrator CS4或更高版本中打开旧版文档时保留原有的画板布局。默认值:true。
UpdateLegacyGradientMeshBooleanIf true, preserves the spot colors in the gradient mesh objects for legacy documents (pre-Illustrator CS4). Default: true
如果为true,则对于由Illustrator CS4之前的版本保存的旧版文档中的渐变网格对象,会保留专色信息。默认值:true。
UpdateLegacyTextBooleanIf true, updates all text objects for documents saved with legacy text by Illustrator versions previous to CS. Default: false
如果为true,则针对使用CS版本之前的老式文本格式保存的文档中的所有文本对象进行更新处理。默认值:false。
Opening a file and updating legacy text
This script assumes the file C:\temp\LegacyText.ai exists.
#Opens a file containing legacy text and updates the text automatically
#filePath contains the full path and file name of the file
Sub openOptions(filePath)
    Set appRef = CreateObject("Illustrator.Application")
    #Open a file with legacy text
    Set optionsRef = CreateObject("Illustrator.OpenOptions")
    optionsRef.UpdateLegacyText = True
    Set docRef = appRef.Open(filePath, 1, optionsRef)  # 1 = aiDocumentRGBColor
End Sub

page 127

PageItem

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

The PageItem class gives you complete access to every art item contained in an Illustrator document. The PageItem class is the superclass of all artwork objects in a document. The CompoundPathItem, GroupItem, MeshItem, PathItem, PlacedItem, PluginItem, RasterItem, and TextFrame classes each inherit a set of properties from the PageItem class.

You cannot create a PageItem directly, you must create one of the specific PageItem subclasses, such as PathItem.

PageItem properties
PropertyValue typeWhat it is
ArtworkKnockoutAiKnockoutStateIndicates whether the artwork is used to create a knockout.
指示该艺术作品是否用于创建镂空效果。
BlendingModeAiBlendModesThe mode to use when compositing this object. An object is considered composited when its opacity is set to less than 100.0 (100%).
设置此对象在合成时使用的模式。当对象的不透明度设置为小于100.0(即100%)时,认为该对象正在进行合成处理。
ControlBoundsRectRead-only. The bounds of the object including stroke width and controls.
只读。包括边框宽度和控制点在内的对象边界。
EditableBooleanRead-only. If true, this page item is editable.
只读。如果为 true,则表示此页面项目可编辑。
GeometricBoundsRectRead-only. The object’s bounds excluding the stroke width.
只读。不包括描边宽度的对象边界。
HeightRealThe height of the page item, calculated from the geometric bounds. Range: 0.0 to 16348.0
根据几何边界计算出的页面项的高度。范围:0.0 到 16348.0
HiddenBooleanIf true, this page item is hidden.
如果为 true,则表示此页面项被隐藏。
IsIsolatedBooleanIf true, this object is isolated.
如果为 true,则表示此对象处于孤立状态。
LayerLayerRead-only. The layer to which this page item belongs.
只读。此页面项所属的图层。
LeftDoubleThe left position of the art item.
艺术项的左位置坐标。
LockedBooleanIf true, this page item is locked.
如果为 true,则表示此页面项已被锁定。
NameStringThe name of this page item.此页面项的名称。
NoteStringThe note assigned to this item.
分配给此项目的注释内容。
OpacityRealThe opacity of this object, where 100.0 is completely opaque and 0.0 is completely transparent.
此对象的不透明度,其中 100.0 表示完全不透明,0.0 表示完全透明。
PositionPointThe position (in points) of the top left corner of the item in the format {x, y}. Does not include stroke weight.
以 {x, y} 格式表示的项目左上角的位置(单位为点)。不包含描边宽度。
PixelAlignedBooleanTrue if this item is aligned to the pixel grid.
如果为 true,则表示该项目与像素网格对齐。
SelectedBooleanIf true, this object is selected.
如果为 true,则表示此对象被选中。
SlicedBooleanIf true, preserve slices.
如果为 true,则保留切片信息。
TagsTagsThe collection of tags associated with this page item.
与此页面项关联的标签集合。
TopDoubleThe top position of the art item.
艺术项的顶部位置坐标。
URLStringThe value of the Adobe URL tag assigned to this page item.
分配给此页面项的 Adobe URL 标签值。
VisibilityVariableAnythingThe visibility variable to which this page item pathis bound.
与此页面项路径绑定的可见性变量。
VisibleBoundsRectRead-only. The object’s visible bounds, including stroke width of any objects in the illustration.
只读。包括插图中所有对象描边宽度在内的对象可见边界。
WidthRealThe width of the page item, calculated from the geometric bounds. Range: 0.0 to 16348.0
根据几何边界计算出的页面项的宽度。范围:0.0 到 16348.0
WrapInsideBooleanIf true, the text frame object should be wrapped inside this object.
如果为 true,则文本框架对象应该按照此对象内部进行环绕排版。
WrapOffsetDoubleThe offset to use when wrapping text around this object.
当围绕此对象排列文本框架对象时使用的偏移量。
WrappedBooleanIf true, wrap text frame objects around this object (text frame must be above the object).
如果为 true,则将文本框架对象(必须位于此对象上方)环绕在此对象周围。
ZOrderPositionLongRead-only. The drawing order of the art within its group or layer.
只读。在组或图层内,该图形元素的绘制顺序编号。
PageItem methods
MethodReturnsWhat it does
BringInPerspective(PositionX as Double,PositionY as Double,gridPlane as AiPerspectiveGridPlaneType)NothingPlaces art object(s) in a perspective grid at a specified position and grid plane.
在指定位置和透视网格平面上放置艺术对象(或一组对象)。
Copy()NothingCopies the selection to the clipboard.
将选中的内容复制到剪贴板。
Cut()NothingCuts the selection to the clipboard.
将选中的内容剪切到剪贴板。
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])NothingScales art object(s).
按比例缩放艺术对象(或一组对象),可选择性地同时调整填充图案、填充渐变、描边图案以及线条宽度,并可以选择缩放的基准点。
Rotate(angle as Double[,changePositions as Boolean][,changeFillPatterns as Boolean][,changeFillGradients as Boolean][,changeStrokePattern as Boolean][,rotateAbout as AiTransformation])NothingRotates art object(s).
旋转艺术对象(或一组对象),可以设置是否同步更改位置、填充图案、填充渐变和描边图案,同时可以指定旋转的基准点。
Transform(transformationMatrix as Matrix[,changePositions as Boolean][,changeFillPatterns as Boolean][,changeFillGradients as Boolean][,changeStrokePattern as Boolean][,changeLineWidth as Double][,transformAbout as AiTransformation])NothingTransforms art object(s) using a transformation matrix.
使用变换矩阵对艺术对象(或一组对象)进行变形操作,可以控制是否同时改变位置、填充图案、填充渐变、描边图案及线条宽度,也可以指定变形的基准点。
Translate([deltaX as Double][,deltaY as Double][,transformObjects as Boolean][,transformFillPatterns as Boolean][,transformFillGradents as Boolean][,transformStrokePattern as Boolean])NothingRepositions art object(s).
重新定位艺术对象(或一组对象),可以通过指定水平和垂直位移量,并可选择是否同时移动关联的填充图案、填充渐变和描边图案。
ZOrder(zOrderCmd as AiZOrderMethod)NothingArranges the art relative to other art in the group or layer.
根据指定的顺序命令调整艺术对象在组或图层中相对于其他艺术对象的前后顺序。

page 130

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

NonNativeItem

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 graphitem, the typename value of that object is GraphItem.

PageItems properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。表示当前对象所属的Adobe Illustrator应用程序对象,可以访问和控制整个Illustrator应用的功能。
CountLongRead-only. Number of elements in the collection.
只读。集合中元素的数量,即该容器内包含的对象个数。
ParentObjectRead-only. The object’s container.
只读。当前对象的容器,即包含此对象的上级对象,可能是另一个对象、图层、文档等。
PageItems methods
MethodReturnsWhat it does
Index(itemPtr as PageItem)LongReturns the index position of the object within the collection.
传入一个PageItem对象引用作为参数,返回该对象在集合中的索引位置。
Item(itemKey)ObjectReturns an object reference to the object identified by itemKey (name or index).
根据给定的itemKey(名称或索引)返回该集合中对应的对象引用。
RemoveAll()NothingDeletes all objects in this collection.
删除当前集合中的所有对象,清空整个集合内容。
Getting references to external files

Before running this script, open a document that contains one or more linked images.

'Gets the file references of all placed and raster items,
'then displays them in a new document
Set appRef = CreateObject("Illustrator.Application")
Dim fileReferences(9)
Set sourceDocument = appRef.ActiveDocument
index = 0
For Each artItem In sourceDocument.PageItems
    Select Case TypeName(artItem)
    Case "PlacedItem"
        fileReferences(index) = artItem.File
        index = index + 1
    Case "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
Set reportDocument = appRef.Documents.Add
Set fileNameText = reportDocument.TextFrames.Add
fileNameText.Position = Array(50, 520)
fileNameText.Contents = "File references in " &_
sourceDocument.Name & ":"
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
'Sets all placed or raster page items to hidden
Set appRef = CreateObject("Illustrator.Application")
For Each artItem In appRef.ActiveDocument.PageItems
    If (TypeName(artItem) = "PlacedItem" Or _
        TypeName(artItem) = "RasterItem") Then
        artItem.Hidden = True
    End If
Next

CHAPTER 1: VBScript Object Reference

page 132

Paper

A container for information objects about the paper to be used for printing.

Paper properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。表示Illustrator应用程序自身的对象,可用于访问和操作整个Illustrator应用。
NameStringThe paper name.
纸张的名称,通常用于标识特定的预设纸张或用户自定义纸张名称。
PaperInfoPaperInfoThe paper information.
包含关于纸张详细信息的对象,可能包括但不限于纸张尺寸(宽度、高度)、方向(纵向或横向)、边距等参数。

page 133

PaperInfo

Contains information about the dimensions and imageable area of the paper to be used for printing.

PaperInfo properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。表示Illustrator应用程序的对象,用于访问和操作整个Illustrator应用的功能。
CustomPaperBooleanIf true, a custom paper is being used.
如果为true,则表示正在使用自定义纸张尺寸,而非预设纸张尺寸。
HeightDoubleThe paper’s height in points.
纸张的高度,单位为点(1点 = 1/72英寸)。
ImageableAreaArray of 4 DoublesThe imageable area.
可打印区域的坐标信息,通常包括左上角横坐标、左上角纵坐标、右下角横坐标以及右下角纵坐标,这四个值共同定义了在该纸张上可以进行图像打印或输出的范围。
WidthDoubleThe paper’s width in points.
纸张的宽度,单位为点(1点 = 1/72英寸)。
Using Paper and PaperInfo objects
#Creates a new document then displays the paper list of the first printer in a text
frame
Set appRef = CreateObject("Illustrator.Application")
#Add a new document with some simple artwork
#(Must be a printable artwork for use with Printer object.)
Set docRef = appRef.Documents.Add()
Set textRef = docRef.TextFrames.Add()
textRef.Top = 750
textRef.Left = 50
curPrinterList = appRef.PrinterList
If UBound(curPrinterList) < 1 Then
    #exit
    sText = "Empty PrinterList"
    paragraphCount = 1
Else
    #Get paper objects for first printer
    Set printerRef = curPrinterList(1)
    sText = printerRef.Name
    sText = sText & " paper list:" & vbCrLf
    #Display data about available paper types
    paragraphCount = 2
    paperSizeArray = printerRef.PrinterInfo.PaperSizes
    If IsEmpty (paperSizeArray) Then
        sText = sText & vbCrLf
        paragraphCount = paragraphCount + 1
    Else
        For i = 0 To UBound(paperSizeArray) - 1
        Set paperRef = paperSizeArray(i)
        sText = sText & paperRef.Name & vbCrLf
        sText = sText & vbTab & paperRef.PaperInfo.Width
        sText = sText & " x " & paperRef.PaperInfo.Height & vbCrLf
        paragraphCount = paragraphCount + 2
        Next
    End If
End If
textRef.Contents = sText
appRef.Redraw

page 135

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
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。表示Illustrator应用程序的对象,提供了对整个Illustrator应用的操作访问权限。
AutoLeadingAmountDoubleAuto leading amount (as a percentage).
自动行距量(以百分比形式表示)。
BunriKinshiBooleanIf true, BunriKinshi is enabled.
如果为true,则启用了“禁断”功能(日语文本排版中的一项设置,通常用于控制某些字符组合之间的禁排规则)。
BurasagariTypeAiBurasagariTypeEnumThe 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).
表示标点符号是否允许超出段落边框的“下延”类型(当禁排规则设置为无时不可用)。
DesiredGlyphScalingDoubleThe desired glyph scaling, expressed as a percentage of the default character width. Range: 50.0 to 200.0; at 100.0,the width of characters is not changed.
期望的字形缩放比例,以默认字符宽度的百分比表示。范围:50.0至200.0;在100.0时,字符宽度不会改变。
DesiredLetterSpacingDoubleDesired letter, spacing expressed as a percentage of the default kerning or tracking Range: -100.0 to 500.0; at 0, no space is added between letters; at 100.0, an entire space width is added between letters.
期望的字母间距,以默认字间距或跟踪的百分比表示。范围:-100.0至500.0;在0时,字母之间不添加额外空间;在100.0时,在字母之间添加一个全空格宽度的距离。
DesiredWordSpacingDoubleDesired word spacing, expressed as a percentage of the default space for the font. Range: 0.0 to 1000.0; at 100.00, no space is added between words.
期望的单词间距,以默认字体空格大小的百分比表示。范围:0.0至1000.0;在100.0时,单词之间不添加额外空间。
EveryLineComposerBooleanIf true, the Every-line Composer is enabled. If false, the Single-line Composer is enabled.
如果为true,则启用“每行排列器”。如果为false,则启用“单行排列器”。
FirstLineIndentDoubleFirst line left indent (in points).
首行左缩进距离(单位为点)。
HyphenateCapitalizedWordsBooleanIf true, hyphenation is enabled for capitalized words.
如果为true,则启用了大写单词的连字符功能,即允许在大写单词中进行断字处理。
HyphenationBooleanIf true, hyphenation is enabled for the paragraph.
如果为true,则启用段落的断字功能。
HyphenationPreferenceDoubleHyphenation preference scale for better spacing (0) or fewer hyphens (1).Range: 0.0 to 1.0
用于改善间距(0)或减少连字符数量(1)的断字偏好程度。范围:0.0至1.0
HyphenationZoneDoubleThe distance (in points) from the right edge of the paragraph that marks the part of the line where hyphenation is not allowed. Note: 0 allows all hyphenation. Valid only when EveryLineComposer is false.
从段落右侧边缘开始,表示不允许发生断字区域的距离(单位为点)。注意:设置为0允许所有断字。仅在EveryLineComposer为false时有效。
JustificationAiJustificationParagraph justification.
段落对齐方式(如左对齐、居中、右对齐、两端对齐等)。
KinsokuStringThe name of a Kinsoku Shori set (a set of characters which cannot be used to begin or end a line of Japanese text).
日语文本禁排规则集的名称(包含不能作为行首或行尾的字符集合)。
KinsokuOrderAiKinsokuOrderEnumThe preferred Kinsoku order.
首选的禁排顺序。
KurikaeshiMojiShoriBooleanIf true, KurikaeshiMojiShori is enabled (controls how repeated characters are handled in Japanese text).
如果为true,则启用“重复文字处理”功能(控制日语文本中重复字符的处理方式)。
LeadingTypeAiAutoLeadingTypeThe type of auto leading.
自动行距的类型。
LeftIndentDoubleThe left indent (in points).
左缩进距离(单位为点)。
MaximumConsecutiveHyphensLongMaximum number of consecutive hyphenated lines.
连续断字的最大行数限制。
MaximumGlyphScalingDoubleMaximum glyph scaling, expressed as a percentage of the default character width. Range: 50.0 to 200.0; at 100.0, the width of characters is not changed.Note: Valid only for justified paragraphs.
最大字形缩放比例,以默认字符宽度的百分比表示。范围:50.0至200.0;在100.0时,字符宽度不变。注意:仅在两端对齐段落中有效。
MaximumLetterSpacingDoubleMaximum letter spacing, expressed as a percentage of the default kerning or tracking Range: -100.0 to 500.0; at 0, no space is added between letters; at 100.0, an entire space width is added between letters. Note: Valid only for justified paragraphs.
最大字母间距,以默认字间距或跟踪的百分比表示。范围:-100.0至500.0;在0时,字母之间不添加额外空间;在100.0时,在字母之间添加一个全空格宽度的距离。注意:仅在两端对齐段落中有效。
MaximumWordSpacingDoubleMaximum word spacing, expressed as a percentage of the default space for the font. Range: 0.0 to 1000.0; at 100.00, no space is added between words.Note: Valid only for justified paragraphs.
最大单词间距,以默认字体空格大小的百分比表示。范围:0.0至1000.0;在100.0时,单词之间不添加额外空间。注意:仅在两端对齐段落中有效。
MinimumAfterHyphenLongMinimum number of characters after a hyphen.
断字后至少需要的字符数。
MinimumBeforeHyphenLongMinimum number of characters before a hyphen.
断字前至少需要的字符数。
MinimumGlyphScalingDoubleMinimum glyph scaling, expressed as a percentage of the default character width. Range: 50.0 to 200.0; at 100.0,the width of characters is not changed.Note: Valid only for justified paragraphs.
最小字形缩放比例,以默认字符宽度的百分比表示。范围:50.0至200.0;在100.0时,字符宽度不变。注意:仅在两端对齐段落中有效。
MinimumHyphenatedWordSizeLongMinimum number of characters for a word to be hyphenated.
允许断字的单词的最小字符数。
MinimumLetterSpacingDoubleMinimum letter spacing, expressed as a percentage of the default kerning or tracking Range: -100.0 to 500.0; at 0, no space is added between letters; at 100.0, an entire space width is added between letters. Note: Valid only for justified paragraphs.
最小字母间距,以默认字间距或跟踪的百分比表示。范围:-100.0至500.0;在0时,字母之间不添加额外空间;在100.0时,在字母之间添加一个全空格宽度的距离。注意:仅在两端对齐段落中有效。
MinimumWordSpacingDoubleMinimum word spacing, expressed as a percentage of the default space for the font. Range: 0.0 to 1000.0; at 100.00, no space is added between words.Note:Valid only for justified paragraphs.
最小单词间距,以默认字体空格大小的百分比表示。范围:0.0至1000.0;在100.0时,单词之间不添加额外空间。注意:仅在两端对齐段落中有效。
MojikumiStringThe name of a predefined Mojikumi set for Japanese text composition.
预定义的日语文本排版设定集名称。
ParentObjectRead-only. The object’s container.
只读。该对象所在的容器对象。
RightIndentDoubleRight indent of margin expressed in points.
右边距,以点为单位表示。
RomanHangingBooleanIf true, Roman hanging punctuation is enabled.
如果为true,则启用罗马体悬挂标点符号功能。
SingleWordJustificationAiJustificationSingle word justification.
单个单词的对齐方式。
SpaceAfterDoubleSpacing after paragraph (in points).
段落后间距(单位为点)。
SpaceBeforeDoubleSpacing before paragraph (in points).
段落前间距(单位为点)。
TabStopsArray of SymmetryRepeatConfigTab stop settings, as TabStopInfo objects.
制表符停止位置设置,以TabStopInfo对象的形式存储。
Modifying paragraph attributes
#Creates a new document with an area text item
#containing 3 paragraphs then uses paragraph attributes
#to apply a different justification to each paragraph
Set appRef = CreateObject("Illustrator.Application")
#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 = 1 #aiRight
textRef.Paragraphs(2).ParagraphAttributes.Justification = 2 #aiCenter
textRef.Paragraphs(3).ParagraphAttributes.Justification = 0 #aiLeft

page 139

Paragraphs

A collection of Paragraph objects.

Paragraphs properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
CountLongRead-only. Number of elements in the collection.
ParentObjectRead-only. The object’s container.
Paragraphs methods
MethodReturnsWhat it does
Add(contents as String[, relativeObject as TextFrame][, insertionLocation as AiElementPlacement])TextRangeAdds a new paragraph with specified contents at the specified location in the document. If location is not specified, adds the paragraph to the containing text frame after the current text selection or insertion point.
在文档指定位置添加一个包含特定内容的新段落。如果不指定位置,则在当前文本选择或插入点之后的文本框中添加该段落。
AddBefore(contents as String)TextRangeAdds a new paragraph with specified contents before the current selection or insertion point.
在当前选区或插入点之前添加一个包含特定内容的新段落。
Index(itemPtr as PageItem)LongReturns the index position of the object within the collection.
返回此集合内指定PageItem对象(页面项目)的索引位置。
Item(itemKey)ObjectReturns a reference to the object identified by itemKey (name or index).
通过itemKey(名称或索引)返回对集合内特定对象的引用。
RemoveAll()NothingDeletes all objects in this collection.
删除此集合内的所有对象。
Counting paragraphs in a document
#Counts the number of paragraphs in the document and
#stores in numParagraphs
Set appRef = CreateObject("Illustrator.Application")
If appRef.Documents.Count > 0 Then
    numParagraphs = 0
    For Each curTextArt In appRef.ActiveDocument.TextFrames
        Set curTextRange = curTextArt.TextRange
        numParagraphs = numParagraphs + curTextRange.Paragraphs.Count
    Next
End If

page 141

ParagraphStyle

Associates character and paragraph attributes with a style. The style object can be used to apply those attributes to the text in a TextFrame object.

ParagraphStyle properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。表示Illustrator应用程序的对象,用于访问和操作整个Illustrator应用的功能。
CharacterAttributesCharacterAttributesRead-only. The character properties for the text range.
只读。文本范围的字符属性,包含字体、大小、颜色、字距调整等与单个字符相关的所有设置信息。
NameStringThe ParagraphStyle’s name.
段落样式的名称,用于标识和引用特定的段落样式。
ParagraphAttributesParagraphAttributesRead-only. The paragraph properties for the text range.
只读。文本范围的段落属性,包括对齐方式、缩进、行距、断字、禁排规则等与整个段落布局相关的所有设置信息。
ParentObjectRead-only. The object’s container.
只读。该对象所在的容器对象,通常是包含此文本范围或段落样式的更高层级对象(如文档、页面或文本框架)。
ParagraphStyle methods
MethodReturnsWhat it does
ApplyTo(textFrame as TextFrame[, clearingOverrides as Boolean])NothingApplies the paragraph style to the text object.
将此段落样式应用到指定的文本框架对象。如果提供了clearingOverrides参数且其值为true,则在应用样式之前会清除文本框架内已存在的局部样式覆盖设置。
Delete()NothingDeletes the object.
删除当前段落样式对象。一旦删除,该样式将不再可用,并从文档中移除所有以此样式设置的文本范围。
Creating and applying a paragraph style
#Creates 3 paragraphs with different attributes, creates
#a paragraph style and applies it to each paragraph
Set appRef = CreateObject("Illustrator.Application")
#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 = 1 #aiRight
textRef.Paragraphs(2).ParagraphAttributes.Justification = 2 #aiCenter
textRef.Paragraphs(3).ParagraphAttributes.Justification = 0 #aiLeft
#Create a new paragraph style
Set paraStyle = docRef.ParagraphStyles.Add("LeftIndent")
#Add some paragraph attributes
paraStyle.ParagraphAttributes.Justification = 0 #aiLeft
paraStyle.ParagraphAttributes.FirstLineIndent = 10
For Each pg In textRef.Paragraphs
    paraStyle.ApplyTo pg, True
Next
appRef.Redraw

page 143

ParagraphStyles

A collection of ParagraphStyle objects. See ParagraphStyle for an example.

ParagraphStyles properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
CountLongRead-only. Number of elements in the collection.
ParentObjectRead-only. The object’s container.
ParagraphStyles methods
MethodReturnsWhat it does
Add(name as String)ParagraphStyleCreates a new ParagraphStyle object.
Index(itemPtr as ParagraphStyle)LongReturns the index position of the object within the collection.
Item(itemKey)ParagraphStyleReturns an object reference to the object identified by itemKey (name or index).
RemoveAll()NothingDeletes all objects in this collection.

CHAPTER 1: VBScript Object Reference PathItem 144

page 144

PathItem

Art items such as those created using the Line, Rectangle, or Pen Tools. A path consists of path points that define its geometry. Path points are defined either as a PathPoint object or as an x-y page coordinate pair. The PathItem class gives you complete access to paths in Illustrator.

PathItem properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。Illustrator应用程序对象本身。
AreaDoubleRead-only. The area of this path in square points. If the area is negative, the pathis 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.
只读。此路径的面积(以平方点为单位)。如果面积为负,则表示路径是逆时针方向闭合。自相交路径可能存在相互抵消的子区域,导致该值为零,即使路径在视觉上似乎有面积。
ArtworkKnockoutAiKnockoutStateIs this object used to create a knockout, and if so, what kind.
指示该对象是否用于创建剪切效果以及具体是何种类型的剪切效果。
BlendingModeAiBlendModesThe mode used when compositing an object.
组合对象时使用的混合模式。
ClippingBooleanIf true, this pathis to be used as a clipping path
如果为真,则表明这个路径将被用作剪切路径。
ClosedBooleanIf true, this pathis closed
如果为真,则表示路径是闭合的。
ControlBoundsVariant Array of 4 DoublesRead-only. The bounds of the object including stroke width and controls.
只读。包括描边宽度和控制点在内的对象边界范围。
EditableBooleanRead-only. If true, this path item is editable.
只读。如果为真,则表示这个路径项是可以编辑的。
EvenoddBooleanIf true, the even-odd rule is used to determine insideness.
如果为真,则使用“偶-奇”规则来确定路径内部区域。
FillColorColor infoThe fill color of the path.
路径的填充颜色。
FilledBooleanIf true, the pathis filled.
如果为真,则表示路径已经被填充了颜色。
FillOverprintBooleanIf true, the art beneath a filled object are overprinted.
如果为真,则表示在填充对象下的艺术品会被覆盖印刷。
GeometricBoundsVariant Array of 4 DoublesRead-only. The bounds of the object excluding stroke width.
只读。不包括描边宽度的对象边界范围。
GuidesBooleanIf true, this pathis a guide object.
如果为真,则表示这是一个参考线对象。
HeightDoubleThe height of the path item, based on the GeometricBounds.
基于GeometricBounds计算出的路径项高度。
HiddenBooleanIf true, this path item is hidden.
如果为真,则表示这个路径项目是隐藏的。
IsIsolatedBooleanIf true, this object is isolated.
如果为真,则表示该对象已被孤立。
LayerLayerRead-only. The Layer to which this path item belongs.
只读。此路径项所属的图层。
LeftDoubleThe position of the left side of the item (in points, measured from the left side of the page).
项目左侧位置(以点为单位,从页面左侧测量)。
LengthDoubleRead-only. The length of this path (in points).
只读。此路径的长度(以点为单位)。
LockedBooleanIf true, this path item is locked.
如果为真,则表示此路径项目已被锁定。
NameStringThe name of this path item.
此路径项的名称。
NoteStringThe note text assigned to the path
分配给路径的注释文本
OpacityDoubleThe opacity of the object. Range 0.0 to 100.0
对象的不透明度。范围为0.0到100.0(表示从完全透明到完全不透明)
ParentobjectRead-only. The object that contains this path item.
只读。包含此路径项的对象。
PathPointsPathPointsRead-only. The path points contained in this path item.
只读。此路径项中包含的所有路径点。
PolarityAiPolarityValuesThe polarity of the path.
路径的极性。
PositionVariant Array of 2 DoublesThe position (in points) of the top left corner of the item in the format [x, y]. Does not include stroke weight.
项目左上角位置(以点为单位,格式为[x, y])。不包括描边宽度。
ResolutionDoubleThe resolution of the path in dots per inch.
路径的分辨率(每英寸点数)。
SelectedBooleanIf true, this path item is selected.
如果为真,则表示此路径项已被选中。
SelectedPathPointsPathPointsRead-only. All of the selected path points in the path.
只读。路径中所有被选中的路径点。
SlicedBooleanIf true, this path item is sliced.
如果为真,则表示此路径项已切片。
StrokeCapAiStrokeCapThe type of line capping.
线端类型的设置。
StrokeColorColor infoThe stroke color for the path.
路径的描边颜色。
StrokedBooleanIf true, the pathis stroked.
如果为真,则表示该路径有描边效果。
StrokeDashesVariant Array of DoublesThe lengths for dashes and gaps in dashed lines, starting with the first dash length, followed by the first gap length, and so on. Set to an empty list, [], for a solid line.
虚线段和间隙的长度列表,起始于第一条虚线段长度,接着是第一个间隙长度,以此类推。设置为空列表[]时为实线。
StrokeDashOffsetDoubleThe default distance into the dash pattern at which the pattern is started.
虚线模式开始的位置偏移量,默认距离进入虚线模式的起点。
StrokeJoinAiStrokeJoinType of joints for the path.
路径连接点类型的设置。
StrokeMiterLimitDoubleWhen 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
当默认的描边连接方式设为斜接时,此属性指定何时将连接方式转换为默认倒角(方角)。默认的斜接限制值4表示当尖角长度达到描边宽度的四倍时,连接方式会从斜接变为倒角。取值范围:1至500,默认值:4
StrokeOverprintBooleanIf true, the art beneath a stroked object is overprinted.
如果为真,则表示在描边对象下的艺术品会被覆盖印刷。
StrokeWidthDoubleThe width of the stroke (in points).
描边的宽度(以点为单位)。
TagsTagsRead-only. The tags contained in this path item.
只读。此路径项中包含的所有标签。
TopDoubleThe position of the top of the item (in points, measured from the bottom of the page).
项目的顶部位置(以点为单位,自页面底部测量)。
URLStringThe value of the Adobe URL tag assigned to this path item.
分配给此路径项的Adobe URL标签的值。
VisibilityVariableVariantThe Variable bound to this path item.
与该路径项关联的变量。
VisibleBoundsVariant Array of 4 DoublesRead-only. The visible bounds of the path item including stroke width.
只读。包括描边宽度在内的路径项可见边界范围。
WidthDoubleThe width of the path item, based on the GeometricBounds.
基于GeometricBounds计算出的路径项宽度。
WrapInsideBooleanIf true, the text frame object is wrapped inside this object.
如果为真,则表示文本框对象被包裹在这个对象内部。
WrapOffsetDoubleThe offset to use when wrapping text around this object.
绕此对象排列文本时使用的偏移量。
WrappedBooleanIf true, wrap text frame objects around this object (text frame must be above the object).
如果为真,则表示将文本框对象环绕此对象排列(文本框必须位于该对象上方)。
ZOrderPositionLongRead-only. The position of this art item within the stacking order of the group or layer (Parent) that contains the art item.
只读。在包含此艺术项的组或图层(父级)堆叠顺序中,该艺术项的位置。
PathItem methods
MethodReturnsWhat it does
Copy()NothingCopies the path item to the clipboard; the associated document must be the frontmost document.
将路径项复制到剪贴板;关联文档必须是前台最顶层文档。
Cut()NothingCuts the path item to the clipboard; the associated document must be the frontmost document.
将路径项剪切到剪贴板;关联文档必须是前台最顶层文档。
Delete()NothingDeletes the object.
删除对象。
Duplicate([relativeObject as Object],[insertionLocation as AiElementPlacement])ObjectDuplicates the art item, optionally with the location and position for the copy.
复制艺术项目,可选地指定副本的位置和位置。
Move(relativeObject as Object,insertionLocation as AiElementPlacement)NothingMoves the art item to a new location and position.
将艺术项目移动到新位置和位置。
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])NothingScales the art item where scaleX is the horizontal scaling factor and scaleY is the vertical scaling factor; 100.0 = 100%
按比例缩放艺术项目,其中scaleX为水平缩放因子,scaleY为垂直缩放因子;100.0表示100%。可以同时选择是否改变位置、填充图案、填充渐变、描边图案以及线条宽度,并可自定义缩放基准点。
Rotate(angle as Double,[, changePositions as Boolean][, changeFillPatterns as Boolean][, changeFillGradients as Boolean][, changeStrokePattern as Boolean][, rotateAbout as AiTransformation])NothingRotates 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.
相对于当前旋转角度旋转艺术项目。如果Angle值为正,则逆时针旋转对象,若值为负,则顺时针旋转。可以选择是否改变位置、填充图案、填充渐变、描边图案,并可自定义旋转基准点。
SetEntirePath(pathSpecification as Array of [x, y] coordinate pairs)NothingSets the path using the specified array of (x,y) coordinate pairs for path points.
使用指定的(x,y)坐标对数组设置路径。
Transform(transformationMatrix as Matrix,[, changePositions as Boolean][, changeFillPatterns as Boolean][, changeFillGradients as Boolean][, changeStrokePattern as Boolean][, changeLineWidths as Double][, transformAbout as AiTransformation])NothingTransforms the art item by applying a transformation matrix.
通过应用指定的转换矩阵来变换艺术项目。可以选择是否同时改变对象的位置、填充图案、填充渐变、描边图案和线条宽度,还可以设置一个自定义的转换基准点。
Translate([deltaX as Double][, deltaY as Double][, transformObjects as Boolean][, transformFillPatterns as Boolean][, transformFillGradients as Boolean][, transformStrokePatterns as Boolean])NothingRepositions the art item relative to the current position, where deltaX is the horizontal offset and deltaY is the vertical offset.
根据当前位置重新定位艺术项目,其中deltaX表示水平偏移量,deltaY表示垂直偏移量。可以设定是否同时移动关联的对象、填充图案、填充渐变以及描边图案。
ZOrder(zOrderCmd as AiZOrderMethod)NothingArranges the art item’s position in the stacking order of the group or layer (Parent) of this object.
在当前艺术项目所属的组或图层(Parent)中调整其堆叠顺序,即在视觉上前后层次的位置。可以通过指定不同的AiZOrderMethod来实现前移、后移、置顶或置底等操作。
Setting attributes of a path

'Sets the fill color and stroke width of the first path item

Set appRef = CreateObject("Illustrator.Application")
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.

'Creates 10 lines in the document then adds them as a single path item.

Set appRef = CreateObject("Illustrator.Application")
Dim lineList(10)
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)

page 149

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 theY 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
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
CountLongRead-only. Number of elements in the collection.
ParentObjectRead-only. The object’s container.
PathItems methods
MethodReturnsWhat it does
Add()PathItemCreates a new PathItem object.
创建一个新的PathItem对象(路径项),通常为空的路径,需要进一步添加点或形状来定义具体路径。
Ellipse([top as Double][, left as Double][, width as Double][, height as Double][, reversed as Boolean][, inscribed as Boolean])PathItemCreates a new PathItem in the shape of an ellipse using the supplied parameters. Defaults: Top: 100 pt.; Left: 100 pt.; Width: 50 pt.;Height: 100 pt.; Reversed: False
使用提供的参数创建一个椭圆形的新PathItem对象。默认参数:顶部位置(Top): 100 pt;左侧位置(Left): 100 pt;宽度(Width): 50 pt;高度(Height): 100 pt;是否逆时针绘制(Reversed): False。
Index(item as PathItem)LongReturns the index position of the object within the collection.
返回给定PathItem对象在集合中的索引位置。
Item(itemKey)PathItemReturns an object reference to the object identified by itemKey (name or index).
根据itemKey(可以是名称或索引)返回集合中对应的PathItem对象引用。
Polygon([centerX as Double][, centerY as Double][, radius as Double][, sides as Long][, reversed as Boolean])PathItemCreates a new PathItem in the shape of a polygon using the supplied parameters.Defaults: CenterX: 200 pt.; CenterY: 300 pt.; Radius: 50 pt.; Sides: 8; Reversed: false
使用提供的参数创建一个多边形形状的新PathItem对象。默认参数:中心X坐标(CenterX): 200 pt;中心Y坐标(CenterY): 300 pt;半径(Radius): 50 pt;边数(Sides): 8;是否逆时针绘制(Reversed): false。
Rectangle([top as Double][, left as Double][, width as Double][, height as Double][, reversed as Boolean])PathItemCreates a new PathItem in the shape of a rectangle using the supplied parameters.
使用提供的参数创建一个矩形形状的新PathItem对象。
RemoveAll()NothingDeletes all objects in this collection.
删除当前集合中的所有PathItem对象,清空整个集合。
RoundedRectangle([top as Double][, left as Double][, width as Double][, height as Double][, horizontalRadius as Double][, verticalRadius as Double][, reversed as Boolean])PathItemCreates a new PathItem in the shape of a rectangle with rounded corners using the supplied parameters. Defaults:HorizontalRadius: 15 pt.; VerticalRadius: 20 pt.; Reversed: False
根据提供的参数创建一个带有圆角的新矩形PathItem对象。默认参数:水平半径(HorizontalRadius): 15 pt;垂直半径(VerticalRadius): 20 pt;是否逆时针绘制(Reversed): False。
Star([centerX as Double][, centerY as Double][, radius as Double][, innerRadius as Double][, points as Long][, reversed as Boolean] )PathItemCreates a new PathItem in the shape of a star using the supplied parameters. Defaults:CenterX: 200 pt.; CenterY: 300 pt.; Radius: 50 pt.; InnerRadius: 20 pt.; Points: 5; Reversed: False
使用提供的参数创建一个星形的新PathItem对象。默认参数:中心X坐标(CenterX): 200 pt;中心Y坐标(CenterY): 300 pt;外接圆半径(Radius): 50 pt;内接圆半径(InnerRadius): 20 pt;星形点数(Points): 5;是否逆时针绘制(Reversed): False。
Creating shapes
#Creates 5 new path items in the current document and
#applies a random graphic style to each item
Set appRef = CreateObject("Illustrator.Application")
Set frontDocument = appRef.Documents.Add()
#Create a new rectangle with
#top = 762.5, left side = 87.5, witdth = 425 and height = 75
Set newRectangle = frontDocument.PathItems.Rectangle(762.5,87.5,425.0,75.0)
#create new rounded rectangle
Set newRndRectangle =
frontDocument.PathItems.RoundedRectangle(637.5,87.5,425.0,75.0,20.0,10.0)
#create ellipse, 'reversed' is false, 'inscribed' is true
Set newEllipse = frontDocument.PathItems.Ellipse(512.5,87.5,425.0,75.0,false,true)
#create an 8 sided polygon
Set newOctagon = frontDocument.PathItems.Polygon(300.0,325.0,75.0,8)
#create a 4 pointed star
Set newStar = frontDocument.PathItems.Star(300.0,125.0,100.0,20.0,4)
For Each newItem in frontDocument.PathItems
    Randomize
    styleIndex = Int((frontDocument.GraphicStyles.Count) * Rnd + 1)
    frontDocument.GraphicStyles(styleIndex).ApplyTo(newItem)
Next

page 151

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
PropertyValue typeWhat it is
AnchorVariant Array of 2 DoublesThe position of the anchor point.
锚点的位置坐标,即路径点在画布上的具体位置。
ApplicationApplicationRead-only. The Illustrator Application object.
只读。指向整个Adobe Illustrator应用程序的对象,允许访问和控制Illustrator的所有全局功能。
LeftDirectionVariant Array of 2 DoublesThe position of this path point’s inward control point.
此路径点的内向控制点(贝塞尔曲线中的左控制点)的位置坐标。控制点用于定义路径曲线的弯曲程度。
ParentObjectRead-only. The object that contains this PathPoint object.
只读。包含此PathPoint对象的父级容器对象,通常是指向包含该路径点的路径或图形对象。
PointTypeAiPointTypeThe 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.
路径点的类型,可以是曲线点或角点。设置为角点时,在用户界面中尝试修改它们时,会强制左右方向点位于同一直线上,从而创建直线段。
RightDirectionVariant Array of 2 DoublesThe position of this path point’s outward control point.
此路径点的外向控制点(贝塞尔曲线中的右控制点)的位置坐标。控制点同样用于定义路径曲线的形状。
SelectedAiPathPointSelectionAre points of this path point selected, and if so, which ones.
指示路径点是否被选中以及哪些部分被选中(如起点、终点或控制点)。
PathPoint methods
MethodReturnsWhat it does
Delete()NothingDeletes the object.
Shaping a path item by modifying a path point
#Changes the left and right path point directions of
#all but the last path point of frontmost path item
Set appRef = CreateObject("Illustrator.Application")
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
For index = 1 To (countOfPoints - 1)
    Set currentPoint = firstPath.PathPoints(index)
    Set nextPoint = firstPath.PathPoints(index + 1)
    currentAnchorList = currentPoint.Anchor
    nextAnchorList = nextPoint.Anchor
    deltax = nextAnchorList(0) - currentAnchorList(0)
    deltay = currentAnchorList(1) - nextAnchorList(1)
    length = Sqr(deltax ^ 2 + deltay ^ 2)
    currentPoint.LeftDirection = Array(currentAnchorList(0) - (50 * deltax / length),
    currentAnchorList(1) - (50 * deltay / length))
    currentPoint.RightDirection = Array(currentAnchorList(0) + (50 * deltax / length),
    currentAnchorList(1) + (50 * deltay / length))
Next

page 153

PathPoints

A collection of PathPoint objects in a path.

PathPoints properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
CountLongRead-only. Number of elements in the collection.
ParentObjectRead-only. The object’s container.
PathPoints methods
MethodReturnsWhat it does
Add()PathPointCreates a new PathPoint object.
Index(item as PathPoint)LongReturns the index position of the object within the collection.
Item(itemKey)PathPointReturns an object reference to the object identified by itemKey (name or index).
RemoveAll()NothingDeletes all objects in this collection.
Adding a new path point
#Creates a new path point in the first path item
Set appRef = CreateObject("Illustrator.Application")
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)
newPoint.PointType = 2

page 154

Pattern

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

Pattern properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
NameStringThe pattern name.
ParentDocumentRead-only. The document that contains this pattern.
Pattern methods
MethodReturnsWhat it does
Delete()NothingDeletes the object.
Setting a fill color to a pattern
#Sets the default fill to pattern 1
Set appRef = CreateObject("Illustrator.Application")
Set frontDocument = appRef.Documents(1)
Set patternColor = CreateObject("Illustrator.PatternColor")
For Each swatchRef In appRef.ActiveDocument.Swatches
    # Get the color object of the swatch
    Set swatchColor = swatchRef.Color
    # Only operate on patterns
    If (swatchColor.TypeName = "PatternColor") Then
        frontDocument.DefaultFilled = true
        frontDocument.DefaultFillColor = swatchColor
    End If
Next

page 155

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 info object, such as fillColor or strokeColor.

PatternColor properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。指向Adobe Illustrator应用程序对象,该对象提供了对整个Illustrator程序的全局访问和控制能力。
MatrixMatrixAn additional transformation matrix to manipulate the prototype pattern.
附加变换矩阵
PatternPatternA reference to the pattern object to use in this color definition.
引用在此颜色定义中使用的图案对象,决定了填充图形时所使用的图案样式。
ReflectBooleanIf true, the prototype is reflected before filling.
如果为真,则在填充前会先将原型图案进行镜像反射操作。
ReflectAngleDoubleThe axis in degrees around which to reflect.
以度为单位指定用于反射的轴线角度,围绕此轴线进行反射。
RotationDoubleThe angle in degrees to rotate the prototype pattern before filling.
以度为单位指定在填充前需要旋转原型图案的角度。
ScaleFactorVariant Array of 2 DoublesThe fraction to which to scale the prototype pattern before filling, represented as a point containing horizontal and vertical scaling percentages
表示水平和垂直缩放比例的点,用于在填充前按一定百分比缩放原型图案。
ShearAngleDoubleThe angle in degrees by which to slant the shear.
以度为单位指定斜切的角度,即沿某方向对图案进行倾斜变形的程度。
ShearAxisDoubleThe axis in degrees to shear relative to.
以度为单位指定相对其进行斜切的轴线角度,图案将沿着这个角度方向进行斜切变形。
ShiftAngleDoubleThe angle in degrees to translate the unscaled prototype pattern before filling.
以度为单位指定在填充前未缩放的原型图案沿某一角度方向进行平移旋转的角度。
ShiftDistanceDoubleThe distance in points to which to translate the unscaled prototype pattern before filling.
以点为单位指定在填充前未缩放的原型图案沿某一特定方向平移的距离。

####Modifying a pattern

#Rotates each pattern in the swatch list 10 degrees
#then applies it to the first path item.
Set appRef = CreateObject("Illustrator.Application")
Set colorOfPattern = CreateObject("Illustrator.PatternColor")
Set frontPath = appRef.ActiveDocument.PathItems(1)
For Each swatchRef In appRef.ActiveDocument.Swatches
    #Get the color object of the swatch
    Set swatchColor = swatchRef.Color
    #Only operate on patterns
    If (swatchColor.TypeName = "PatternColor") Then
    swatchColor.Rotation = 10
    frontPath.filled = true
    frontPath.fillColor = swatchColor
    End If
Next

CHAPTER 1: VBScript Object Reference

page 157

Patterns

A collection of Pattern objects in a document.

Patterns properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
CountLongRead-only. Number of elements in the collection.
ParentObjectRead-only. The object’s container.
Patterns methods
MethodReturnsWhat it does
Add()PatternCreates a new Pattern object.
Index(item as Pattern)LongReturns the index position of the object within the collection.
Item(itemKey)PatternReturns an object reference to the object identified by itemKey (name or index).
RemoveAll()NothingDeletes all objects in this collection.
Removing a pattern
#Deletes a pattern from the document
Set appRef = CreateObject("Illustrator.Application")
#Delete the 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(1)
frontDocument.Patterns.Remove patternToRemove

page 158

PDFFileOptions

Options for opening Adobe PDF documents. This object is found in the PDFFileOptions property of the Preferences class.

PDFFileOptions properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。指向整个Adobe Illustrator应用程序的对象,允许开发者访问和控制Illustrator的所有全局功能。
PageToOpenLongSpecifies which page are used when opening a multipage document. Default: 1
指定打开多页文档时使用哪一页。默认值:1,表示打开文档的第一页。
ParentObjectRead-only. The object’s container.
只读。表示当前对象所在的容器,即这个对象所属的父级实体。例如,在Illustrator中可能是一个特定的文档或页面等。
PDFCropToBoxAiPDFBoxTypeSpecifies which box are used when placing a multipage document. Default: 4 AiPDFMediaBox
在放置一个多页PDF文档时,指定使用的裁剪框类型。默认值:4 AiPDFMediaBox,表示使用PDF文件的媒体边界作为裁剪区域。该枚举可以有多个选项,如裁剪至裁剪框、出血框或其他类型的边框等。
Opening a PDF file
#Opens a multi-page PDF file to a specific
#page using the PDFFileOptions object
#filePath contains the full name and file path of the file to open
Sub pdfFileOptions(filePath)
    Set appRef = CreateObject("Illustrator.Application")
    With appRef.Preferences.PDFFileOptions
        .PageToOpen = 2
        .PDFCropToBox = 5 'aiPDFBoundingBox
    End With
    Set docRef = appRef.Open(filePath, 1)
End Sub

page 159

PDFSaveOptions

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

PDFSaveOptions properties
PropertyValue typeWhat it is
AcrobatLayersBooleanOptional. If true, create PDF layers from top-level layers (Acrobat 6 only option). Default: false
可选。如果设置为true,则根据顶层图层创建PDF图层(仅限 Acrobat 6 版本)。默认值:false,不创建PDF图层。
ApplicationApplicationOptional. Read-only. The Illustrator Application object.
可选。只读。指向Adobe Illustrator应用程序的对象,允许访问和控制Illustrator的核心功能。
ArtboardRangestringOptional. This is considered for multi-asset extraction, which specifies the artboard range. An empty string extracts all the artboards. Default: empty string
可选。在多资产提取时使用,用于指定要提取的艺术板范围。空字符串表示提取所有艺术板。默认值:空字符串
BleedLinkBooleanOptional. Link 4 bleed values.Default: true
可选。链接四边出血值。默认值:true,表示四个出血值关联并同步更新。
BleedOffsetRectVariant Array of 4 DoublesThe bleed offset rectangle.
出血偏移矩形,定义文档四周的出血区域边界。
ColorBarsBooleanOptional. Draw color bars.Default: false
可选。是否绘制颜色条以供校对。默认值:false,不绘制颜色条。
ColorCompressionAiCompressionQualityOptional. Compression method for color bitmap images.Default: 1 aiNoCompression
可选。彩色位图图像的压缩方法。默认值:1 aiNoCompression,表示不进行颜色图像压缩。
ColorConversionIDAiColorConversionOptional. The PDF color conversion policy. Default:0 aiColorConversionNone
可选。PDF的颜色转换策略。默认值:0 aiColorConversionNone,表示不执行颜色转换。
ColorDestinationIDAiColorDestinationOptional. The conversion target for color conversion. Default:0 aiColorDestinationNone
可选。颜色转换的目标配置。默认值:0 aiColorDestinationNone,表示没有特定的目标色彩空间转换。
ColorDownsamplingDoubleOptional. if zero, no downsampling, otherwise, the resolution to downsample color bitmap images to. Default: 150.0
可选。如果为零,则不进行降采样,否则将彩色位图图像降采样至指定分辨率。默认值:150.0,表示将图像降采样到150dpi。
ColorDownsamplingImage-ThresholdDoubleOptional. Downsample if the image’s resolution is above this value. Default: 225.0
可选。当图像分辨率高于此值时才进行降采样处理。默认值:225.0,即只有图像分辨率超过225dpi时才执行降采样。
ColorDownsamplingMethodAiDownsampleMethodOptional. Specifies how color bitmap images are resampled.Default: 0 aiNoDownsample
可选。指定如何对彩色位图图像进行重新采样。默认值:0 aiNoDownsample,表示不进行颜色图像的重新采样。
ColorProfileIDAiColorProfileOptional. The color profile to include.Default: 0 aiColorProfileNone
可选。指定要包含的颜色配置文件。默认值:0 aiColorProfileNone,表示不包含任何特定颜色配置文件。
ColorTileSizeLongOptional. Tile size when compressing with JPEG2000.Default: 256
可选。当使用JPEG2000压缩时的图像拼贴大小。默认值:256,表示每块图像大小为256像素。
CompatibilityAiPDFCompatibilityOptional. The version of the Acrobat® file format to create.Default: 5 Acrobat5
可选。创建的Acrobat®文件格式版本。默认值:5 Acrobat5,表示兼容Adobe Acrobat 5.0。
CompressArtBooleanOptional. If true, line art and text are compressed. Default: true
可选。如果设置为true,则对线条艺术和文本进行压缩。默认值:true,表示启用线稿和文字的压缩。
DocumentPasswordStringOptional. A password string to open the document. Default: no string
可选。用于打开文档的密码字符串。默认值:无密码(空字符串)。
EnableAccessBooleanOptional. If true, enable accessing 128-bit. Default: true
可选。如果设置为true,则启用128位访问权限。默认值:true,表示允许128位加密的访问权限。
EnableCopyBooleanOptional. If true, enable copying of text 128-bit. Default: true
可选。如果设置为true,则启用128位加密下的复制文本功能。默认值:true,表示允许在128位加密下复制文本。
EnableCopyAccessBooleanOptional. If true, enable copying and accessing 40-bit. Default: true
可选。如果设置为true,则启用40位加密下的复制和访问权限。默认值:true,表示在40位加密下同时开启复制和访问权限。
EnablePlainTextBooleanOptional. Enable plaintext metadata 128-bit; available only for Acrobat 6. Default: false
可选。启用128位加密下的纯文本元数据;仅适用于Acrobat 6。默认值:false,表示不启用此功能。
FlattenerOptionsPrintFlattenerOptionsOptional. The printing flattener options
可选。打印平滑器选项,定义如何处理透明度效果以适应输出设备。
FlattenerPresetStringOptional. Transparency flattener style name. Default: Custom
可选。透明度平滑预设风格名称。默认值:“Custom”,表示自定义透明度平滑设置。
FontSubsetThresholdDoubleOptional. Include a subset of fonts when less than this percentage of characters are used. Range: 0.0 to 100.0. Default: 100.0
可选。当使用的字符百分比低于此阈值时,只包含字体子集。范围:0.0到100.0。默认值:100.0,表示始终包含整个字体。
GenerateThumbnailsBooleanOptional. If true, generate thumbnails for the saved document. Default: true
可选。如果设置为true,则为保存的文档生成缩略图。默认值:true,表示生成缩略图。
GrayscaleCompressionAiCompressionQualityOptional. Specifies how grayscale bitmap images are compressed.Default: 1 aiNoCompression
可选。指定灰度位图图像的压缩方式。默认值:1 aiNoCompression,表示不压缩灰度图像。
GrayscaleDownsamplingDoubleOptional. If zero, no downsampling, otherwise, the resolution to downsample grayscale images to. Default: 150.0
可选。如果为零则不进行降采样,否则将灰度图像降采样至指定分辨率。默认值:150.0,表示将灰度图像降采样到150dpi。
GrayscaleDownsampling-ImageThresholdDoubleOptional. Downsample if the image’s resolution is above this value. Default: 225.0
可选。当图像分辨率高于此值时才进行灰度图像降采样处理。默认值:225.0,即只有图像分辨率超过225dpi时才执行降采样。
GrayscaleDownsampling-MethodAiDownsampleMethodOptional. How should grayscale bitmap images be resampled. Default: 0 aiNoDownsample
可选。指定灰度位图图像应如何被重新采样。默认值:0 aiNoDownsample,表示不进行灰度图像的重新采样。
GrayscaleTileSizeLongOptional. Tile size when compressing with JPEG2000.Default: 256
可选。使用JPEG2000压缩时的灰度图像拼贴大小。默认值:256,表示每个灰度图像拼贴块大小为256像素。
MonochromeCompressionAiMonochromeCompressionOptional. How should monochrome bitmap images be compressed.Default:0 aiNoMonoCompression
可选。单色位图图像的压缩方法。默认值:0 aiNoMonoCompression,表示不压缩单色图像。
MonochromeDownsamplingDoubleOptional. The resolution to downsample images to. If 0, no downsampling. Default: 300.0
可选。单色图像的降采样分辨率。如果为0,则不进行降采样。默认值:300.0,表示将单色图像降采样至300dpi。
MonochromeDownsampling-ImageThresholdDoubleOptional. Downsample if the image’s resolution is above this value. Default: 450
可选。如果图像分辨率高于此值,则进行单色图像的降采样处理。默认值:450.0,表示当图像分辨率超过450dpi时执行降采样。
MonochromeDownsampling-MethodAiDownsampleMethodOptional. How monochrome bitmap images are resampled.Default: aiNoDownsample
可选。指定单色位图图像应如何被重新采样。默认值:aiNoDownsample,表示不对单色图像进行重新采样。
OffsetDoubleOptional. Offset from artwork to draw printer marks. Default: 0
可选。用于绘制打印机标记相对于艺术品的偏移量。默认值:0,表示无偏移。
OptimizationBooleanOptional. If true, saved PDF are optimized for fast web viewing. Default: false
可选。如果设置为true,则保存的PDF文件将针对快速网页查看进行优化。默认值:false,表示不进行优化以适应网页查看。
OutputConditionStringOptional. An optional comment to add to the PDF file, describing the intended printing condition.Default: not included
可选。添加到PDF文件中的一条可选注释,描述预期的打印条件。默认值:不包含任何注释信息。
OutputConditionIDStringOptional. The name of a registered printing condition. Default: not included
可选。已注册打印条件的名称。默认值:不包含任何打印条件名称。
PageInformationBooleanOptional. If true, draw page information. Default: false
可选。如果设置为true,则在页面上绘制页面信息(如页码等)。默认值:false,表示不绘制页面信息。
PageMarksTypeAiPageMarksStyleOptional. The page marks style. Default: aiPageMarksStandard
可选。页面标记样式。默认值:aiPageMarksStandard,表示使用标准页面标记样式(例如裁切、出血和中心线等)。
PDFAllowPrintingAiPDFPrintAllowedEnumOptional. PDF security printing permission. Default:3 aiPrint128HighResolution
可选。PDF安全设置中的打印权限级别。默认值:3 aiPrint128HighResolution,表示允许128位加密下的高分辨率打印。
PDFChangesAllowedAiPDFChangesAllowedEnumOptional. PDF security changes allowed. Default: 5 Change128AnyChanges
可选。指定PDF文件的安全设置中允许的更改权限级别。默认值:5 Change128AnyChanges,表示使用128位加密且允许进行任何类型的更改。
PDFPresetStringOptional. PDF preset name
可选。用于导出PDF的预设名称,通常对应于预定义的一组PDF导出设置集合。
PDFXStandardAiPDFXStandardOptional. The PDF standard with which this document complies. Default: 1 aiPDFXNone
可选。指示此文档遵循的PDF标准。默认值:1 aiPDFXNone,表示不遵循特定的PDF/X标准。
PDFXStandardDescriptionstringOptional. A description of the PDF standard from the selected preset.
可选。所选PDF预设中包含的PDF标准相关描述信息。
PermissionPasswordStringOptional. A password string to restrict editing security settings. Default: no string
可选。设置一个密码以限制编辑安全设置的修改。默认值:无密码(空字符串),即不对编辑安全设置进行密码保护。
PreserveEditabilityBooleanOptional. If true, preserve Illustrator editing capabilities when saving the document. Default: true
可选。如果设置为true,则在保存文档时保留Illustrator的编辑功能。默认值:true,表示保存后仍可编辑。
PrinterResolutionDoubleOptional. Flattening printer resolution. Default: 800.0
可选。指定图形合并(Flattening)过程中的打印机分辨率。默认值:800.0 dpi。
RegistrationMarksBooleanOptional. Draw registration marks. Default: false
可选。是否绘制印刷注册标记。默认值:false,表示不绘制注册标记。
RequireDocumentPasswordBooleanOptional. If true, a password are required to open the document. Default: false
可选。如果设置为true,则打开文档时需要输入密码。默认值:false,表示无需密码即可打开。
RequirePermissionPasswordBooleanOptional. If true, a password are used to restrict editing security settings. Default: false
可选。如果设置为true,则修改文档安全设置时需提供密码。默认值:false,表示不需要密码来修改安全设置。
TrappedBooleanOptional. If true, manual trapping has been prepared for the document.Default: false
可选。如果设置为true,则表明该文档已经手动准备了陷印处理。默认值:false,表示文档未经陷印处理。
TrimMarksBooleanOptional. If true, draw trim marks. Default: false
可选。如果设置为true,则绘制裁切标记。默认值:false,表示不绘制裁切标记。
TrimMarkWeightAiPDFTrimMarkWeightOptional. Trim mark weight. Default: 1 aiTrimMarkWeight0125
可选。设置裁切标记线的粗细。默认值:1 aiTrimMarkWeight0125,表示裁切标记线宽为0.125点。
ViewAfterSavingBooleanOptional. If true, view PDF after saving. Default: false
可选。如果设置为true,则保存PDF后自动打开查看。默认值:false,表示保存时不自动打开查看。
Saving to PDF

This script illustrates how to save the frontmost document as PDF.

#Saves current document as PDF to dest
#dest contains the full path and file name to save to
Sub exportFileAsPDF (dest)
Set appRef = CreateObject("Illustrator.Application")
Set saveOptions = CreateObject("Illustrator.PDFSaveOptions")
saveOptions.ColorCompression = 6  #aiJPEGHigh
saveOptions.Compatibility = 5  #aiAcrobat5
Set frontDocument = appRef.ActiveDocument
Call frontDocument.SaveAs (dest, saveOptions)
End Sub

page 164

PhotoshopFileOptions

Options applied when opening or placing an Adobe Photoshop file.

PhotoshopFileOptions properties
PropertyValue typeWhat it is
ApplicationApplicationRead-only. The Illustrator Application object.
只读。Illustrator 应用程序对象。
LayerCompStringThe name of the layer composition to use when the document is converted.
在转换文档时要使用的图层组合的名称。
ParentObjectRead only. This object’s parent object.
只读。此对象的父对象。
PreserveHiddenLayersBooleanIf true, preserve hidden layers when the document is converted. Default: false
如果设置为true,则在转换文档时保留隐藏的图层。默认值为false。
PreserveImageMapsBooleanIf true, the image maps are preserved when the document is converted. Default: true
如果设置为true,则在转换文档时保留图像映射。默认值为true。
PreserveLayersBooleanIf true, layers are preserved when the document is converted. Default: true
如果设置为true,则在转换文档时保留图层。默认值为true。
PreserveSlicesBooleanIf true, slices are preserved when the document is converted. Default: true
如果设置为true,则在转换文档时保留切片。默认值为true。
Opening a Photoshop document
#Opens a PSD file and retains its layers
#using the PhotoshopFileOptions object
#dest contains the full path and file name of the file to open
Sub photoShopFileOptions(dest)
    Set appRef = CreateObject("Illustrator.Application")
    With appRef.Preferences.PhotoshopFileOptions
    PreserveLayers = True
    PixelAspectRatioCorrection = False
    End With
    Set docRef = appRef.Open(dest, 1)
End Sub

page 165

PlacedItem

An artwork item placed in a document as a linked file. For example, an artwork item

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值