0% found this document useful (0 votes)
220 views884 pages

Ai Scripting Docsforadobe Dev en Latest

This document provides an introduction to scripting in Adobe Illustrator. Scripting allows users to automate repetitive tasks by writing scripts that instruct Illustrator to perform a series of commands and actions. Scripting is useful for standardizing workflows and freeing up time for creative work. Scripts differ from actions in that they do not rely on the user interface and can make decisions based on conditional logic. The document outlines reasons for using scripting and provides an overview of basic scripting concepts.

Uploaded by

eslam Amer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
220 views884 pages

Ai Scripting Docsforadobe Dev en Latest

This document provides an introduction to scripting in Adobe Illustrator. Scripting allows users to automate repetitive tasks by writing scripts that instruct Illustrator to perform a series of commands and actions. Scripting is useful for standardizing workflows and freeing up time for creative work. Scripts differ from actions in that they do not rely on the user interface and can make decisions based on conditional logic. The document outlines reasons for using scripting and provides an overview of basic scripting concepts.

Uploaded by

eslam Amer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Illustrator Scripting Guide

Release 0.0.1

Adobe Systems Incorporated

Jun 05, 2023


INTRODUCTION

1 What is Scripting? 1

2 Changelog 3

3 Scripting language support in Adobe Illustrator CC 5

4 Viewing Sample Scripts 9

5 Viewing the object model 11

6 Executing Scripts 13

7 The Illustrator Scripting Object Model 15

8 Object Naming Conventions 17

9 Top-Level (containing) Objects 19

10 The Artwork Tree 21

11 Text Objects 23

12 Dynamic Objects 27

13 Symbols 29

14 Transformations 31

15 Launching and quitting Illustrator from a script 33

16 Working with objects 35

17 Measurement Units 39

18 Page-item positioning and dimensions 41

19 Paths and shapes 43

20 User-interaction levels 45

21 Printing Illustrator documents 47

22 For more information 49

i
23 Your first Illustrator script 51

24 Object references 53

25 Working with text frames 57

26 Creating paths and shapes 59

27 Working with the perspective grid 63

28 For more information 67

29 Your first Illustrator script 69

30 Working with methods in JavaScript 71

31 Accessing and referencing objects 73

32 Working with text frames 77

33 Creating paths and shapes 79

34 Working with the perspective grid 83

35 For more information 87

36 Your first Illustrator script 89

37 Accessing and referencing objects 91

38 Working with text frames 93

39 Creating paths and shapes 95

40 Working with enumeration values 99

41 Working with the perspective grid 101

42 Scripting Constants 105

43 JavaScript Object Reference 141

44 Application 143

45 Artboard 163

46 Artboards 167

47 Brush 171

48 Brushes 175

49 CharacterAttributes 179

50 Characters 193

51 CharacterStyle 197

52 CharacterStyles 201

ii
53 CMYKColor 205

54 Color 209

55 CompoundPathItem 223

56 CompoundPathItems 237

57 Dataset 241

58 Datasets 245

59 Document 249

60 DocumentPreset 281

61 Documents 287

62 EPSSaveOptions 291

63 ExportOptionsAutoCAD 297

64 ExportOptionsFlash 301

65 ExportOptionsGIF 309

66 ExportOptionsJPEG 315

67 ExportOptionsPhotoshop 319

68 ExportOptionsPNG24 323

69 ExportOptionsPNG8 327

70 ExportOptionsSVG 333

71 ExportOptionsTIFF 339

72 FXGSaveOptions 343

73 Gradient 347

74 Gradients 351

75 GradientStop 355

76 GradientStops 359

77 GraphicStyle 363

78 GraphicStyles 367

79 GraphItem 371

80 GraphItems 383

81 GroupItem 387

82 GroupItems 403

iii
83 IllustratorSaveOptions 407

84 ImageCaptureOptions 411

85 Ink 413

86 InkInfo 415

87 InsertionPoint 419

88 InsertionPoints 423

89 Layer 427

90 Layers 437

91 LegacyTextItem 441

92 LegacyTextItems 453

93 Lines 457

94 Matrix 459

95 MeshItem 463

96 MeshItems 475

97 NonNativeItem 479

98 NonNativeItems 491

99 OpenOptions 493

100OpenOptionsAutoCAD 497

101OpenOptionsFreeHand 501

102OpenOptionsPhotoshop 503

103PageItem 505

104PageItems 517

105Paper 601

106PaperInfo 603

107ParagraphAttributes 607

108Paragraphs 619

109ParagraphStyle 623

110ParagraphStyles 627

111PathItems 631

112PathPoint 639

iv
113PathPoints 643

114Pattern 647

115Patterns 649

116PDFFileOptions 653

117PDFSaveOptions 655

118PhotoshopFileOptions 671

119PlacedItems 675

120PluginItems 679

121PPDFile 683

122PPDFileInfo 685

123Preferences 689

124PrintColorManagementOptions 695

125PrintColorSeparationOptions 699

126PrintCoordinateOptions 703

127Printer 707

128PrinterInfo 709

129PrintFlattenerOptions 715

130PrintFontOptions 719

131PrintJobOptions 721

132PrintOptions 727

133PrintPageMarksOptions 733

134PrintPaperOptions 737

135PrintPostScriptOptions 741

136RasterEffectOptions 745

137RasterItems 749

138RasterizeOptions 753

139Screen 757

140ScreenInfo 759

141ScreenSpotFunction 763

142Spot 765

v
143Spots 769

144Story 773

145Stories 779

146Swatch 781

147Swatches 783

148SwatchGroup 787

149SwatchGroups 791

150SymbolItems 795

151Symbol 799

152Symbols 801

153TabStopInfo 805

154Tag 809

155Tags 813

156TextFont 817

157TextFonts 819

158TextFrameItems 823

159TextPath 829

160TextRange 839

161TextRanges 849

162TracingObject 851

163TracingOptions 855

164Variable 863

165Variables 865

166View 869

167Views 871

168Words 873

vi
CHAPTER

ONE

WHAT IS SCRIPTING?

A script is a series of commands that tells Illustrator to perform one or more tasks. These tasks can be simple, affecting
only one object in the current document, or complex, affecting objects in all your Illustrator documents.
The tasks might even involve other applications, like word processors, spreadsheets, and database management pro-
grams.
For the most part, the building blocks of scripting correspond to the Illustrator tools, menus, panels, and dialog boxes
with which you are already an expert. If you know what you want Illustrator to do, you can write a script to do it.

1.1 Why use scripting?

Graphic design is a field characterized by creativity, but aspects of the work are anything but creative. In fact, you
probably notice that the time you spend placing and replacing images, correcting errors in text, and preparing files for
printing at an image-setting service provider often reduces the time you have available for doing creative work.
With a small investment of time and effort, you can learn to write short, simple scripts that perform repetitive tasks for
you. As your scripting skills grow, you can move on to more complex scripts.
Scripting also can enhance your creativity, by quickly performing tasks you might not have time to try. For example,
you could write a script to systematically create a series of objects, modifying the new objects’ position, stroke, and
fill properties along the way. You also could write a script that accesses built-in transformation matrix functions to
stretch, scale, and distort a series of objects. Without scripting, you would likely miss out on the creative potential of
such labor-intensive techniques.

1.2 What about actions?

Both actions and scripts are ways of automating repetitive tasks, but they work very differently:
• Actions use a program’s user interface to do their work. As an action runs, menu choices are executed, objects
are selected, and recorded paths are created.
Scripts do not use a program’s user interface to perform tasks, and scripts can execute faster than actions.
• Actions have very limited facilities for getting and responding to information.
You cannot add conditional logic to an action; therefore, actions cannot make decisions based on the current
situation, like changing the stroke type of rectangles but not ellipses.
Scripts can get information and make decisions and calculations based on the information they receive from
Illustrator.

1
Illustrator Scripting Guide, Release 0.0.1

• A script can execute an action, but actions cannot execute scripts.

2 Chapter 1. What is Scripting?


CHAPTER

TWO

CHANGELOG

What’s new and changed for scripting?

2.1 Illustrator 24.0 (CC 2020) <>

• Added: [Link]()
• Added: [Link]

2.2 Illustrator XX.X (CC 2017) <>

• Added: [Link]()

2.3 Illustrator XX.X (CC) <>

• ?

3
Illustrator Scripting Guide, Release 0.0.1

4 Chapter 2. Changelog
CHAPTER

THREE

SCRIPTING LANGUAGE SUPPORT IN ADOBE ILLUSTRATOR CC

Illustrator scripting supports VBScript and JavaScript scripts for Windows, and AppleScript and JavaScript scripts for
Mac OS.

3.1 Script file extensions

For a file to be recognized by Adobe Illustrator CC 2017 as a valid script file, the file must have the correct file name
extension:

Script Type File type (extension) Platforms


AppleScript compiled script ( .scpt ) OSAS file (no extension) Mac OS
JavaScript or ExtendScript text ( .js or .jsx) Windows Mac OS
VBScript text ( .vbs ) Windows

3.2 JavaScript development options

You can use the ExtendScript Toolkit to create JavaScript scripts explicitly for Illustrator, or you can use Adobe Exten-
sion Builder and the Creative Cloud SDK to develop extensions in ActionScript.
Extensions are Flash-based (SWF) and can potentially work in a variety of Creative Cloud applications.

3.2.1 Developing a CC extension using ActionScript

Creative Cloud applications have an extensibility infrastructure that allows developers to extend the capabilities of the
applications; the infrastructure is based on Flash/Flex technology, and each extension is delivered as compiled Flash
(SWF) file.
Creative Cloud includes the Extension Manager to enable installation of extensions.
An example of an extension that ships with the point products is Adobe Kuler. Kuler has a consistent user interface
across the different suite applications, but has different logic in each, adapted to the host application.
The user interface for an extension is written in ActionScript, using the Flex framework. An extension is typically
accessed through its own menu item in the application’s Extensions menu.

5
Illustrator Scripting Guide, Release 0.0.1

Adobe Extension Builder allows you to design the user interface interactively using the Design view of Flash Builder.
The Creative Cloud SDK also allows you to develop all of the application logic for your extension in ActionScript; you
can develop and debug your extension in the familiar Flash Builder environment.
To develop your application logic, we recommend using the ActionScript Wrapper Library ( CSAWLib ), which ex-
poses the scripting DOM of each host application as an ActionScript library. This is tightly integrated with the Adobe
Extension Builder environment, which includes wizards to help you build your extension’s basic structure, and run and
debug your code against suite applications such as Adobe InDesign, Photoshop and Illustrator.
The methods, properties, and behavior of the scripting DOM is as described in the JavaScript Scripting Reference for
the host application.
For details of how to use Adobe Extension Builder and the wrapper libraries, see the Creative Cloud SDK documenta-
tion, which is accessible from within Adobe Extension Builder.

3.2.2 Scripting plug-ins

The CC JavaScript scripting interface allows for limited scripting for plug-ins. A plug-in can define a command,
with an event and notifier, and a handler that performs some action. A JavaScript script can then use the app.
sendScriptMessage() method to send parameters to that plug-in-defined command, and receive a plug-in-defined
response.
For example, the Adobe Custom Workspace plug-in defines a command “Switch Workspace”. A script can invoke this
command with the following code

result = [Link] (
"Adobe Custom Workspace",
"Switch Workspace",
'<workspace="Essentials" >'
);

In this case, the value that the plug-in returns is the string

"<error= errNo>".

3.2.3 ExtendScript features

If you write Illustrator-specific scripts that use the Illustrator JavaScript DOM directly, you will create ExtendScript
files, which are distinguished by the .jsx extension.
Giving your JavaScript files a .jsx extension (rather than the standard .js extension for a JavaScript file) allows you to
take advantage of ExtendScript features and tools.
ExtendScript offers all standard JavaScript features, plus a development and debugging environment, the ExtendScript
Toolkit (ESTK).
The ESTK is installed with all scriptable Adobe applications, and is the default editor for JSX files. The ESTK includes
an Object Model Viewer that contains complete documentation of the methods and properties of JavaScript objects.
For information on accessing the ESTK and the Object Model Viewer see Viewing the object model.
ExtendScript also provides various tools and utilities, including the following:
• A localization utility
• Tools that allow you to combine scripts and direct them to particular applications
• Platform-independent file and folder representation

6 Chapter 3. Scripting language support in Adobe Illustrator CC


Illustrator Scripting Guide, Release 0.0.1

• Tools for building user interfaces to your scripts


• A messaging framework that allows you to send and receive scripts and data among scripting-enabled Adobe
applications
All of these features are available whether you use the DOM directly with a JSX file, or indirectly through the Ac-
tionScript wrapper library and Adobe Extension Builder. For details of these and other features, see JavaScript Tools
Guide.

3.2. JavaScript development options 7


Illustrator Scripting Guide, Release 0.0.1

8 Chapter 3. Scripting language support in Adobe Illustrator CC


CHAPTER

FOUR

VIEWING SAMPLE SCRIPTS

Adobe provides sample scripts for many objects, properties, and methods in the lllustrator CC DOM. You can view
script samples in two locations:
• In the /Scripting/Sample Scripts/ folder in your lllustrator CC installation directory
• In this document :)

9
Illustrator Scripting Guide, Release 0.0.1

10 Chapter 4. Viewing Sample Scripts


CHAPTER

FIVE

VIEWING THE OBJECT MODEL

Each of the supported scripting languages provides a facility for viewing the scripting objects defined by Illustrator,
with reference details.

5.1 Viewing the JavaScript object model

To view the JavaScript object model for Illustrator, follow these steps:
In a default Adobe installation, the ESTK is in the following location:

Win- \system drive\Program Files\Adobe\Adobe Utilities CC\ExtendScript Toolkit CC


dows
Mac OS \system drive\Applications\Utilities\Adobe Utilities CC\ExtendScript Toolkit
CC

1. Start the ESTK.


2. In the ESTK, choose Help > Object Model Viewer.
3. In the Object Model Viewer window, select Adobe lllustrator CC Type Library from the Browser drop-down list.
Several extended sample scripts are in the /Scripting/Sample Scripts/ folder in your Illustrator CC installation
directory.
You also can view script samples and information about individual classes, objects, properties, methods, and parameters
in Illustrator Scripting Reference: Javascript.

5.2 Viewing the AppleScript object model

Apple provides a Script Editor with all Mac OS systems. You can use Script Editor to view the AppleScript dictionary
that describes Illustrator objects and commands.
For details of how to use Script Editor, see Script Editor Help.

Note: In a default Mac OS installation, Script Editor is in Applications/AppleScript/Script Editor


If you cannot find the Script Editor application, you must reinstall it from your Mac OS system CD.

11
Illustrator Scripting Guide, Release 0.0.1

1. Start Script Editor.


2. Choose File > Open Dictionary. Script Editor displays an Open Dictionary dialog.
3. In the Open Dictionary dialog, find and select Adobe lllustrator CC, and click Open.
Script Editor displays a list of the Illustrator objects and commands, which include the properties and elements associ-
ated with each object and the parameters for each command.
Several extended sample scripts are in the /Scripting/Sample Scripts/ folder in your Illustrator CC installation
directory.
You also can view script samples and information about individual classes, objects, properties, methods, and parameters
in Illustrator Scripting Reference: Applescript.

5.3 Viewing the VBScript object model

VBScript provides a type library you can use to view Illustrator object properties and methods. This procedure explains
how to view the type library through any Microsoft Office program. Your VBScript editor probably provides access to
the library. For information see your editor’s Help.
1. In any Microsoft Office application, choose Tools > Macro > Visual Basic Editor.
2. In the Visual Basic Editor, choose Tools > References.
3. In the dialog that appears, select the check box for Adobe lllustrator CC Type Library, and click OK.
4. Choose View > Object Browser, to display the Object Browser window.
5. Choose “Illustrator” from the list of open libraries in the top-left pull-down menu of the Object Browser window.
Several extended sample scripts are in the /Scripting/Sample Scripts/ folder in your lllustrator CC installation
directory.
You also can view script samples and information about individual classes, objects, properties, methods, and parameters
in Illustrator Scripting Reference: VBScript.

12 Chapter 5. Viewing the object model


CHAPTER

SIX

EXECUTING SCRIPTS

The Illustrator interface includes a Scripts menu (File > Scripts) that provides quick and easy access to your scripts.
Scripts can be listed directly as menu items that run when you select them. See Installing scripts in the Scripts menu.
You can navigate from the menu to any script in your file system and then run the script. See Executing scripts from
the Other Scripts menu item.
You also can have JavaScript scripts with a .jsx extension start automatically when you launch the application. For
information, see Startup scripts (.jsx scripts only).

6.1 Installing scripts in the Scripts menu

To include a script in the Scripts menu (File > Scripts), save the script in the Scripts folder, located in the /lllustrator
CC/Presets folder in your lllustrator CC installation directory.
The script’s filename, minus the file extension, appears in the Scripts menu.
Scripts that you add to the Scripts folder while Illustrator is running do not appear in the Scripts menu until the next
time you launch Illustrator.
Any number of scripts can be installed in the Scripts menu. If you have many scripts, use subfolders in the Scripts
folder to help organize the scripts in the Scripts menu.
Each subfolder is displayed as a separate submenu containing the scripts in that subfolder.

6.2 Executing scripts from the Other Scripts menu item

The Other Scripts item at the end of the Scripts menu (File > Scripts > Other Scripts) allows you to execute
scripts that are not installed in the Scripts folder.
Selecting Other Scripts displays a Browse dialog, which you use to navigate to a script file. When you select the file,
the script is executed.
Only files that are of one of the supported file types are displayed in the browse dialog. For details, see Scripting
language support in Adobe Illustrator CC.

13
Illustrator Scripting Guide, Release 0.0.1

6.3 Startup scripts (.jsx scripts only)

JavaScript scripts with a .jsx file extension can be installed in one of two folders, so the scripts run automatically when
you launch Illustrator and each time you run a script.
The folders are:
• An application-specific startup scripts folder, which contains scripts for IllustratorCC
• A general startup scripts folder, which contains scripts that run automatically when you start any Creative Cloud
application

6.3.1 Application-specific startup scripts folder

You must place application-specific startup scripts in a folder named Startup Scripts, which you create in the Illustrator
installation directory.
For example, when IllustratorCC is installed to its default location, you would create the Startup Scripts folder at the
following location:

Windows C:\Program Files\Adobe\Adobe lllustratorCC\Startup Scripts\


Mac OS /Applications/Adobe lllustrator CC/Startup Scripts/

JavaScript scripts with a .jsx extension placed in the Startup Scripts folder run automatically when:
• The application is launched.
• Any JavaScript file is selected from the Scripts menu (File > Scripts).

6.3.2 General startup scripts folder

The general startup scripts folder contains scripts that run automatically when you start any Creative Cloud application.
You create the folder in the following location:

Windows /Program Files/Common Files/Adobe/Startup Scripts CC/Illustrator


Mac OS /Library/Application Support/Adobe/Startup Scripts CC/Illustrator

If a script in the general startup folder is meant to be executed only by Illustrator, the script must include the ExtendScript
#target directive ( #target illustrator ) or code like the following

if ([Link] == "illustrator") {
// continue executing script
}

14 Chapter 6. Executing Scripts


CHAPTER

SEVEN

THE ILLUSTRATOR SCRIPTING OBJECT MODEL

A good understanding of the Illustrator object model will improve your scripting abilities. The following figure shows
the containment hierarchy of the object model, starting with the application object.
Note that the layer and group item classes can contain nested objects of the same class which can, in turn, contain
additional nested objects.

15
Illustrator Scripting Guide, Release 0.0.1

In addition to this application-specific object model, JavaScript provides certain utility objects, such as the File and
Folder objects, which give you operating-system-independent access to the file system.
For details, see JavaScript Tools Guide.

16 Chapter 7. The Illustrator Scripting Object Model


CHAPTER

EIGHT

OBJECT NAMING CONVENTIONS

There is one object model for the Illustrator scripting interface, but actual object names vary slightly in the different
scripting languages:
• AppleScript names are lower case, and individual words are separated by a space; for example: graphic style
• VBScript names are capitalized, and additional words in the name are indicated by uppercase initial letters; for
example: GraphicStyle
• JavaScript names begin with lowercase letters, and additional words in the name are indicated by uppercase initial
letters; for example: graphicStyle
This chapter uses generic object and property names, but you can easily apply these conventions to determine the
corresponding language-specific names.
Throughout this document, names of properties, methods, and object are in a monospaced font.

17
Illustrator Scripting Guide, Release 0.0.1

18 Chapter 8. Object Naming Conventions


CHAPTER

NINE

TOP-LEVEL (CONTAINING) OBJECTS

Use these objects to access global information about the Illustrator application or an individual document.

9.1 Application

The properties of the application object give your script access to global values, such as:
• User preferences, which a user sets interactively in the Illustrator application by using the Preferences dialog
(Edit > Preferences).
• System information like installed fonts (the text fonts property) and printers (the printer list property).
Also, there are properties that provide application-specific information and higher-level information about any open
documents:
• Application information like the installation path, version, and whether Illustrator is visible.
• The current active document; that is, the art canvas that is displayed and accepting user input.
• All open documents.
The application object’s methods or commands allow your script to perform application-wide actions; for example:
• Open files
• Undo and redo transactions
• Quit Illustrator

9.2 Document

The document object, which your scripts can create or access through the application object, represents an art
canvas or loaded Illustrator file.
The document object’s properties give you access to the document’s content; for example:
• The current selection, or art objects that the user selected in the document
• All contained art objects, called page items, that make up the artwork tree
• Art objects of particular types, like symbols and text frames
• All layers and the currently active layer

19
Illustrator Scripting Guide, Release 0.0.1

Document properties also tell you about the state of the document itself; for example:
• User settings for the document, such as ruler units
• Whether the document was saved since the last alteration of content
• The path of the associated file
The document object’s methods allow your scripts to act on the document; for example:
• Save to an Illustrator file or save as the various supported file formats
• Activate or close a document
• Print the document. Your scripts can select a printer by referencing a print options object, or they can
reference available printers through the application object’s printer list property.

9.3 Layer

The layer object provides access to the contents, or artwork tree, of a specific layer.
You access the layer object through the document object.
The layer object properties provide access to, or information about, the layer, such as:
• Whether the layer is visible or locked.
• The layer’s opacity (overall transparency) and z order position (position in the stacking order).
• Art-creation preferences for the layer, like artwork knockout and blending mode.

20 Chapter 9. Top-Level (containing) Objects


CHAPTER

TEN

THE ARTWORK TREE

The content of an Illustrator document is called the artwork tree. Artwork is represented by the following objects:
• compound path item
• graph item
• group item
• legacy text item
• mesh item
• non native item
• path item
• placed item
• plugin item
• raster item
• symbol item (see Dynamic Objects)
• text frame
Your scripts can access and manipulate art objects through collections in the document and layer objects.
There are two types of art-object collections:
• Collection objects that correspond to each individual artwork object type, such as the graph items object or
the mesh items object.
• The page items object, which includes art objects of all types.
Also, you can use the group item object to reference a grouped set of art items.
You can create new art objects using the make command (AppleScript) or add method of an artwork item collection
object. For example, to create a new path item object:

AppleScript set myPathItem to make new path item in current document


JavaScript var myPathItem = [Link]();
VBScript Set myPathItem = [Link]()

The following artwork collections do not allow the creation of new objects using the make command or add method:
• graph items object
• mesh items object
• plugin items object

21
Illustrator Scripting Guide, Release 0.0.1

• legacy text items object


For details on creating objects of these types, see the Adobe lllustrator CC Scripting Reference for your language.

10.1 Art styles

Your script can apply a graphic style to artwork using the graphic style object. To apply a graphic style, use the
graphic styles property of the document object to access the apply to method of the graphic style object.
Similarly, the brush object allows you to specify the brush to apply to artwork. You access any brush through the
brushes collection object, which is a property of the document object.

10.2 Color objects

Your script can apply a color, pattern or gradient to a path item object, using the fill color or stroke color
properties:
• Scripts can define new color swatches using the make command or add method of the swatches object. Your
script also can create a new spot color, using the make command or add property of the spots object.
• You can define the attributes of an ink object using the ink info object, which is an ink object property. You
access ink objects through the ink list property of the document object.
The following objects allow you to create colors within defined color spaces:
• The RGB color object, using the range 0.0 to 255.0 for the each of the three individual color values.
• The CMYK color object, using the percentage values 0.0 through 100.0 for each of the four individual color
values.
• The grayscale color or LAB color objects, using the same range and number of values that you use in the
Illustrator application.

22 Chapter 10. The Artwork Tree


CHAPTER

ELEVEN

TEXT OBJECTS

When you type content in an Illustrator document, the type automatically becomes a text frame object and, at the
same time, a story object.
To observe this, open a new document in Illustrator and use the horizontal text tool to type some text, then use the
vertical text tool to type more text.
Finally, create a rectangle and type some text inside it.
Now run the following JavaScript script

var myDoc = [Link];


alert("There are " + [Link] + " text frames.");
alert("There are " + [Link] + " stories.");

11.1 Text Frames

There are three types of text frames:


• point
• area
• path

To create a specific kind of text frame, use the kind property of the text frames object in AppleScript.

23
Illustrator Scripting Guide, Release 0.0.1

The JavaScript and VBScript text frames objects contain specific methods for creating area text frames and path
text frames.
As in the Illustrator application, you can thread area or path text frames.
To thread existing text frames, use the next frame or previous frame property of the text frame object.
Threaded frames make a single story object.
For information on creating or threading text frames, see the chapter in this manual for your scripting language.

11.1.1 Text Geometry

While the three kinds of text frames have common characteristics, like orientation, each has type-specific qualities,
as reflected in the text frame object’s properties. For example:
• An area text frame can have rows and columns, which you access through the row count and column count
properties.
• Path text has start T value and end T value properties that indicate where on the path the text begins and ends.
• Area and path text frames are associated with a text path object, which is specified using the text frame object’s
text path property. The text path defines the text frame’s position and orientation (horizontal or vertical) on
the artboard (while the text frame object’s orientation property defines the orientation of text within the
text frame). The text path property is not valid for point text, because point-text position and orientation are
defined completely by the properties of the text frame itself.

Note: A text path is not the same as a path art item. Text paths are associated with path art items that can be accessed
and manipulated to modify the appearance of the associated text frame.

11.2 Objects that represent text content

Within a text frame or story, the actual text content can be accessed as any of the following objects:
• characters
• words
• paragraphs
• lines
A line object is all the characters that fit on one line in a text frame or story object.
All text-art items have at least one line of text, defined as a line object.
Text art can have multiple text lines, if the text contains hard line breaks or its characters flow to a new line because
they do not fit in the width of the text art.
Text objects are accessed and identified by collections within the text frame and story objects; for example

textFrame("My Text Frame").paragraphs


// or
story("My Story").paragraphs

24 Chapter 11. Text Objects


Illustrator Scripting Guide, Release 0.0.1

Both text frame and story objects have insertion point and text selection properties.
The text frame object’s properties also include the defining features of the text frame, such as:
• The frame width, height, and position
• Whether the frame is hidden or locked
• Whether the text is editable

Note: A line object cannot be created in a script. Your script can create character, paragraph, and word objects.

11.2.1 Text ranges

The various text objects within a text frame or story also are represented collectively by the text range object.
For example, a character is a text range with a length of 1, and a word is a text range that has a space before it.
You can set the content of a text range object by passing a string using the contents property.

11.3 Text styles

Text-style elements, like font, capitalization, and justification, are represented by paragraph attribute
and character attribute objects.
These attribute objects are properties of the paragraph style and character style objects.
The paragraph style and character style objects have apply to and remove methods that allow your script
to assign or remove attributes in a specific paragraph, character, or text range.
You can change the display properties of a text range by applying an appropriate style or providing local overrides of
attributes at the text or paragraph levels:

11.3. Text styles 25


Illustrator Scripting Guide, Release 0.0.1

• character style objects apply to sets of one or more characters. They control character features like font,
alignment, leading, language, and capitalization, which are properties of the character attribute
object.
• paragraph style objects apply to paragraphs. They control paragraph features like first line indent,
left indent, and right indent, which are properties of the paragraph attribute object.

26 Chapter 11. Text Objects


CHAPTER

TWELVE

DYNAMIC OBJECTS

By creating dynamic objects, you can create data-driven graphics.


In the Illustrator application, you use the Variables panel to create or edit variables like graph data, linked file, text
string, and visibility, or variables whose type is not specified.
In scripting, you use the variable object to represent this type of variable.
The variable object’s kind property indicates the type of dynamic data that a variable object holds. Variable
objects are document-level objects; you create them in a document object.

Note: Do not confuse variable objects with scripting variables. For details on Illustrator variables, dynamic objects,
and data-driven graphics, see Illustrator Help.

Datasets, which collect variables and their associated dynamic data into one object, are represented in scripting by the
dataset object.
The dataset object provides methods to update and delete dataset objects in your scripts.

27
Illustrator Scripting Guide, Release 0.0.1

28 Chapter 12. Dynamic Objects


CHAPTER

THIRTEEN

SYMBOLS

In Illustrator, symbols are art items that are stored in the Symbols panel.
Your scripts can create, delete, and duplicate symbol objects.
When you create symbol objects in your script, Illustrator adds them to the Symbols panel for the target document.
A symbol item is an instance of a symbol object in a document. Each symbol item is linked to its symbol definition,
so changing the definition of a symbol updates all instances of the symbol.
Your script can create, delete, and duplicate symbol items. Symbol items are Illustrator art items; therefore, they can
be treated in the same way as other art items or page items.
You can rotate, resize, select, lock, hide, and perform other operations on symbol items.

29
Illustrator Scripting Guide, Release 0.0.1

30 Chapter 13. Symbols


CHAPTER

FOURTEEN

TRANSFORMATIONS

The matrix object provides access to the power of geometric-transformation matrices.


Transformation matrices in Illustrator store the settings of an operation that scales, rotates, or moves (translates) an
object on a page.
There are advantages to using matrices:
• By storing transformation values in a matrix object, you can use the values repeatedly on different objects in
your script.
• By concatenating rotation, translation, and/or scaling matrices and applying the resulting matrix, you can perform
many geometric transformations with only one script statement.
• You can invert matrix values.
• You can compare the values of two matrices.
The application object. has commands or methods to create, get, invert, compare, or concatenate matrices.
The command or method used to apply a matrix is the transform command, which belongs to any type of object on
which transformations can be performed.

31
Illustrator Scripting Guide, Release 0.0.1

32 Chapter 14. Transformations


CHAPTER

FIFTEEN

LAUNCHING AND QUITTING ILLUSTRATOR FROM A SCRIPT

Your scripts can control the activation and termination of Illustrator.

15.1 Launching and activating Illustrator

15.1.1 AppleScript

In AppleScript, you use a tell statement to target Illustrator.


The activate command activates Illustrator if it is not already active

tell application "Adobe Illustrator"


activate
end tell

15.1.2 JavaScript

Typically, you run JavaScript scripts from the application’s Scripts menu (File > Scripts) or start-up folder, so there is
no need to launch Illustrator from your script.
Information on launching Illustrator in JavaScript is beyond the scope of this guide.
For details, search for Interapplication Communication or Javascript Messaging Framework in JavaScript Tools Guide.

15.1.3 VBScript

In VBScript, there are several ways to create an instance of Illustrator:


• CreateObject launches Illustrator as an invisible application if it is not already running. If Illustrator is launched
as an invisible application you must manually activate the application to make it visible:

Set appRef = CreateObject("[Link]")

If you have multiple versions of Illustrator installed on the same machine and use the CreateObject method to obtain an
application reference, using “[Link]” creates a reference to the latest Illustrator version. To specifically
target an earlier version, use a version identifier at the end of the string:

33
Illustrator Scripting Guide, Release 0.0.1

Illustrator 10 “[Link].1”
Illustrator CS “[Link].2”
Illustrator CS2 “[Link].3”
Illustrator CS3 “[Link].4”
Illustrator CS4 “[Link].CS4”
Illustrator CS5 “[Link].CS5”
Illustrator CS6 “[Link].CS6”
Illustrator CC “[Link]”
Illustrator CC 2014 “[Link].CC2014”
Illustrator CC 2015 “[Link].CC2015”
Illustrator CC 2017 “[Link].CC2017”

• Use the New operator if you added a reference to the Illustrator type library to the project. For example, the
following line creates a new reference to the Application object:

Set appRef = New [Link]

15.2 Quitting Illustrator

15.2.1 AppleScript

Use the quit command:

tell application "Adobe Illustrator"


quit
end tell

15.2.2 JavaScript

Use the [Link]() method:

[Link]();

15.2.3 VBScript

Use the Application object’s Quit method:

Set appRef = CreateObject("[Link]")


[Link]

34 Chapter 15. Launching and quitting Illustrator from a script


CHAPTER

SIXTEEN

WORKING WITH OBJECTS

16.1 Getting the frontmost document or layer

To refer to the selected document, use the application object’s current document property in AppleScript or the
active document property in JavaScript or VBScript. Similarly, you can use the document object’s current layer
or active layer property to refer to the selected layer.
There are other types of “active” or “current” object properties, like active dataset or active view. For details,
see the Adobe lllustrator CC 2017 Scripting Reference for your language.

16.2 Creating new objects

Several objects (besides the application object itself) cannot be obtained from containers or parent objects. Your
script must create these objects directly.
The following objects must be created explicitly:
• CMYK color
• document preset
• EPS save options
• export options AutoCAD
• export options Flash
• export options GIF
• export options JPEG
• export options Photoshop
• export options PNG8
• export options PNG24
• export options SVG
• export options TIFF
• file
• folder
• gradient color

35
Illustrator Scripting Guide, Release 0.0.1

• gray color
• Illustrator save options
• ink
• ink info
• lab color
• matrix
• MXG save options
• no color
• open options
• open options AutoCAD
• open options FreeHand
• open options PDF
• open options Photoshop
• paper info
• Pattern color
• PDF save options
• PPD file
• PPD file info
• print color management options
• print color separation options
• print coordinate options
• printer
• printer info
• print flattener options
• print font options
• print job options
• print options
• print page marks options
• print paper options
• print postscript options
• raster effect options
• rasterize options
• screen
• screen spot function
• RGB color
• spot color

36 Chapter 16. Working with objects


Illustrator Scripting Guide, Release 0.0.1

• tracing options
The file and folder objects are Adobe ExtendScript devices designed to provide platform-independent access to the
underlying file system. For information on using these objects, see JavaScript Tools Guide.
For information on creating an object explicitly, see the chapter for your scripting language.

16.3 Collection objects

Most collection objects must be obtained from a container. For example, a path items collection object can be
contained by a document object or a layer object; to obtain an object in a path items collection, refer to either
containing of these objects. For example, see the language-specific sections below.

16.3.1 AppleScript

To refer to a path items object in a document

path item 1 in document 1

To refer to a path items object in a layer

path item 1 in layer 1 in document 1

16.3.2 JavaScript

To refer to a path items object in a document

documents[0].pathItems[1]

To refer to a path items object in a layer

documents[0].layers[0].pathItems[0]

16.3.3 VBScript

To refer to a path items object in a document

Documents(1).PathItems(1)

To refer to a path items object in a layer

Documents(1).Layers(1).PathItems(1)

For more examples of collection-item containers, see the document object Elements table in Adobe lllustrator CC 2017
Scripting Reference: AppleScript or the Properties table in Adobe lllustrator CC 2017 Scripting Reference: JavaScript
or Adobe lllustrator CC 2017 Scripting Reference: VBScript. A diagram of the lllustrator CC 2017 object model is in
The Illustrator Scripting Object Model.

16.3. Collection objects 37


Illustrator Scripting Guide, Release 0.0.1

16.4 Selected objects

Sometimes, you want to write scripts that act on the currently selected object or objects. For example, you might want
to apply formatting to selected text or change a selected path’s shape.

16.4.1 Selecting Text

To select text, use the select command or method of the text range object.

16.4.2 Selecting art items

You can select an art object (like graph items, mesh items, raster items, and symbol items) by setting its selected
property to true. (In AppleScript, selected is a property of the page items object.)

16.4.3 Referring to selected art items

To refer to all currently selected objects in a document, use the document object’s selection property. To work with
the objects in the selection array, you must determine their type, so you will know which properties and methods or
commands you can use with them. In JavaScript and VBScript, each artwork object type has a read-only typename
property that you can use to determine the object’s type. In AppleScript, use the class property.

16.5 Notes on renaming objects stored in the application’s panels

Several objects can be renamed; that is, their name property is writeable. The following types of objects can be sorted
alphabetically in the corresponding Illustrator panel. If a script modifies the name of such an object, references to that
object by index can become invalid.
• Brush
• Gradient
• Graphic Style
• Pattern
• Swatch
• Symbol
• Variable

38 Chapter 16. Working with objects


CHAPTER

SEVENTEEN

MEASUREMENT UNITS

Illustrator uses points as the unit of measurement for almost all distances. One inch equals 72 points. The exception
is values for properties like kerning, tracking, and the aki properties (used for Japanese text composition), which
use em units. (See Em space units)
Illustrator uses points when communicating with your scripts regardless of the current ruler units. If your script depends
on adding, subtracting, multiplying, or dividing specific measurement values for units other than points, it must perform
any unit conversions needed to represent your measurements as points. For example, to use inches for coordinates or
measurement units, you must multiply all inch values by 72 when entering the values in your script.
The following table shows conversion formulas for various units of measurement:

Unit Conversion formula


centimeters 28.346 points = 1 centimeter
inches 72 points = 1 inch
millimeters 2.834645 points = 1 millimeter
picas 12 points = 1 pica
Qs 0.709 point = 1 Q (1 Q equals 0.23 millimeter)

JavaScript provides the UnitValue object type, which offers unit-conversion utilities. For details, see JavaScript Tools
Guide

17.1 Em space units

Values that use em units instead of points are measured in thousandths of an em.
An em is proportional to the current font size.
For example, in a 6-point font, 1 em equals 6 points; in a 10-point font, 1 em equals 10 points.
In a 10-point font, a kerning value of 20 em units is equivalent to

(20 units x 10 points) / 1000 units/em = 0.2 points

39
Illustrator Scripting Guide, Release 0.0.1

40 Chapter 17. Measurement Units


CHAPTER

EIGHTEEN

PAGE-ITEM POSITIONING AND DIMENSIONS

Illustrator uses simple, two-dimensional geometry in the form of points to record the position of page item objects in
a document. Every page item object in a document has a position property that defines a fixed point as a pair of page
coordinates in the format [x, y]. The fixed point is the top-left corner of the object’s bounding box.
For information on the types of objects that comprise the page items collection, see “The artwork tree” on
A point is designated by a pair of coordinates:
• The horizontal position, x
• The vertical position, y
You can see these coordinates in the Info panel when you select or create an object in Illustrator.
For the artboard, the default coordinate origin, (0,0), is the top-left corner, reflected in the ruler origin property of the
artboard object. X coordinate values increase from left to right, and Y values increase from top to bottom. This changed
in the CS5 release; to maintain script compatability, a document created by a script still uses the older system, with the
origin at the bottom left of the artboard, and the Y value increasing from bottom to top. The page origin property of a
document object defines the bottom-left corner of the printable region of the document as a fixed point.
Each page item object has width and height properties. The maximum value allowed for the width or height of a page
item is 16348 points.

18.1 Art item bounds

Every page item object has three properties that use fixed rectangles to describe the object’s overall extent:
• The geometric bounds of a page item are the rectangular dimensions of the object’s bounding box, excluding
stroke width.
• The visible bounds of a page item are the dimensions of the object, including any stroke widths.
• The control bounds define the rectangular dimensions of the object, including in and out control points.
The following figure illustrates these properties, using JavaScript naming conventions.

41
Illustrator Scripting Guide, Release 0.0.1

42 Chapter 18. Page-item positioning and dimensions


CHAPTER

NINETEEN

PATHS AND SHAPES

Paths are represented in the Illustrator DOM by the path item object. Path items include all artwork that contains
paths, such as rectangles, ellipses, and polygons, as well as freeform paths.
A freeform path consists of a series of path points. A path point can be specified in two ways:
• As an array of x and y page coordinates.
• As a path point object, which defines an anchor point and two direction points or handles that define the path
segment’s curve:

For details, samples, and information on creating shapes, see the chapter for your scripting language.

43
Illustrator Scripting Guide, Release 0.0.1

44 Chapter 19. Paths and shapes


CHAPTER

TWENTY

USER-INTERACTION LEVELS

When user feedback is required, an application typically presents a dialog. This is called user interaction. It is useful
and expected when you are directly interacting with the application; however, when a script is interacting with an
application, a dialog brings the execution of the script to a halt until the dialog is dismissed. This can be a serious
problem in an automation environment, where there is no one present to deal with dialogs.
The application object contains a user interaction level property that allows you to control the level of in-
teraction allowed during script execution. You can suppress interaction in an automation environment or allow some
interaction where scripts are being used in a more interactive fashion.

20.1 AppleScript

Using AppleScript, it is possible to send commands from one machine to another, so additional types of interaction are
possible. In AppleScript:, there are four possible values for the user interaction level property:

Property Value Result


never interact No interaction is allowed.
interact with self Interact only with scripts executed from the Scripts menu (File > Scripts).
interact with local Interact with scripts executed on the local machine (including self ).
interact with all Interact with all scripts.

The four values allow you to control interaction based on the source of the script commands. For example, if the
application is acting as a server for remote users, it would be difficult for a remote user to dismiss a dialog, but it would
be no problem for someone sitting in front of the machine. In this case, an interaction level of interact with local would
prevent dialogs from halting remote scripts but would allow dialogs to be presented for local scripts.

20.2 JavaScript

In JavaScript, there are two possible values for the [Link] property:

Property Value Result


DISPLAYALERTS Interaction is allowed.
DONTDISPLAYALERTS No interaction is allowed.

45
Illustrator Scripting Guide, Release 0.0.1

20.3 VBScript

In VBScript, there are two possible values for the UserInteractionLevel property of the Application object:

Property Value Result


aiDisplayAlerts Interaction is allowed.
aiDontDisplayAlerts No interaction is allowed.

46 Chapter 20. User-interaction levels


CHAPTER

TWENTYONE

PRINTING ILLUSTRATOR DOCUMENTS

Using the print options scripting feature, you can capture and automate parts of your print workflow. Scripting
exposes the full capabilities of Illustrator printing, some of which may not be accessible through the application’s user
interface.
Illustrator supports at most one print session at a time, because of limits in the current printing architecture.
The document object’s print command or method takes one optional parameter, which allows you to specify a print
options object.
The print options object allows you to define print settings like PPD, PostScript options, paper options, and color-
management options. The print options object also has a print preset property, which allows you to specify a
preset to define your print job.
When defining the properties of a print options object, you can find out which printers, PPDs, print presets, and
other items are available by using the application object’s read-only “list” properties, such as the printer list,
PPD file list, and print presets list properties.

47
Illustrator Scripting Guide, Release 0.0.1

48 Chapter 21. Printing Illustrator documents


CHAPTER

TWENTYTWO

FOR MORE INFORMATION

Several extended sample scripts are in the /Scripting/Sample Scripts/ folder in your Illustrator CC 2017 instal-
lation directory.
For information about individual classes, objects, properties, commands, and parameters, as well as script samples that
demonstrate how to use many of these items, see asobjref/applescript-object-reference.
You also can view the lllustrator CC 2017 dictionary from the Script Editor application; see Viewing the AppleScript
object model
If you do not understand the concepts and terms used in this chapter, read Adobe Introduction to Scripting.

49
Illustrator Scripting Guide, Release 0.0.1

50 Chapter 22. For more information


CHAPTER

TWENTYTHREE

YOUR FIRST ILLUSTRATOR SCRIPT

The traditional first project in any programming language is displaying the message “Hello World!” In this example,
you create a new Illustrator document, then add a text frame containing this message. Follow these steps:
In a default Mac OS installation, Script Editor is in /Applications/AppleScript/Script Editor/.
If you cannot find the Script Editor application, you must reinstall it from your Mac OS system CD.
1. Open Script Editor.
2. Enter the following script:

--Send the following commands to Illustrator


tell application "Adobe Illustrator"
--Create a new document
set docRef to make new document
--Create a new text frame with the string "Hello World"
set textRef to make new text frame in docRef
with properties {contents: "Hello World!", position:{200, 200}}
end tell

3. In the Script Editor toolbar, click Run.

Tip: To add the script to the Illustrator Scripts menu (File > Scripts), save the script in the Scripts folder. The script
will appear on the menu the next time you start Illustrator. For details, see Installing scripts in the Scripts menu.

23.1 Adding features to “Hello World”

Next, we create a new script that makes changes to the Illustrator document you created with your first script. Our
second script demonstrates how to:
• Get the active document.
• Get the width of the active document.
• Resize the text frame to match the document’s width.
If you already closed the Illustrator document, run your first script again to create a new document.
Follow these steps:
1. In Script Editor, choose File > New to create a new script.

51
Illustrator Scripting Guide, Release 0.0.1

2. Enter the following code:

tell application "Adobe Illustrator"


-- current document is always the active document
set docRef to the current document
set docWidth to the width of docRef
-- resize the text frame to match the page width
set width of text frame 1 of docRef to docWidth
-- alternatively, one can reference the item directly, as follows:
set width of text frame 1 of current document to docWidth
end tell

3. Run the script.

52 Chapter 23. Your first Illustrator script


CHAPTER

TWENTYFOUR

OBJECT REFERENCES

In AppleScript, Illustrator returns object references by index position or name. For example, this is a reference to the
first path in layer 2

path item 1 of layer 2 of document 1

An object’s index position may change when other objects are created or deleted. For example, when a new path item
is created on layer 2, the new path item becomes path item 1 of layer 2 of document 1.
This new object displaces the original path item, forcing the original to index position 2; therefore, any references made
to path item 1 of layer 2 of document 1 refer to the new object. This method of applying index numbers
assures that lowest index number refers to the object that was worked on most recently.
Consider the following sample script:

-- Make 2 new objects and try to select both


tell application "Adobe Illustrator"
set newDocument to make new document
set rectPath to make new rectangle in newDocument
set starPath to make new star in newDocument
set selection of newDocument to {rectPath, starPath}
end tell

This script does not select both the rectangle and the star, as intended; instead, it selects only the star. Try running the
script with the Event Log window open, to observe the references returned from Illustrator for each consecutive make
command. (Choose Event Log at the bottom of the Script Editor window.) Notice that both commands return the same
object reference: path item 1 of layer 1 of document 1; therefore, the last line resolves to

set selection of document 1 to {path item 1 of layer 1 of document 1,


path item 1 of layer 1 of document 1}

A better approach is to reference the objects by name:

tell application "Adobe Illustrator"


set newDocument to make new document
make new rectangle in newDocument with properties {name:"rectangle"}
make new star in newDocument with properties {name:"star"}
set selection of newDocument to
{path item "rectangle" of newDocument,
path item "star" of newDocument}
end tell

This example illustrates the need to uniquely identify objects in AppleScript scripts. We recommend that you assign
names or variables to objects you need to access at a later time, as there is no guarantee you are accessing the objects

53
Illustrator Scripting Guide, Release 0.0.1

you expect when accessing them by index.

24.1 Obtaining objects from documents and layers

This script references an object as part of a document:


-- Get reference for first page item of document 1
tell application "Adobe Illustrator"
set pageItemRef to page item 1 of document 1
end tell

In the following script, the pageItemRef variable does not necessarily refer to the same object as in the previous script,
because this script includes a reference to a layer:
-- Get reference for first page item of layer 1 of document 1
tell application "Adobe Illustrator"
set pageItemRef to page item 1 of layer 1 of document 1
end tell

24.2 Creating new objects

To create a new object in AppleScript, use the make command.

24.3 Working with selections

When the user makes a selection in a document, the selected objects are stored in the document’s selection property.
To access all selected objects in the active document:
tell application "Adobe Illustrator"
set myDoc to current document
set selectedObjects to selection of myDoc
end tell

Depending on what is selected, the selection property value can be an array of any type of art objects. To get or
manipulate the properties of the selected art items, you must retrieve the individual items in the array. To find out an
object’s type, use the class property.
The following sample gets the first object in the array, then displays the object’s type:
tell application "Adobe Illustrator"
set myDoc to current document
set selectedObjects to selection of myDoc
set topObject to item 1 of selectedObjects
display dialog (class of topObject)
end tell

The first object in a selection array is the selected object that was last added to the page, not the last object selected.

54 Chapter 24. Object references


Illustrator Scripting Guide, Release 0.0.1

24.3.1 Working with selections

To select an art object, the object’s selected property.

24.3. Working with selections 55


Illustrator Scripting Guide, Release 0.0.1

56 Chapter 24. Object references


CHAPTER

TWENTYFIVE

WORKING WITH TEXT FRAMES

To create a text frame of a specific type in AppleScript, use the kind property of the text frame object

set myRect to make new rectangle in current document with properties


{position:{100, 700}, height:100, width:100}
set myAreaText to make new text frame in current document with properties
{kind:point text,contents:"Text Frame 1"}

25.1 Threaded frames

As in the Illustrator application, you can thread area text frames or path text frames.
To thread existing text frames, use the next frame or previous frame property of the text frame object.
When copying the following script to your script editor, place the value of the contents property on one line. The
long-line character (¬) is not valid within a string value.

tell application "Adobe Illustrator"


make new document
make new rectangle in current document with properties
{position:{100, 500}, height:100, width:100}
make new text frame in current document with properties
{kind:area text, text path:the result, name:"tf1", contents:"This is two text frames␣
˓→linked together as one story, with text flowing from the first to the last. First␣

˓→frame content. "}

make new rectangle in current document with properties


{position:{300, 700}, height:100, width:100}
make new text frame in current document with properties
{kind:area text, text path:the result, name:"tf2", contents:"Second frame content." }
--use the next frame property to thread the frames
set next frame of text frame "tf1" of current document to
text frame "tf2" of current document
redraw
end tell

57
Illustrator Scripting Guide, Release 0.0.1

25.1.1 Threaded frames make one story object

Threaded frames make a single story object. To observe this, run the following AppleScript after running the script
above.

display dialog ("There are " & (count(text frames of current document)) & " text frames.
˓→")

display dialog("There are " & (count(stories of current document)) & " stories.")

58 Chapter 25. Working with text frames


CHAPTER

TWENTYSIX

CREATING PATHS AND SHAPES

This section explains how to create items that contain paths.

26.1 Paths

To create line or a freeform path, specify a series of path points, as a series of x-y coordinates or path point objects.
Using x-y coordinates limits the path to straight segments. To created a curved path, you must create path point
objects. A path can comprise a combination of page coordinates and path point objects.

26.1.1 Specifying a series of x-y coordinates

To specify a path using page-coordinate pairs, use the entire path property of the path items object. The following
script specifies three pairs of x-y coordinates, to create a path with three points:

tell application "Adobe Illustrator"


set docRef to make new document
-- set stroked to true so we can see the path
set lineRef to make new path item in docRef with properties {stroked:true}
set entire path of lineRef to {{220, 475},{200, 300},{375, 300}}
end tell

26.1.2 Using path point objects

To create a path point object, you must define three values for the point.
• A fixed anchor point, which is the point on the path.
• A pair of direction points— left direction and right direction —which allow you to control the path
segment’s curve.
You define each property as an array of page coordinates in the format [x, y]:
• If all three properties of a path point object have the same coordinates, and the properties of the next path
point in the line are equal to each other, you create a straight-line segment.
• If two or more properties in a path point object have different values, the segment connected to the point is
curved.

59
Illustrator Scripting Guide, Release 0.0.1

To create a path or add points to an existing path using path point objects, create a path item object, then add the
path points as child objects in the path item:

tell application "Adobe Illustrator"


set docRef to make new document
-- set stroked to true so we can see the path
set lineRef to make new path item in docRef with properties {stroked:true}
--giving the direction points the same value as the
--anchor point creates a straight line segment
set newPoint to make new path point of lineRef with properties
{anchor:{220, 475},left direction:{220, 475},right direction:{220, 475},
point type:corner}

set newPoint2 to make new path point of lineRef with properties


{anchor:{375, 300},left direction:{375, 300},right direction:{375, 300},
point type:corner}

--giving the direction points the different values


--creates a curve
set newPoint3 to make new path point of lineRef with properties
{anchor:{220, 300},left direction:{180, 260},right direction:{240, 320},
point type:corner}

end tell

26.1.3 Combining path point types

The following script sample creates a path with three points, by combining the entire path property with a path point
object

tell application "Adobe Illustrator"


set docRef to make new document
-- set stroked to true so we can see the path
set lineRef to make new path item in docRef with properties {stroked:true}
set entire path of lineRef to {{220, 475},{375, 300}}
set newPoint to make new path point of lineRef with properties
{anchor:{220, 300},left direction:{180, 260},right direction:{240, 320},
point type:corner}
end tell

26.2 Shapes

To create a shape, you use the object that corresponds to the shape’s name (like ellipse, rectangle, or polygon),
and use the object’s properties to specify the shape’s position, size, and other information like the number of sides in a
polygon.
Remember:
• The scripting engine processes all measurements and page coordinates as points. For details, see Measurement
Units.

60 Chapter 26. Creating paths and shapes


Illustrator Scripting Guide, Release 0.0.1

• x and y coordinates are measured from the bottom-left corner of the document, as indicated in the Info panel in
the Illustrator application. For details, see Page-item positioning and dimensions.

26.2.1 Write-once access

Properties for path-item shapes use the “write-once” access status, which indicates that the property is writeable only
when the object is created. For existing path-item objects, the properties are read-only properties whose values cannot
be changed.

26.2.2 Creating a rectangle

Consider the following sample:

tell application "Adobe Illustrator"


set docRef to make new document
set rectRef to make new rectangle in docRef with properties
{bounds:{288, 360, 72, 144}}
end tell

The sample creates a rectangle with these properties:


• The top-right corner of the of the rectangle is inset 4 inches (288 points) from the bottom of the page and 5 inches
(360 points) from the left edge of the page.
• The lower-left corner of the rectangle is inset 1 inch (72 points) from the left edge of the page and 2 inches (144
points) from the bottom of the page.

26.2.3 Creating a polygon

Consider the following sample:

tell application "Adobe Illustrator"


set docRef to make new document
set pathRef to make new polygon in docRef with properties
{center point:{144, 288},sides:7,radius:72.0}
end tell

The sample creates a polygon with these properties:


• The center point of the object is inset is 2 inches (144 points) on the horizontal axis and 4 inches (288 points) on
the vertical axis.
• The polygon has 7 sides.
• The length of the radius from the center point to each corner is 1 inch (72 points).

26.2. Shapes 61
Illustrator Scripting Guide, Release 0.0.1

62 Chapter 26. Creating paths and shapes


CHAPTER

TWENTYSEVEN

WORKING WITH THE PERSPECTIVE GRID

The Perspective Grid is a new feature in lllustrator CC 2017 that enables you to create and manipulate art in a spatial
environment using established laws of perspective. Enable Perspective Grid using the View > Perspective Grid menu
or the perspective tools in the toolbar.
The SDK provides an API for working with the perspective grid programmatically, and your scripts have some access
to this API. A script can:
• Set a the default grid parameters using preset values.
• Show or hide the grid.
• Set the active plane.
• Draw an object in perspective on the active plane.
• Bring an object into perspective.

27.1 Use perspective presets

Illustrator provides default grid-parameter presets for one-point, two-point, and three-point perspectives. The presets
are named "[1P-NormalView]", "[2P-NormalView]", and "[3P-NormalView]".
The script shows how to select the two-point perspective preset programmatically:

tell application "Adobe Illustrator"


--Create a new document
set docRef to make new document
tell docRef
--Select the default two-point perspective preset
select perspective preset perspective preset "[2P-Normal View]"
end tell
end tell

You can create new perspective presets, export presets to files, and import presets from files. These scripts shows how
to export and import presets:

tell application "Adobe Illustrator"


set docRef to make new document
set filePath to "Macintosh HD:scripting:PGPresetsExported"
export perspective grid preset of docRef to file filePath
end tell
(continues on next page)

63
Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)

tell application "Adobe Illustrator"


set docRef to make new document
set filePath to "Macintosh HD:scripting:PGPresets"
import perspective grid preset of docRef from file filePath
end tell

27.2 Show or hide the grid

This script shows or hides the Perspective Grid programmatically:

tell application "Adobe Illustrator"


--Create a new document
set docRef to make new document
tell docRef
--Display the perspective grid defined in the document
show perspective grid
--Hide the perspective grid defined in the document
hide perspective grid
end tell
end tell

27.3 Set the active plane

The perspective grid plane types are:

Left plane perspective grid plane leftplane


Right plane perspective grid plane rightplane
Floor plane perspective grid plane floorplane
Invalid plane perspective grid plane noplane

For a one-point perspective grid, only the left and floor plane are valid.
This script sets the active perspective plane to the left plane:

tell application "Adobe Illustrator"


--Create a new document
set docRef to make new document
tell docRef
--Set the active plane to the left plane
set perspective active plane perspective grid plane leftplane
end tell
end tell

64 Chapter 27. Working with the perspective grid


Illustrator Scripting Guide, Release 0.0.1

27.4 Draw on a perspective grid

When the Perspective Grid is on, drawing methods allow you to draw or operate on objects in perspective. This script
creates a new document, shows a two-point perspective grid, and draws art objects on the left plane

tell application "Adobe Illustrator"


--Create a new document
set docRef to make new document
tell docRef
--Select the default two-point perspective preset
select perspective preset perspective preset "[2P-Normal View]"

--Display the perspective grid defined in the document


show perspective grid

--Check if active plane is set to left, otherwise set it to left


if (get perspective active plane) is not leftplane then
set perspective active plane perspective grid plane leftplane
end if

--Draw rectangle in perspective, then resize to 200% and move


set rectRef to make new rectangle with properties {bounds:{0, 0, 30, 30},␣
˓→reversed:false}

scale rectRef horizontal scale 200 vertical scale 200 about top left with␣
˓→transforming objects

translate rectRef delta x -420 delta y 480

--Draw ellipse in perspective


set ellipseRef to make new ellipse with properties {bounds:{60, -60, 90, -30},␣
˓→reversed:false, inscribed:true}

--Draw rounded rectangle in perspective


set rrectRef to make new rounded rectangle with properties {bounds:{90, -90, 30, 30},
˓→ horizontal radius:10, vertical radius:10, reversed:false}

--Draw polygon in perspective


set polyRef to make new polygon with properties {center point:{105, 105}, radius:15,␣
˓→sides:7, reversed:false}

--Draw star in perspective


set starRef to make new star with properties {center point:{135, 135}, radius:15,␣
˓→inner radius:10, point count:6, reversed:false}

--Draw path in perspective


set newPath to make new path item with properties {entire path:{{anchor:{0, 0}},
˓→{anchor:{60, 0}}, {anchor:{30, 45}}, {anchor:{90, 110}}}}

end tell
end tell

27.4. Draw on a perspective grid 65


Illustrator Scripting Guide, Release 0.0.1

27.5 Bring objects into perspective

If an art object is not in perspective, use the bringInPerspective() method to bring it into perspective and place it
on a plane.
This script creates a new document, draws an art object, and brings it into perspective on a three-point perspective grid:

tell application "Adobe Illustrator"


--Create a new document
set docRef to make new document
tell docRef
--Draw star
set starRef to make new star with properties {center point:{135, 135}, radius:15,␣
˓→inner radius:10, point count:6, reversed:false}

--Select the default three-point perspective preset


select perspective preset perspective preset "[3P-Normal View]"

--Display the perspective grid defined in the document


show perspective grid

--Check if active plane is set to left, otherwise set it to left


if (get perspective active plane) is not leftplane then
set perspective active plane perspective grid plane leftplane
end if

--Bring star to floor plane


bring in perspective starRef position x 100 position y 100 perspective grid plane␣
˓→floorplane

end tell
end tell

66 Chapter 27. Working with the perspective grid


CHAPTER

TWENTYEIGHT

FOR MORE INFORMATION

Several extended sample scripts are in the /Scripting/Sample Scripts/ folder in your lllustrator CC 2017 instal-
lation directory.
For information about individual classes, objects, properties, methods, and parameters, as well as script samples that
demonstrate how to use many of these items, see Adobe lllustrator CC 2017 Scripting Reference: JavaScript, in the /
Scripting/Documentation/ folder in your lllustrator CC 2017 installation directory. You also can use the Illustrator
dictionary, which you access from the Object Model Viewer in the ESTK. For information on using the ExtendScript
Toolkit and the Object Model Viewer, see Viewing the JavaScript object model.
If you do not understand the concepts and terms used in this chapter, read Adobe Introduction to Scripting.

67
Illustrator Scripting Guide, Release 0.0.1

68 Chapter 28. For more information


CHAPTER

TWENTYNINE

YOUR FIRST ILLUSTRATOR SCRIPT

The traditional first project in any programming language is displaying the message “Hello World!” In this example,
you create a new Illustrator document, then add a text frame containing this message. Follow these steps:
For information on locating the ExtendScript Toolkit, see Viewing the JavaScript object model.
1. Using any text editor (including Adobe^ InDesign® or the ESTK), enter the following text:

//Hello World!
var myDocument = [Link]();
//Create a new text frame and assign it to the variable "myTextFrame"
var myTextFrame = [Link]();
// Set the contents and position of the text frame
[Link] = [200,200];
[Link] = "Hello World!"

2. To test the script, do either of the following:


• If you are using the ESTK, select Adobe lllustrator CC 2017 from the drop-down list in the upper-left corner,
select Yes to start Illustrator, then choose Debug > Run in the ESTK to run the script.
• If you are using a different text editor than the ESTK, save the file as text-only in a folder of your choice, using
the file extension .jsx , then start Illustrator. In Illustrator, choose File > Scripts > Other Scripts, and navigate to
and run your script file.

Tip: To add the script to the Illustrator Scripts menu (File > Scripts), save the script in the Scripts folder. The script
will appear on the menu the next time you start Illustrator. For details, see Installing scripts in the Scripts menu.

29.1 Adding features to “Hello World”

Next, we create a new script that makes changes to the Illustrator document you created with your first script. Our
second script demonstrates how to:
• Get the active document.
• Get the width of the active document.
• Resize the text frame to match the document’s width.
If you already closed the Illustrator document, run your first script again to create a new document.
Follow these steps:

69
Illustrator Scripting Guide, Release 0.0.1

1. In Script Editor, choose File > New to create a new script.


2. Enter the following code:

var docRef = [Link];


var docWidth = [Link]
var frameRef = [Link][0]
[Link] = docWidth

3. Run the script.

70 Chapter 29. Your first Illustrator script


CHAPTER

THIRTY

WORKING WITH METHODS IN JAVASCRIPT

When you work with methods that have multiple parameters, you may omit optional parameters at the end of the
parameter list, but you may not omit parameters in the middle of the list. If you do not want to specify a particular
parameter in the middle of the list, you must insert the value undefined to use the parameter’s default value. For
example, the following definition describes the rotate() method for an art object.

rotate
(angle
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,rotateAbout])

In the definition, taken from Adobe lllustrator CC 2017 Scripting Reference: JavaScript, optional parameters are en-
closed in square brackets ( [] ).
To rotate the object 30 degrees and change the fillGradients, you would use the following script statement

[Link](30, undefined, undefined, true);

You need to specify undefined for the changePositions and changeFillPatterns parameters. You do not have
to specify anything for the two optional parameters following changeFillGradients, since they are at the end of the
parameter list.

71
Illustrator Scripting Guide, Release 0.0.1

72 Chapter 30. Working with methods in JavaScript


CHAPTER

THIRTYONE

ACCESSING AND REFERENCING OBJECTS

When you write a script, you must first decide which file, or document, the script should act on. Through the
application object, the script can create a new document, open an existing document, or act on a document that
is already open.
The script can create new objects in the document, operate on objects that the user selected, or operate on objects
in one of the object collections. The following sections illustrate various techniques for accessing, referencing, and
manipulating Illustrator objects.

31.1 Referencing the application object

To obtain a reference to a specific object, you need to navigate the containment hierarchy. Because all JavaScript
scripts are executed from within the Illustrator application, however, a specific reference to the application object is not
required. For example, to assign the active document in Illustrator to the variable frontMostDocument, you could
reference the activeDocument property of the application object, as follows

var frontMostDocument = activeDocument;

It is permissible to use the application object in a reference. To reference the application object, use the app
global variable. The following two statements appear identical to the JavaScript engine:

var frontMostDocument = activeDocument;

var frontMostDocument = [Link];

31.2 Accessing objects in collections

All open documents, as well as the objects in a document, are collected into collection objects for the object type. A
collection object contains an array of the objects that you can access by index or name. The collection object takes the
plural form of the object name. For example, the collection object for the document object is documents.
The following script sample gets all graphic style objects in the graphic styles collection; that is, it gets all
graphic styles available to the active document

var myStyles = [Link];

73
Illustrator Scripting Guide, Release 0.0.1

All numeric collection references in JavaScript are zero-based: the first object in the collection has the index [0].
As a rule, JavaScript index numbers do not shift when you add an object to a collection. There is one exception:
documents[0 is always the active or frontmost document.
To access the first style in a graphic styles collection, you can use the variable declared in the previous script
sample, or you can use the containment hierarchy to refer to the collection:
• Using the myStyles variable

var firstStyle = myStyles[0];

• Using the containment hierarchy:

var firstStyle = [Link][0];

The following statements assign the name of the first graphic style in the collection to a variable. You can use these
statements interchangeably.

var styleName = myStyles[0].name

var styleName = [Link]

var styleName = [Link][0].name

To get the total number of objects in a collection, use the length property:

alert ( [Link] );

The index of the last graphic style in the collection is [Link] - 1 (-1 because the collection starts the
index count at 0 and the length property counts from 1):

var lastStyle = myStyles[ [Link] - 1 ];

Note that an expression representing the index value is enclosed in square brackets ( [] ) as well as quotes.
If you know the name of an object, you can access the object in the collections using the name surrounded by square
brackets; for example:

var getStyle = myStyles["Ice Type"];

Each element in the collection is an object of the desired type, and you can access its properties through the collection.
For example, to get an object’s name, use the name property:

var styleName = [Link][0].name;

To apply lastStyle to the first pageItem in the document, use its applyTo() method:

[Link]( [Link][0] );

74 Chapter 31. Accessing and referencing objects


Illustrator Scripting Guide, Release 0.0.1

31.3 Creating new objects

You can use a script to create new objects. To create objects that are available from collection objects, or containers,
use the container object’s add() method

var myDoc = [Link]()


var myLayer = [Link]()

Some object types are not available from containers. To create an object of this type, define a variable, then use the new
operator with an object constructor to assign an object as the value. For example, to create a new CMYKColor object
using the variable name myColor:

var myColor = new CMYKColor()

31.4 Working with selections

When the user makes a selection in a document, the selected objects are stored in the document’s selection property.
To access all selected objects in the active document:

var selectedObjects = [Link];

The selection property value can be an array of any type of art objects, depending on what types of objects are
selected. To get or manipulate the properties of the selected art items, you must retrieve the individual items in the
array. To find out an object’s type, use the typename property.
The following sample gets the first object in the array, then displays the object’s type

var topObject = [Link][0];


alert([Link])

The first object in a selection array is the selected object that was last added to the page, not the last object selected.

31.4.1 Selecting artwork objects

To select an art object, the object’s selected property.

31.3. Creating new objects 75


Illustrator Scripting Guide, Release 0.0.1

76 Chapter 31. Accessing and referencing objects


CHAPTER

THIRTYTWO

WORKING WITH TEXT FRAMES

To create a text frame of a specific type in JavaScript, use the kind property of the text frame object:

var rectRef = [Link](700, 50, 100, 100);


//use the areaText method to create the text frame
var areaTextRef = [Link](rectRef);

32.1 Threaded frames

As in the Illustrator application, you can thread area text frames or path text frames.
To thread existing text frames, use the nextFrame or previousFrame property of the text frame object.
When copying the following script to the ESTK, place the value of the contents property on one line:

var myDoc = [Link]();


var myPathItem1 = [Link](244, 64, 82, 76);
var myTextFrame1 = [Link](myPathItem1);
var myPathItem2 = [Link](144, 144, 42, 116);
var myTextFrame2 = [Link](myPathItem2);

// use the nextFrame property to thread the text frames


[Link] = myTextFrame2;
var sText = "This is two text frames linked together as one story, with text
flowing from the first to the last. This is two text frames linked together as one
story, with text flowing from the first to the last. This is two text frames linked
together as one story. ";
[Link] = sText;
redraw();

77
Illustrator Scripting Guide, Release 0.0.1

32.1.1 Threaded frames make one story object

Threaded frames make a single story object. To observe this, run the following JavaScript after running the script
above.

var myDoc = [Link]


alert("There are " + [Link] + " text frames.")
alert("There are " + [Link] + " stories.")

78 Chapter 32. Working with text frames


CHAPTER

THIRTYTHREE

CREATING PATHS AND SHAPES

This section explains how to create items that contain paths.

33.1 Paths

To create line or a freeform path, specify a series of path points, as a series of x-y coordinates or path point objects.
Using x-y coordinates limits the path to straight segments. To created a curved path, you must create pathPoint
objects. Your path can comprise a combination of page coordinates and pathPoint objects.

33.1.1 Specifying a series of x-y coordinates

To specify a path using page-coordinate pairs, use the setEntirePath() property of the pathItems object. The
following script specifies three pairs of x-y coordinates, to create a path with three points

var myDoc = [Link];


var myLine = [Link]();
//set stroked to true so we can see the path
[Link] = true;
[Link]([[220, 475], [375, 300], [200, 300]]);

33.1.2 Using path point objects

To create a pathPoint object, you must define three values for the point.
• A fixed anchor point, which is the point on the path.
• A pair of direction points— left direction and right direction —which allow you to control the path
segment’s curve.
You define each property as an array of page coordinates in the format [x, y]:
• If all three properties of a pathPoint object have the same coordinates, and the properties of the next pathPoint
in the line are equal to each other, you create a straight-line segment.
• If two or more properties in a pathPoint object have different values, the segment connected to the point is
curved.
To create a path or add points to an existing path using pathPoint objects, create a pathItem object, then add the
path points as child objects in the pathItem:

79
Illustrator Scripting Guide, Release 0.0.1

var myDoc = [Link];


var myLine = [Link]();

//set stroked to true so we can see the path


[Link] = true;

var newPoint = [Link]();


[Link] = [220, 475];
//giving the direction points the same value as the
//anchor point creates a straight line segment
[Link] = [Link];
[Link] = [Link];
[Link] = [Link];

var newPoint1 = [Link]();


[Link] = [375, 300];
[Link] = [Link];
[Link] = [Link];
[Link] = [Link];

var newPoint2 = [Link]();


[Link] = [220, 300];
//giving the direction points different values
//than the anchor point creates a curve
[Link] =[180, 260];
[Link] = [240, 320];
[Link] = [Link];

33.1.3 Combining path point types

The following script sample creates a path with three points:

var myDoc = [Link];


var myLine = [Link]();
[Link] = true;
[Link]( [[220, 475], [375, 300]]);

// Append another point to the line


var newPoint = [Link]();
[Link] = [220, 300];
[Link] = [Link];
[Link] = [Link];
[Link] = [Link];

80 Chapter 33. Creating paths and shapes


Illustrator Scripting Guide, Release 0.0.1

33.2 Shapes

To create a shape, you use the object that corresponds to the shape’s name (like ellipse, rectangle, or polygon),
and use the object’s properties to specify the shape’s position, size, and other information like the number of sides in a
polygon.
Remember:
• All measurements and page coordinates are processed as points by the scripting engine. For details, see Mea-
surement Units.
• x and y coordinates are measured from the bottom-left corner of the document, as indicated in the Info panel in
the Illustrator application. For details, see Page-item positioning and dimensions.

33.2.1 Creating a rectangle

Consider the following sample:

var myDocument = [Link]()


var artLayer = [Link]()
var rect = [Link]( 144, 144, 72, 216 );

The sample uses the pathItems object’s rectangle() method to create a rectangle with these properties:
• The top of the rectangle is 2 inches (144 points) from the bottom edge of the page.
• The left edge is 2 inches (144 points) from the left edge of the page.
• The rectangle is 1 inch (72 points) wide and 3 inches (216 points) long.

33.2.2 Creating a polygon

Consider the following sample:

var myDocument = [Link]()


var artLayer = [Link]()
var poly = [Link]( 144, 288, 72.0, 7 );

The sample uses the polygon() method to create a polygon with these properties:
• The center point of the object is inset is 2 inches (144 points) on the horizontal axis and 4 inches (288 points) on
the vertical axis.
• The length of the radius from the center point to each corner is 1 inch (72 points).
• The polygon has 7 sides.

33.2. Shapes 81
Illustrator Scripting Guide, Release 0.0.1

82 Chapter 33. Creating paths and shapes


CHAPTER

THIRTYFOUR

WORKING WITH THE PERSPECTIVE GRID

The Perspective Grid is a new feature in lllustrator CC 2017 that enables you to create and manipulate art in a spatial
environment using established laws of perspective. Enable Perspective Grid using the View > Perspective Grid menu
or the perspective tools in the toolbar.
The SDK provides an API for working with the perspective grid programmatically, and your scripts have some access
to this API. A script can:
• Set a the default grid parameters using preset values.
• Show or hide the grid.
• Set the active plane.
• Draw an object in perspective on the active plane.
• Bring an object into perspective.

34.1 Use perspective presets

Illustrator provides default grid-parameter presets for one-point, two-point, and three-point perspectives. The presets
are named "[1P-NormalView]", "[2P-NormalView]", and "[3P-NormalView]".
The script shows how to select the two-point perspective preset programmatically:

//Set the default one-point perspective preset


[Link]("[1P-Normal View]");

//Set the default two-point perspective preset


[Link]("[2P-Normal View]");

//Set the default three-point perspective preset


[Link]("[3P-Normal View]");

You can create new perspective presets, export presets to files, and import presets from files. These scripts shows how
to export and import presets:

//Create a new document


var mydoc = [Link]();
//Export perspective presets to a file
var exportPresetFile = new File("C:/scripting/PGPresetsExported")
[Link](exportPresetFile);
(continues on next page)

83
Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)

//Create a new document


var mydoc = [Link]();
//Import perspective presets from a file
var importPresetFile = new File("C:/scripting/PGPresets")
[Link](importPresetFile);

34.2 Show or hide the grid

This script shows or hides the Perspective Grid programmatically:

//Show the Perspective Grid defined in the document


[Link]();

//Hide the Perspective Grid defined in the document


[Link]();

34.3 Set the active plane

The perspective grid plane types are:

Left plane [Link]


Right plane [Link]
Floor plane [Link]
Invalid plane [Link]

For a one-point perspective grid, only the left and floor plane are valid.
This script sets the active perspective plane:

//Set left plane as the active plane


[Link]([Link]);

//Set right plane as the active plane


[Link]([Link]);

//Set floor plane as the active plane


[Link]([Link]);

84 Chapter 34. Working with the perspective grid


Illustrator Scripting Guide, Release 0.0.1

34.4 Draw on a perspective grid

When the Perspective Grid is on, drawing methods allow you to draw or operate on objects in perspective. This script
creates a new document, shows a two-point perspective grid, and draws art objects on the left plane

//Create a new document


var mydoc = [Link]();

//Select the default two-point perspective preset


[Link]("[2P-Normal View]");

//Display the perspective grid defined in the document


[Link]();

//Check if active plane is set to left; if not, set it to left


if ([Link]() != [Link]) {
[Link]([Link]);
}

//Draw rectangle in perspective, then resize to 200% and move


var myrect = [Link](30, -30, 30, 30, false);
[Link](200, 200, true, false, false, false, 100, [Link]);
[Link] (-420, 480);

//Draw ellipse in perspective


var myellipse = [Link](60, -60, 30, 30, false, true);

//Draw rounded rectangle in perspective


var myrrect = [Link](90, -90, 30, 30, 10, 10, false);

//Draw polygon in perspective


var mypoly = [Link](-105, 105, 15, 7, false);

//Draw star in perspective


var mystar = [Link](-135, 135, 15, 10, 6, false);

//Draw path in perspective


var newPath = [Link]();
var lineList = new Array(4);
lineList[0] = new Array(0,0);
lineList[1] = new Array(60,0);
lineList[2] = new Array(30,45);
lineList[3] = new Array(90,110);
[Link](lineList);

34.4. Draw on a perspective grid 85


Illustrator Scripting Guide, Release 0.0.1

34.5 Bring objects into perspective

If an art object is not in perspective, use the bringInPerspective() method to bring it into perspective and place it
on a plane.
This script creates a new document, draws an art object, and brings it into perspective on a three-point perspective grid:

//Create a new document


var mydoc = [Link]();

//Draw ellipse
var myellipse = [Link](60, -60, 30, 30, false, true);

//Draw polygon
var mypoly = [Link](-105, 105, 15, 7, false);

//Draw star
var mystar = [Link](-135, 135, 15, 10, 6, false);

//Select the default three-point perspective preset


[Link]("[3P-Normal View]");

//Display the perspective grid defined in the document


[Link]();

//Check if active plane is set to left; if not, set it to left


if ([Link]() != [Link]) {
[Link]([Link]);
}

//Bring the ellipse to the active plane (left plane)


[Link](-100,-100, [Link]);

//Bring the polygon to the right plane


[Link](100,-100,[Link]);

//Bring the star to the floor plane


[Link](100,100,[Link]);

86 Chapter 34. Working with the perspective grid


CHAPTER

THIRTYFIVE

FOR MORE INFORMATION

Several extended sample scripts are in the :Scripting:Sample Scripts folder in your Illustrator CC 2017 installation
directory.
For information about individual classes, objects, properties, commands, and parameters, as well as script samples
that demonstrate how to use many of these items, see Adobe lllustrator CC 2017 Scripting Reference: VBScript, in
the /Scripting/Documentation/ folder in your lllustrator CC 2017 installation directory. You also can view the
lllustrator CC 2017 dictionary from the Script Editor application; see Viewing the VBScript object model.
If you do not understand the concepts and terms used in this chapter, read Adobe Introduction to Scripting.

87
Illustrator Scripting Guide, Release 0.0.1

88 Chapter 35. For more information


CHAPTER

THIRTYSIX

YOUR FIRST ILLUSTRATOR SCRIPT

The traditional first project in any programming language is displaying the message “Hello World!” In this example,
you create a new Illustrator document, then add a text frame containing this message. Follow these steps:
1. Start any text editor (for example, Notepad).
2. Type the following code:

Rem Hello World


Set appRef = CreateObject("[Link]")
Rem Create a new document and assign it to a variable
Set documentRef = [Link]
Rem Create a new text frame item and assign it to a variable
Set sampleText = [Link]
Rem Set the contents and position of the TextFrame
[Link] = Array(200, 200)
[Link] = "Hello World!"

3. Save the file as text-only in a folder of your choice, using the file extension .vbs.
4. To test the script, do one of the following:
• Double-click the file.
• Start Illustrator, choose File > Scripts > Other Scripts, and navigate to and run your script file.

Tip: To add the script to the Illustrator Scripts menu (File > Scripts), save the script in the Scripts folder. The script
will appear on the menu the next time you start Illustrator. For details, see Installing scripts in the Scripts menu.
In general, when you launch a VBScript script from the Scripts menu, any msgBox dialogs will not display correctly.

36.1 Adding features to “Hello World”

Next, we create a new script that makes changes to the Illustrator document you created with your first script. Our
second script demonstrates how to:
• Get the active document.
• Get the width of the active document.
• Resize the text frame to match the document’s width.

89
Illustrator Scripting Guide, Release 0.0.1

If you already closed the Illustrator document, run your first script again to create a new document.
Follow these steps:
1. Copy the following script into your text editor, and save the file:

Set appRef = CreateObject("[Link]")


'Get the active document
Set documentRef = [Link]
Set sampleText = [Link](1)
' Resize the TextFrame item to match the document width
[Link] = [Link]
[Link] = 0

2. Run the script.

90 Chapter 36. Your first Illustrator script


CHAPTER

THIRTYSEVEN

ACCESSING AND REFERENCING OBJECTS

When you write a script, you must first decide which file, or Document, the script should act on. Through the
Application object, the script can create a new document, open an existing document, or act on a document that
is already open.
The script can create new objects in the document, operate on objects that the user selected, or operate on objects in
one of the object collections. The following sections illustrate techniques for accessing, referencing, and manipulating
Illustrator objects

37.1 Obtaining objects from collections

Generally, to obtain a reference to a specific object, you can navigate the containment hierarchy. For example, to use
the myPath variable to store a reference to the first PathItem in the second layer of the active document

Set myPath = [Link](2).PathItems(1)

The following scripts demonstrate how to reference an object as part of a document:

Set documentRef = [Link]

Set pageItemRef = [Link](1)

In the script below, the variable pageItemRef will not necessarily refer to the same object as the above script, since
this script includes a reference to a layer:

Set documentRef = [Link]


Set pageItemRef = [Link](1).PageItems(1)

VBScript indexes start at 1 for object collections; however, VBScript allows you to specify whether array indexes start
at 1 or 0. For information on specifying the index start number for arrays, see any VBScript textbook or tutorial.

91
Illustrator Scripting Guide, Release 0.0.1

37.2 Creating new objects

You can use a script to create new objects. To create objects that are available from collection objects, use the collection
object’s Add method:

Set myDoc = [Link]()

Set myLayer = [Link]()

Some collection objects do not have an Add method. To create an object of this type, define a variable and use the
CreateObject method. For example, the following code creates a new CMYKColor object using the variable name
newColor

Set newColor = CreateObject ("[Link]")

37.3 Working with selections

When the user makes a selection in a document, the selected objects are stored in the document’s selection property.
To access all selected objects in the active document

Set appRef = CreateObject ("[Link]")


Set documentRef = [Link]
selectedObjects = [Link]

Depending on what is selected, the selection property value can be an array of any type of art objects. To get or
manipulate the properties of the selected art items, you must retrieve the individual items in the array. To find out an
object’s type, use the typename property.
The following sample gets the first object in the array, then displays the object’s type

Set appRef = CreateObject ("[Link]")


Set documentRef = [Link]
selectedObjects = [Link]
Set topObject = selectedObjects(0)
MsgBox([Link])

The MsgBox method does not display a dialog when the script is run from the Illustrator Scripts menu (File > Scripts).
The first object in a selection array is the selected object that was last added to the page, not the last object selected.

37.3.1 Working with selections

To select an art object, the object’s Selected property.

92 Chapter 37. Accessing and referencing objects


CHAPTER

THIRTYEIGHT

WORKING WITH TEXT FRAMES

To create a text frame of a specific type in VBScript, use the TextFrames method that corresponds to the type of frame
you want to create::

Set rectRef = [Link](700, 50, 100, 100)

' Use the AreaText method to create the text frame


Set areaTextRef = [Link](rectRef)

38.1 Threaded frames

As in the Illustrator application, you can thread area text frames or path text frames.
To thread existing text frames, use the NextFrame or PreviousFrame property of the TextFrames object.
When copying the following script to your script editor, place the value of the Contents property on one line. The
long-line character (_) is not valid within a string value.

Set appRef = CreateObject("[Link]")


Set myDoc = [Link]
Set myPathItem1 = [Link](244, 64, 82, 76)
Set myTextFrame1 = [Link](myPathItem1)
[Link] = "This is two text frames linked together as one story, with␣
˓→text flowing from the first to the last."

Set myPathItem2 = [Link](144, 144, 42, 116)


Set myTextFrame2 = [Link](myPathItem2)

'Use the NextFrame property to thread the frames


[Link] = myTextFrame2

[Link]()

93
Illustrator Scripting Guide, Release 0.0.1

38.1.1 Threaded frames make one story object

Threaded frames make a single story object. To observe this, run the following VBScript after running the script above.

Set myDoc = [Link]


myMsg = "alert(""There are " & CStr([Link]) & " text frames. "")"
[Link] myMsg
myMsg = "alert(""There are " & CStr([Link]) & " storiess. "")"
[Link] myMsg

94 Chapter 38. Working with text frames


CHAPTER

THIRTYNINE

CREATING PATHS AND SHAPES

This section explains how to create items that contain paths.

39.1 Paths

To create line or a freeform path, specify a series of path points, as a series of x-y coordinates or PathPoint objects.
Using x-y coordinates limits the path to straight segments. To created a curved path, you must create PathPoint
objects. A path can comprise a combination of page coordinates and PathPoint objects.

39.1.1 Specifying a series of x-y coordinates

To specify a path using page-coordinate pairs, use the entire path property of the PathItems object. The following
script specifies three pairs of x-y coordinates, to create a path with three points

Set appRef = CreateObject ("[Link]")

Set firstPath = [Link]


[Link] = True
[Link](Array(Array(220, 475),Array(375, 300),Array(200, 300)))

39.1.2 Using path point objects

To create a PathPoint object, you must define three values for the point.
• A fixed anchor point, which is the point on the path.
• A pair of direction points— left direction and right direction —which allow you to control the path
segment’s curve.
You define each property as an array of page coordinates in the format (Array (x,y)):
• If all three properties of a PathPoint object have the same coordinates, and the properties of the next PathPoint
in the line are equal to each other, you create a straight-line segment.
• If two or more properties in a PathPoint object hold different values, the segment connected to the point is
curved.
To create a path or add points to an existing path using PathPoint objects, create a PathItem object, then add the
path points as child objects in the PathItem

95
Illustrator Scripting Guide, Release 0.0.1

Set appRef = CreateObject ("[Link]")

Set firstPath = [Link]


[Link] = true
Set newPoint = [Link]
'Using identical coordinates creates a straight segment
[Link] = Array(75, 300)
[Link] = Array(75, 300)
[Link] = Array(75, 300)

Set newPoint2 = [Link]


[Link] = Array(175, 250)
[Link] = Array(175, 250)
[Link] = Array(175, 250)

Set newPoint3 = [Link]


'Using different coordinates creates a curve
[Link] = Array(275, 290)
[Link] = Array(135, 150)
[Link] = Array(155, 150)

39.1.3 Combining path point types

The following script sample creates a path with three points


Set appRef = CreateObject("[Link]")
Set myDoc = [Link]
Set myLine = [Link]
[Link] = True
[Link]( Array( Array(320, 475), Array(375, 300)))

' Append another point to the line


Set newPoint = [Link]
'Using identical coordinates creates a straight segment
[Link] = Array(220, 300)
[Link] = Array(220, 300)
[Link] = Array(220, 300)

39.2 Shapes

To create a shape, you use the object that corresponds to the shape’s name (like ellipse, rectangle, or polygon),
and use the object’s properties to specify the shape’s position, size, and other information like the number of sides in a
polygon.
Remember:
• The scripting engine processes all measurements and page coordinates as points. For details, see Measurement
Units.
• x and y coordinates are measured from the bottom-left corner of the document, as indicated in the Info panel in
the Illustrator application. For details, see Page-item positioning and dimensions.

96 Chapter 39. Creating paths and shapes


Illustrator Scripting Guide, Release 0.0.1

39.2.1 Creating a rectangle

Consider the following sample

Set appRef = CreateObject("[Link]")


Set frontDocument = [Link]
' Create a new rectangle with
' top = 144, left side = 144, width = 72, height = 144
Set newRectangle = [Link](144,144,72,144)

The sample creates a rectangle with these properties:


• The top of the rectangle is 2 inches (144 points) from the bottom edge of the page.
• The left edge is 2 inches (144 points) from the left edge of the page.
• The rectangle is 1 inch (72 points) wide and 2 inches (144 points) long.

39.2.2 Creating a polygon

Consider the following sample

Set appRef = CreateObject("[Link]")


Set frontDocument = [Link]
' Create a new polygon with
' top = 144, left side = 288, width = 72, height = 144
Set newPolygon = [Link](144,288,72,7)

The sample creates a polygon with these properties:


• The center point of the object is inset is 2 inches (144 points) on the horizontal axis and 4 inches (288 points) on
the vertical axis.
• The polygon has 7 sides.
• The length of the radius from the center point to each corner is 1 inch (72 points).

39.2. Shapes 97
Illustrator Scripting Guide, Release 0.0.1

98 Chapter 39. Creating paths and shapes


CHAPTER

FORTY

WORKING WITH ENUMERATION VALUES

Properties that use enumeration values in VBScript use a numeral rather than a text value. For example, the Orientation
property of the TextFrame object specifies whether text content in the text frame is horizontal or vertical. The property
uses the aiTextOrientation enumeration, which has two possible values, aiHorizontal and aiVertical.
To find the numeral values of enumerations, use either of the following:
• The object browser in your scripting editor environment. See Viewing the VBScript object model.
• The Adobe lllustrator CC 2017 Scripting Reference: VBScript, which lists the numeral values directly after the
constant value in the “Enumerations” chapter at the end of the book. The following example is from that table:

Enumeration type Values What it means


AiTextOrientation aiHorizontal = 0 aiVertical = 1 The orientation of text in a text frame

The following sample specifies vertical text orientation

Set appRef = CreateObject ("[Link]")


Set docRef = [Link]
Set textRef = [Link]
[Link] = "This is some text content."
[Link] = 50
[Link] = 700
[Link] = 1

Generally, it is considered good scripting practice to place the text value in a comment following the numeral value, as
in the following sample statement:

[Link] = 1 ' aiVertical

99
Illustrator Scripting Guide, Release 0.0.1

100 Chapter 40. Working with enumeration values


CHAPTER

FORTYONE

WORKING WITH THE PERSPECTIVE GRID

The Perspective Grid is a new feature in lllustrator CC 2017 that enables you to create and manipulate art in a spatial
environment using established laws of perspective. Enable Perspective Grid using the View > Perspective Grid menu
or the perspective tools in the toolbar.
The SDK provides an API for working with the perspective grid programmatically, and your scripts have some access
to this API. A script can:
• Set a the default grid parameters using preset values.
• Show or hide the grid.
• Set the active plane.
• Draw an object in perspective on the active plane.
• Bring an object into perspective.

41.1 Use perspective presets

Illustrator provides default grid-parameter presets for one-point, two-point, and three-point perspectives. The presets
are named "[1P-NormalView]", "[2P-NormalView]", and "[3P-NormalView]".
The script shows how to select the two-point perspective preset programmatically:

Set appRef = CreateObject ("[Link]")

Rem Create a new document


Set docRef = [Link]()

Rem Select the default two-point perspective preset


[Link]("[2P-Normal View]")

You can create new perspective presets, export presets to files, and import presets from files. These scripts shows how
to export and import presets:

Set appRef = CreateObject ("[Link]")


Rem Create a new document
Set docRef = [Link]()
Rem Export perspective presets to a file
[Link]("C:/scripting/PGPresetsExported")

(continues on next page)

101
Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)


Set appRef = CreateObject ("[Link]")
Rem Create a new document
Set docRef = [Link]()
Rem Import perspective presets from a file
[Link]("C:/scripting/PGPresets")

41.2 Show or hide the grid

This script shows or hides the Perspective Grid programmatically:

Set appRef = CreateObject ("[Link]")

Rem Create a new document

Set docRef = [Link]()

Rem Show the Perspective Grid defined in the document


[Link]();

Rem Hide the Perspective Grid defined in the document


[Link]();

41.3 Set the active plane

The perspective grid plane types are:

Left plane aiLEFTPLANE (1)


Right plane aiRIGHTPLANE (2)
Floor plane aiFLOORPLANE (3)
Invalid plane aiNOPLANE (4)

For a one-point perspective grid, only the left and floor plane are valid.
This script sets the active perspective plane to the left plane:

Set appRef = CreateObject ("[Link]")

Rem Create a new document


Set docRef = [Link]()

Rem Set left plane as the active plane


[Link](1) 'aiLEFTPLANE

102 Chapter 41. Working with the perspective grid


Illustrator Scripting Guide, Release 0.0.1

41.4 Draw on a perspective grid

When the Perspective Grid is on, drawing methods allow you to draw or operate on objects in perspective. This script
creates a new document, shows a two-point perspective grid, and draws art objects on the left plane

Set appRef = CreateObject ("[Link]")

Rem Create a new document


Set docRef = [Link]()

Rem Select the default two point perspective preset


[Link]("[2P-Normal View]")

Rem Display the perspective grid defined in the document


[Link]()

Rem Check if active plane is set to left, otherwise set it to left


If [Link]() <> 1 Then
[Link](1) 'aiLEFTPLANE
End If

Rem Draw rectangle in perspective, then resize to 200% and move


Set pathItemRect = [Link](30, -30, 30, 30, False)

call [Link](200, 200, True, False, False, False, 100, 2)


call [Link](-420, 480)

Rem Draw ellipse in perspective


Set pathItemEllipse = [Link](60, -60, 30, 30, False, True)

Rem Draw rounded rectangle in perspective


Set pathItemRRect = [Link](90, -90, 30, 30, 10, 10, False)

Rem Draw polygon in perspective


Set pathItemPoly = [Link](-105, 105, 15, 7, False)

Rem Draw star in perspective


Set pathItemStar = [Link](-135, 135, 15, 10, 6, False)

Rem Draw path in perspective


Set newPath = [Link]()
[Link](Array(Array(0,0),Array(60,0),Array(30,45),Array(90,110)))

41.4. Draw on a perspective grid 103


Illustrator Scripting Guide, Release 0.0.1

41.5 Bring objects into perspective

If an art object is not in perspective, use the bringInPerspective() method to bring it into perspective and place it
on a plane.
This script creates a new document, draws an art object, and brings it into perspective on a three-point perspective grid

Set appRef = CreateObject ("[Link]")

Rem Create a new document


Set docRef = [Link]()

Rem Draw ellipse


Set pathItemEllipse = [Link](60, -60, 30, 30, False, True)

Rem Draw polygon


Set pathItemPoly = [Link](-105, 105, 15, 7, False)

Rem Draw star


Set pathItemStar = [Link](-135, 135, 15, 10, 6, False)

Rem Select the default three-point perspective preset


[Link]("[3P-Normal View]")

Rem Display the perspective grid defined in the document


[Link]()

Rem Check if active plane is set to left, otherwise set it to left


If [Link]() <> 1 Then
[Link](1) 'aiLEFTPLANE
End If

Rem Bring the ellipse to the active plane (left plane)


Call [Link](100,100, 1) 'aiLEFTPLANE

Rem Bring the polygon to the right plane


Call [Link](100,-100,2) 'aiRIGHTPLANE

Rem Bring the star to the floor plane


Call [Link](100,100,3) 'aiFLOORPLANE

104 Chapter 41. Working with the perspective grid


CHAPTER

FORTYTWO

SCRIPTING CONSTANTS

This chapter lists and describes the enumerations defined for use with Illustrator JavaScript properties and methods.

42.1 AlternateGlyphsForm

The alternate glyphs form of text.

Value Description
[Link] Defaultform
[Link] Traditional
[Link] Expert
AlternateGlyphsForm.JIS78FORM JIS78FORM
AlternateGlyphsForm.JIS83FORM JIS83FORM
[Link] Half Width
[Link] Third Width
[Link] Quarter Width
[Link] Full Width
[Link] Proportional Width
AlternateGlyphsForm.JIS90FORM JIS90FORM
AlternateGlyphsForm.JIS04FORM JIS04FORM

Example

[Link][i].[Link] ==␣
˓→[Link];

[Link][i].[Link] ==␣
˓→[Link]

105
Illustrator Scripting Guide, Release 0.0.1

42.2 AntiAliasingMethod

The type of antialiasing method used in the rasterization.

Value Description
[Link] No antialiasing is allowed.
[Link] Optimize for the art object.
[Link] Optimize for the type object.

42.3 ArtClippingOption

How the art should be clipped during output.

Value Description
[Link] Output size is the size of the artwork.
[Link] Output size is the size of the artboard.
[Link] Output size is the size of the crop area.

42.4 AutoCADColors

Value Description
AutoCADColors.Max8Colors Max 8 CColors
AutoCADColors.Max16Colors Max 16 Colors
AutoCADColors.Max256Colors Max 25 6Colors
[Link] True Colors

42.5 AutoCADCompatibility

Value Description
AutoCADCompatibility.AutoCADRelease13 Release 13
AutoCADCompatibility.AutoCADRelease18 Release 18
AutoCADCompatibility.AutoCADRelease14 Release 14
AutoCADCompatibility.AutoCADRelease21 Release 21
AutoCADCompatibility.AutoCADRelease15 Release 15
AutoCADCompatibility.AutoCADRelease24 Release 24

106 Chapter 42. Scripting Constants


Illustrator Scripting Guide, Release 0.0.1

42.6 AutoCADExportFileFormat

Value Description
[Link] DXF
[Link] DWG

42.7 AutoCADExportOption

Value Description
[Link] Preserve Appearance
[Link] Maximize Editability

42.8 AutoCADGlobalScaleOption

Value Description
[Link] Original Size
[Link] Scale by Value
[Link] Fit Artboard

42.9 AutoCADRasterFormat

Value Description
[Link] PNG
[Link] JPEG

42.10 AutoCADUnit

Value Description
[Link] Points
[Link] Picas
[Link] Inches
[Link] Millimeters
[Link] Centimeters
[Link] Pixels

42.6. AutoCADExportFileFormat 107


Illustrator Scripting Guide, Release 0.0.1

42.11 AutoKernType

The auto kern type.

Value Description
[Link] None
[Link] Auto
[Link] Optical
[Link] Metrics

42.12 AutoLeadingType

The auto leading type.

Value Description
[Link] Bottom to Bottom
[Link] Top to Top

42.13 BaselineDirectionType

The baseline direction type.

Value Description
[Link] Standard
[Link] Vertical Rotated
[Link] TateChuYoko

42.14 BlendAnimationType

Value Description
[Link] In Build
[Link] None
[Link] In Sequence

108 Chapter 42. Scripting Constants


Illustrator Scripting Guide, Release 0.0.1

42.15 BlendModes

The blend mode used when compositing an object.

Value Description
[Link] Color
[Link] Color Burn
[Link] Color Dodge
[Link] Darken
[Link] Difference
[Link] Exclusion
[Link] Hard Light
[Link] Hue
[Link] Lighten
[Link] Luminosity
[Link] Multiply
[Link] Normal
[Link] Overlay
[Link] Saturation
[Link] Screen
[Link] Soft Light

42.16 BlendsExpandPolicy

Policy used by FXG file format to expand blends.

Value Description
[Link] Automatically convert blends
[Link] Rasterize blends

42.17 BurasagariTypeEnum

The Burasagari type.

Value Description
[Link] Forced
[Link] None
[Link] Standard

42.15. BlendModes 109


Illustrator Scripting Guide, Release 0.0.1

42.18 CaseChangeType

The case change type.

Value Description
[Link] Lowercase ("hello world")
[Link] Sentence case ("Hello world")
[Link] Title case ("Hello World")
[Link] Uppercase ("HELLO WORLD")

42.19 ColorConversion

The color conversion policy.

Value Description
[Link] Color Conversion Repurpose
[Link] Color Conversion to Dest
[Link] None

42.20 ColorConvertPurpose

The purpose of color conversion using the ConvertSampleColor method of the Application class.

Value Description
[Link] Default
[Link] Export
[Link] Preview
[Link] Dummy

42.21 ColorDestination

Destination profile

Value Description
[Link] Doc CMYK
[Link] Doc RGB
[Link] Profile
[Link] Working CMYK
[Link] Working RGB
[Link] None

110 Chapter 42. Scripting Constants


Illustrator Scripting Guide, Release 0.0.1

42.22 ColorDitherMethod

The method used to dither colors in exported GIF and PNG8 images.

Value Description
[Link] Diffusion
[Link] Noise
[Link] No Reduction
[Link] Pattern Dither

42.23 ColorModel

The color model to use.

Value Description
[Link] Process
[Link] Registration
[Link] Spot

42.24 ColorProfile

Value Description
[Link] Include All Profile
[Link] Include Dest Profile
[Link] Include RGB Profile
[Link] Leave Profile Unchanged
[Link] None

42.25 ColorReductionMethod

The method used to reduce the number of colors in exported GIF and PNG8 images.

Value Description
[Link] Adaptive
[Link] Selective
[Link] Perceptual
[Link] Web

42.22. ColorDitherMethod 111


Illustrator Scripting Guide, Release 0.0.1

42.26 ColorType

The color specification for an individual color.

Value Description
[Link] Cmyk
[Link] Gradient
[Link] Gray
[Link] Pattern
[Link] Rgb
[Link] Spot
[Link] None

42.27 Compatibility

The version of the Illustrator file to create when saving an EPS or Illustrator file

Value Description
Compatibility.ILLUSTRATOR8 Illustrator 8
Compatibility.ILLUSTRATOR9 Illustrator 9
Compatibility.ILLUSTRATOR10 Illustrator 10
Compatibility.ILLUSTRATOR11 Illustrator 11
Compatibility.ILLUSTRATOR12 Illustrator 12
Compatibility.ILLUSTRATOR13 Illustrator 13
Compatibility.ILLUSTRATOR14 Illustrator 14
Compatibility.ILLUSTRATOR15 Illustrator 15
Compatibility.ILLUSTRATOR16 Illustrator 16
Compatibility.ILLUSTRATOR17 Illustrator 17
Compatibility.ILLUSTRATOR19 Illustrator 19
Compatibility.JAPANESEVERSION3 Japanese Version 3

42.28 CompressionQuality

The quality of bitmap compression used when saving a PDF file

112 Chapter 42. Scripting Constants


Illustrator Scripting Guide, Release 0.0.1

Value Description
CompressionQuality.AUTOMATICJPEG2000HIGH todo
CompressionQuality.AUTOMATICJPEG2000LOSSLESS todo
CompressionQuality.AUTOMATICJPEG2000LOW todo
CompressionQuality.AUTOMATICJPEG2000MAXIMUM todo
CompressionQuality.AUTOMATICJPEG2000MEDIUM todo
CompressionQuality.AUTOMATICJPEG2000MINIMUM todo
[Link] todo
[Link] todo
[Link] todo
[Link] todo
[Link] todo
CompressionQuality.JPEG2000HIGH todo
CompressionQuality.JPEG2000LOSSLESS todo
CompressionQuality.JPEG2000LOW todo
CompressionQuality.JPEG2000MAXIMUM todo
CompressionQuality.JPEG2000MEDIUM todo
CompressionQuality.JPEG2000MINIMUM todo
[Link] todo
[Link] todo
[Link] todo
[Link] todo
[Link] todo
CompressionQuality.ZIP4BIT todo
CompressionQuality.ZIP8BIT todo
[Link] todo

42.29 CoordinateSystem

The coordinate system used by Illustrator

Value Description
[Link] todo
[Link] todo

42.30 CropOptions

The style of a document’s cropping box

Value Description
[Link] Japanese
[Link] Standard

42.29. CoordinateSystem 113


Illustrator Scripting Guide, Release 0.0.1

42.31 DocumentArtboardLayout

The layout of in the new document.

Value Description
[Link] todo
[Link] todo
[Link] todo
[Link] todo
[Link] todo
[Link] todo
[Link] todo

42.32 DocumentColorSpace

The color space of a document

Value Description
[Link] CMYK
[Link] RGB

42.33 DocumentLayoutStyle

Layout style for the document

Value Description
[Link] todo
[Link] todo
[Link] todo
[Link] todo
[Link] todo

42.34 DocumentPresetType

The preset types available for new documents.

114 Chapter 42. Scripting Constants


Illustrator Scripting Guide, Release 0.0.1

Value Description
[Link] Basic CMYK
[Link] Basic RGB
[Link] Mobile
[Link] Print
[Link] Video
[Link] Web

42.35 DocumentPreviewMode

The document preview mode.

Value Description
[Link] Default
[Link] Overprint
[Link] Pixel

42.36 DocumentRasterResolution

The preset document raster resolution.

Value Description
[Link] Screen Resolution
[Link] High Resolution
[Link] Medium Resolution

42.37 DocumentTransparencyGrid

Document transparency grid colors.

Value Description
[Link] Blue
[Link] Dark
[Link] Green
[Link] Light
[Link] Medium
[Link] None
[Link] Orange
[Link] Purple
[Link] Red

42.35. DocumentPreviewMode 115


Illustrator Scripting Guide, Release 0.0.1

42.38 DocumentType

The file format used to save a file.

Value Description
[Link] EPS
[Link] FXG
[Link] Illustrator
[Link] PDF

42.39 DownsampleMethod

Value Description
[Link] Average Downsample
[Link] Bicubic Downsample
[Link] No Downsample
[Link] Subsample

42.40 ElementPlacement

Value Description
[Link] Inside
[Link] Place After
[Link] Place At Beginning
[Link] Place At End
[Link] Place Before

42.41 EPSPostScriptLevelEnum

Value Description
EPSPostScriptLevelEnum.LEVEL2 Level 2
EPSPostScriptLevelEnum.LEVEL3 Level 3

116 Chapter 42. Scripting Constants


Illustrator Scripting Guide, Release 0.0.1

42.42 EPSPreview

The preview image format used when saving an EPS file

Value Description
[Link] todo
[Link] todo
[Link] todo
[Link] todo

42.43 ExportType

The file format used to export a file

Value Description
[Link] AutoCAD
[Link] FLASH
[Link] GIF
[Link] JPEG
[Link] Photoshop
ExportType.PNG24 PNG24
ExportType.PNG8 PNG8
[Link] SVG
[Link] TIFF

42.44 FigureStyleType

Value Description
[Link] todo
[Link] todo
[Link] todo
[Link] todo
[Link] todo

42.42. EPSPreview 117


Illustrator Scripting Guide, Release 0.0.1

42.45 FiltersPreservePolicy

The filters preserve policy used by the FXG file format.

Value Description
[Link] todo
[Link] todo
[Link] todo

42.46 FlashExportStyle

The method used to convert Illustrator images when exporting files

Value Description
[Link] todo
[Link] todo
[Link] todo
[Link] todo
[Link] todo

42.47 FlashExportVersion

Version for exported SWF file.

Value Description
FlashExportVersion.FlashVersion1 Version 1
FlashExportVersion.FlashVersion2 Version 2
FlashExportVersion.FlashVersion3 Version 3
FlashExportVersion.FlashVersion4 Version 4
FlashExportVersion.FlashVersion5 Version 5
FlashExportVersion.FlashVersion6 Version 6
FlashExportVersion.FlashVersion7 Version 7
FlashExportVersion.FlashVersion8 Version 8
FlashExportVersion.FlashVersion9 Version 9

118 Chapter 42. Scripting Constants


Illustrator Scripting Guide, Release 0.0.1

42.48 FlashImageFormat

The format used to store flash images.

Value Description
[Link] Lossless
[Link] Lossy

42.49 FlashJPEGMethod

The method used to store JPEG images.

Value Description
[Link] Optimized
[Link] Standard

42.50 FlashPlaybackSecurity

Value Description
[Link] Local
[Link] Network

42.51 FontBaselineOption

Value Description
[Link] todo
[Link] todo
[Link] todo

42.52 FontCapsOption

Value Description
[Link] All Caps
[Link] All Smallcaps
[Link] Normal Caps
[Link] Small Caps

42.48. FlashImageFormat 119


Illustrator Scripting Guide, Release 0.0.1

42.53 FontOpenTypePositionOption

Value Description
[Link] Denominator
[Link] Numerator
[Link] Opentype Default
[Link] Opentype Subscript
[Link] Opentype Superscript

42.54 FontSubstitutionPolicy

Value Description
[Link] Device
[Link] Oblique
[Link] Tint

42.55 FXGVersion

The FXG file-format version.

Value Description
FXGVersion.VERSION1PT0 Version 1 PT0
FXGVersion.VERSION2PT0 Version 2 PT0

42.56 GradientsPreservePolicy

The gradients preserve policy used by the FXG file format.

Value Description
[Link] Automaticaly Convert Gradients
[Link] Keep Gradients Editable

120 Chapter 42. Scripting Constants


Illustrator Scripting Guide, Release 0.0.1

42.57 GradientType

The type of gradient.

Value Description
[Link] Linear
[Link] Radial

42.58 ImageColorSpace

The color space of a raster item or an exported file

Value Description
[Link] CMYK
[Link] DeviceN
[Link] Grayscale
[Link] Indexed
[Link] LAB
[Link] RGB
[Link] Separation

42.59 InkPrintStatus

Value Description
[Link] Convert Ink
[Link] Enable Ink
[Link] Disable Ink

42.60 InkType

Value Description
[Link] Black Ink
[Link] Custom Ink
[Link] Cyan Ink
[Link] Magenta Ink
[Link] Yellow Ink

42.57. GradientType 121


Illustrator Scripting Guide, Release 0.0.1

42.61 JavaScriptExecutionMode

Value Description
[Link] Before Running
[Link] On Runtime Error
[Link] Never

42.62 Justification

The alignment or justification for a paragraph of text.

Value Description
[Link] Center
[Link] Full Justify
[Link] Full Justify Last Line Center
[Link] Full Justify Last Line Left
[Link] Full Justify Last Line Right
[Link] Left
[Link] Right

42.63 KinsokuOrderEnum

Value Description
[Link] todo
[Link] todo
[Link] todo

42.64 KnockoutState

The type of knockout to use on a page item.

Value Description
[Link] Disabled
[Link] Enabled
[Link] Inherited
[Link] Unknown

122 Chapter 42. Scripting Constants


Illustrator Scripting Guide, Release 0.0.1

42.65 LanguageType

Value Description
[Link] todo
[Link] todo
[Link] todo
[Link] todo
[Link] todo
[Link] todo
[Link] todo
[Link] todo
[Link] todo
LanguageType.DUTCH2005REFORM todo
[Link] todo
[Link] todo
LanguageType.GERMAN2006REFORM todo
[Link] todo
[Link] todo
[Link] todo
[Link] todo
[Link] todo
[Link] todo
[Link] todo
[Link] todo
[Link] todo
[Link] todo
[Link] todo
[Link] todo
[Link] todo
[Link] todo
[Link] todo
[Link] todo
[Link] todo
LanguageType.SWISSGERMAN2006REFORM todo
[Link] todo
[Link] todo
[Link] todo

42.66 LayerOrderType

Value Description
[Link] Top Down
[Link] Bottom Up

42.66. LayerOrderType 123


Illustrator Scripting Guide, Release 0.0.1

42.67 LibraryType

Illustrator library type.

Value Description
[Link] Brushes
[Link] Graphic Styles
[Link] Illustrator Artwork
[Link] Swatches
[Link] Symbols

42.68 MonochromeCompression

The type of compression to use on a monochrome bitmap item when saving a PDF file.

Value Description
MonochromeCompression.CCIT3 CCIT3
MonochromeCompression.CCIT4 CCIT4
[Link] MONOZIP
[Link] None
[Link] RUNLENGTH

42.69 OutputFlattening

How transparency should be flattened when saving EPS and Illustrator file formats with compatibility set to versions
of Illustrator earlier than Illustrator 10

Value Description
[Link] Preserve Appearance
[Link] Preserve Paths

42.70 PageMarksTypes

Value Description
[Link] Japanese
[Link] Roman

124 Chapter 42. Scripting Constants


Illustrator Scripting Guide, Release 0.0.1

42.71 PathPointSelection

Which points, if any, of a path are selected.

Value Description
[Link] todo
[Link] todo
[Link] todo
[Link] todo
[Link] todo

42.72 PDFBoxType

Value Description
[Link] todo
[Link] todo
[Link] todo
[Link] todo
[Link] todo
[Link] todo

42.73 PDFChangesAllowedEnum

Value Description
PDFChangesAllowedEnum.CHANGE128ANYCHANGES todo
PDFChangesAllowedEnum.CHANGE128COMMENTING todo
PDFChangesAllowedEnum.CHANGE128EDITPAGE todo
PDFChangesAllowedEnum.CHANGE128FILLFORM todo
PDFChangesAllowedEnum.CHANGE128NONE todo
PDFChangesAllowedEnum.CHANGE40ANYCHANGES todo
PDFChangesAllowedEnum.CHANGE40COMMENTING todo
PDFChangesAllowedEnum.CHANGE40NONE todo
PDFChangesAllowedEnum.CHANGE40PAGELAYOUT todo

42.71. PathPointSelection 125


Illustrator Scripting Guide, Release 0.0.1

42.74 PDFCompatibility

The version of the Acrobat file format to create when saving a PDF file

Value Description
PDFCompatibility.ACROBAT4 Acrobat 4
PDFCompatibility.ACROBAT5 Acrobat 5
PDFCompatibility.ACROBAT6 Acrobat 6
PDFCompatibility.ACROBAT7 Acrobat 7
PDFCompatibility.ACROBAT8 Acrobat 8

42.75 PDFOverprint

Value Description
[Link] Discard Pdf Overprint
[Link] Preserve Pdf Overprint

42.76 PDFPrintAllowedEnum

Value Description
PDFPrintAllowedEnum.PRINT128HIGHRESOLUTION 128 High Resolution
PDFPrintAllowedEnum.PRINT128LOWRESOLUTION 128 Low Resolution
PDFPrintAllowedEnum.PRINT128NONE 128 None
PDFPrintAllowedEnum.PRINT40HIGHRESOLUTION 40 High Resolution
PDFPrintAllowedEnum.PRINT40NONE 40 None

42.77 PDFTrimMarkWeight

Value Description
PDFTrimMarkWeight.TRIMMARKWEIGHT0125 Weight 0125
PDFTrimMarkWeight.TRIMMARKWEIGHT025 Weight 025
PDFTrimMarkWeight.TRIMMARKWEIGHT05 Weight 05

126 Chapter 42. Scripting Constants


Illustrator Scripting Guide, Release 0.0.1

42.78 PDFXStandard

Value Description
PDFXStandard.PDFX1A2001 PDFX1A2001
PDFXStandard.PDFX1A2003 PDFX1A2003
PDFXStandard.PDFX32002 PDFX32002
PDFXStandard.PDFX32003 PDFX32003
PDFXStandard.PDFX42007 PDFX42007
[Link] PDFXNONE

42.79 PerspectiveGridType

Value Description
[Link] One Point Perspective Grid Type
[Link] Two Point Perspective Grid Type
[Link] Three Point Perspective Grid Type
[Link] Invalid Perspective Grid Type

42.80 PerspectiveGridPlaneType

Value Description
[Link] Grid Left Plane Type
[Link] Grid Right Plane Type
[Link] Grid Floor Plane Type
[Link] Invalid Grid Plane Type

42.81 PhotoshopCompatibility

Value Description
PhotoshopCompatibility.Photoshop6 Photoshop 6
PhotoshopCompatibility.Photoshop8 Photoshop 8

42.78. PDFXStandard 127


Illustrator Scripting Guide, Release 0.0.1

42.82 PointType

The type of path point selected

Value Description
[Link] Corner
[Link] Smooth

42.83 PolarityValues

Value Description
[Link] Negative
[Link] Positive

42.84 PostScriptImageCompressionType

Value Description
[Link] todo
[Link] todo
[Link] todo

42.85 PrintArtworkDesignation

Value Description
[Link] All Layers
[Link] Visible Layers
[Link] Visible Printable Layers

42.86 PrintColorIntent

Value Description
[Link] todo
[Link] todo
[Link] todo
[Link] todo

128 Chapter 42. Scripting Constants


Illustrator Scripting Guide, Release 0.0.1

42.87 PrintColorProfile

Value Description
[Link] Custom Profile
[Link] Printer Profile
[Link] Oldstyle Profile
[Link] Source Profile

42.88 PrintColorSeparationMode

Value Description
[Link] Composite
[Link] Host-Based Separation
[Link] Inrip Separation

42.89 PrinterColorMode

Value Description
[Link] Black & White
[Link] Color
[Link] Grayscale

42.90 PrinterPostScriptLevelEnum

Value Description
PrinterPostScriptLevelEnum.PSLEVEL1 PS LEVEL 1
PrinterPostScriptLevelEnum.PSLEVEL2 PS LEVEL 2
PrinterPostScriptLevelEnum.PSLEVEL3 PS LEVEL 3

42.87. PrintColorProfile 129


Illustrator Scripting Guide, Release 0.0.1

42.91 PrinterTypeEnum

Value Description
[Link] Non Postscript Printer
[Link] Postscript Printer
[Link] Unknown

42.92 PrintFontDownloadMode

Value Description
[Link] Download None
[Link] Download Complete
[Link] Download Subset

42.93 PrintingBounds

Value Description
[Link] Artboard Bounds
[Link] Artwork Bounds

42.94 PrintOrientation

The artwork printing orientation.

Value Description
[Link] Auto Rotate
[Link] Landscape
[Link] Portrait
[Link] Reverse Landscape
[Link] Reverse Portrait

130 Chapter 42. Scripting Constants


Illustrator Scripting Guide, Release 0.0.1

42.95 PrintPosition

Value Description
[Link] Translate Bottom
[Link] Translate Bottom Left
[Link] Translate Bottom Right
[Link] Translate Center
[Link] Translate Left
[Link] Translate Right
[Link] Translate Top
[Link] Translate Top Left
[Link] Translate Top Right

42.96 PrintTiling

Value Description
[Link] Full Pages
[Link] Single Full Page
[Link] Imageable Areas

42.97 RasterizationColorModel

The color model for the rasterization.

Value Description
[Link] Bitmap
[Link] Default Color Model
[Link] Grayscale

42.98 RasterLinkState

The status of a raster item’s linked image if the image is stored externally

Value Description
[Link] Data From File
[Link] Data Modified
[Link] No Data

42.95. PrintPosition 131


Illustrator Scripting Guide, Release 0.0.1

42.99 RulerUnits

The default measurement units for the rulers of a document

Value Description
[Link] Centimeters
[Link] Qs
[Link] Inches
[Link] Pixels
[Link] Millimeters
[Link] Unknown
[Link] Picas
[Link] Points

42.100 SaveOptions

Save options provided when closing a document.

Value Description
[Link] Do Not Save Changes
[Link] Save Changes
[Link] Prompt To Save Changes

42.101 ScreenMode

The mode of display for a view.

Value Description
[Link] Desktop
[Link] Multi Window
[Link] Fullscreen

42.102 SpotColorKind

The custom color kind of a spot color.

Value Description
[Link] CMYK
[Link] LAB
[Link] RGB

132 Chapter 42. Scripting Constants


Illustrator Scripting Guide, Release 0.0.1

42.103 StrokeCap

The type of line capping for a path stroke.

Value Description
[Link] Butt
[Link] Round
[Link] Projecting

42.104 StrokeJoin

The type of joints for a path stroke.

Value Description
[Link] Bevel
[Link] Round
[Link] Miter

42.105 StyleRunAlignmentType

Value Description
[Link] Bottom
[Link] ICF Top
[Link] Center
[Link] Roman Baseline
[Link] ICF Bottom
[Link] Top

42.106 SVGCSSPropertyLocation

How should the CSS properties of the document be included in an exported SVG file

Value Description
[Link] Entities
[Link] Style Attributes
[Link] Presentation Attributes
[Link] Style Elements

42.103. StrokeCap 133


Illustrator Scripting Guide, Release 0.0.1

42.107 SVGDocumentEncoding

How should the text in the document be encoded when exporting an SVG file

Value Description
[Link] ASCII
SVGDocumentEncoding.UTF8 UTF8
SVGDocumentEncoding.UTF16 UTF16

42.108 SVGDTDVersion

SVG version compatibility for exported files

Value Description
SVGDTDVersion.SVG1_0 SVG1_0
SVGDTDVersion.SVG1_1 SVG1_1
SVGDTDVersion.SVGBASIC1_1 SVGBASIC1_1
SVGDTDVersion.SVGTINY1_1 SVGTINY1_1
SVGDTDVersion.SVGTINY1_1PLUS SVGTINY1_1PLUS
SVGDTDVersion.SVGTINY1_2 SVGTINY1_2

42.109 SVGFontSubsetting

What font glyphs should be included in exported SVG files

Value Description
[Link] All Glyphs
[Link] Glyphs Used Plus English
[Link] Common English
[Link] Glyphs Used Plus Roman
[Link] Common Roman
[Link] Glyphs Used
[Link] None

134 Chapter 42. Scripting Constants


Illustrator Scripting Guide, Release 0.0.1

42.110 SVGFontType

Types for fonts included in exported SVG files

Value Description
[Link] CEF Font
[Link] SVG Font
[Link] Outline Font

42.111 SymbolRegistrationPoint

Registration points for symbols.

Value Description
[Link] Bottom Left Point
[Link] Bottom Middle Point
[Link] Bottom Right Point
[Link] Center Point
[Link] Middle Left Point
[Link] Middle Right Point
[Link] Top Left Point
[Link] Top Middle Point
[Link] Top Right Point

42.112 TabStopAlignment

The alignment of a tab stop.

Value Description
[Link] Center
[Link] Decimal
[Link] Left
[Link] Right

42.110. SVGFontType 135


Illustrator Scripting Guide, Release 0.0.1

42.113 TextAntialias

The type of text anti-aliasing in a text art item.

Value Description
[Link] Crisp
[Link] None
[Link] Sharp
[Link] Strong

42.114 TextOrientation

The orientation of text in a text art item.

Value Description
[Link] Horizontal
[Link] Vertical

42.115 TextPreservePolicy

The text-preserve policy used by the FXG file format.

Value Description
[Link] Automatically Convert Text
[Link] Outline Text
[Link] Keep Text Editable
[Link] Rasterize Text

42.116 TextType

The type of text art displayed by this object.

Value Description
[Link] Area Text
[Link] Point Text
[Link] Path Text

136 Chapter 42. Scripting Constants


Illustrator Scripting Guide, Release 0.0.1

42.117 TIFFByteOrder

The byte order to use for an exported TIFF file.

Value Description
[Link] IBM PC
[Link] Macintosh

42.118 TracingModeType

Value Description
[Link] Black & White
[Link] Color
[Link] Gray

42.119 Transformation

The point to use as the anchor point about which an object is rotated, resized, or transformed.

Value Description
[Link] Bottom
[Link] Bottom Left
[Link] Bottom Right
[Link] Center
[Link] Document Origin
[Link] Left
[Link] Right
[Link] Top
[Link] Top Left
[Link] Top Right

42.120 TrappingType

Value Description
[Link] todo
[Link] todo
[Link] todo
[Link] todo

42.117. TIFFByteOrder 137


Illustrator Scripting Guide, Release 0.0.1

42.121 UserInteractionLevel

User interface settings

Value Description
[Link] Display Alerts
[Link] Don’t Display Alerts

42.122 VariableKind

What type of variables are included in the document.

Value Description
[Link] Graph
[Link] Image
[Link] Visibility
[Link] Textual
[Link] Unknown

42.123 ViewRasterType

The raster visualization mode for tracing.

Value Description
[Link] Adjusted Image
[Link] No Image
[Link] Original Image
[Link] Transparent Image

42.124 ViewVectorType

The vector visualization mode for tracing.

Value Description
[Link] No Tracing Result
[Link] Outlines
[Link] Outlines With Tracing
[Link] Tracing Result

138 Chapter 42. Scripting Constants


Illustrator Scripting Guide, Release 0.0.1

42.125 WariChuJustificationType

Value Description
[Link] Center
[Link] Left
[Link] Right
[Link] Warichu Auto Justify
[Link] Warichu Full Justify
[Link] Warichu Full Justify Last Line Center
[Link] Warichu Full Justify Last Line Left
[Link] Warichu Full Justify Last Line Right

42.126 ZOrderMethod

The method used to arrange an art item’s position in the stacking order of its parent group or layer, as specified with
the zOrder method

Value Description
[Link] Bring Forward
[Link] Send Backward
[Link] Bring To Front
[Link] Send To Back

42.125. WariChuJustificationType 139


Illustrator Scripting Guide, Release 0.0.1

140 Chapter 42. Scripting Constants


CHAPTER

FORTYTHREE

JAVASCRIPT OBJECT REFERENCE

This section presents all of the object classes in the type library.
Each class listing includes the following:
• Properties of the class, including value type, read-only status, and an explanation.
• Methods for the class. Constants and value types needed by the method are shown in bold face. Required terms
are shown in plain face. All items surrounded by brackets [ ] are optional.
• Notes to explain special issues.
• Sample code to help illustrate the syntax and typical workflow usage of the object class.
These examples are intended to be clear demonstrations of syntax, and do not show the best or most efficient way to
construct a JavaScript script.
Error checking, for instance, is generally brief or missing.
However, the examples can be combined and expanded to make scripts with greater functionality.

141
Illustrator Scripting Guide, Release 0.0.1

142 Chapter 43. JavaScript Object Reference


CHAPTER

FORTYFOUR

APPLICATION

app
Description
The Adobe® Illustrator® application object, referenced using the pre-defined global app object, which contains all
other Illustrator objects.

44.1 Properties

44.1.1 [Link]

[Link]
Description
The active (frontmost) document in Illustrator.
Type
Document

44.1.2 [Link]

[Link]
Description
If true, a web browser is available.
Type
Boolean; read-only.

143
Illustrator Scripting Guide, Release 0.0.1

44.1.3 [Link]

[Link]
Description
The application’s build number.
Type
String; read-only.

44.1.4 [Link]

[Link]
Description
The list of color-settings files currently available for use.
Type
Object; read-only.

44.1.5 [Link]

[Link]
Description
The coordinate system currently in use, document or artboard.
Type
CoordinateSystem

44.1.6 [Link]

[Link]
Description
The default color-settings file for the current application locale.
Type
File; read-only.

144 Chapter 44. Application


Illustrator Scripting Guide, Release 0.0.1

44.1.7 [Link]

[Link]
Description
The documents in the application.
Type
Documents

44.1.8 [Link]

[Link]
Description
The list of flattener style names currently available for use.
Type
Object; read-only.

44.1.9 [Link]

[Link]
Description
The amount of unused memory (in bytes) within the Illustrator partition.
Type
Number (long); read-only.

44.1.10 [Link]

[Link]
Description
The application’s locale.
Type
String; read-only.

44.1. Properties 145


Illustrator Scripting Guide, Release 0.0.1

44.1.11 [Link]

[Link]
Description
The application’s name (not related to the filename of the application file).
Type
String; read-only.

44.1.12 [Link]

[Link]
Description
If true, the paste operation maintains the layer structure.
Type
Boolean; read-only.

44.1.13 [Link]

[Link]
Description
The file path to the application.
Type
File; read-only.

44.1.14 [Link]

[Link]
Description
The list of preset PDF-options names available for use.
Type
Object; read-only.

146 Chapter 44. Application


Illustrator Scripting Guide, Release 0.0.1

44.1.15 [Link]

[Link]
Description
The list of PPD files currently available for use.
Type
Object; read-only.

44.1.16 [Link]

[Link]
Description
Illustrator’s preference settings.
Type
Preferences

44.1.17 [Link]

[Link]
Description
The list of installed printers.
Type
Array of Printer

44.1.18 [Link]

[Link]
Description
The list of preset printing-options names available for use.
Type
Object; read-only.

44.1. Properties 147


Illustrator Scripting Guide, Release 0.0.1

44.1.19 [Link]

[Link]
Description
The version of the Scripting plug-in.
Type
String; read-only.

44.1.20 [Link]

[Link]
Description
All currently selected objects in the active (frontmost) document.
Type
Array of Objects; read-only.

44.1.21 [Link]

[Link]
Description
The list of presets available for creating a new document.
Type
Object; read-only.

44.1.22 [Link]

[Link]
Description
The installed fonts.
Type
TextFonts

148 Chapter 44. Application


Illustrator Scripting Guide, Release 0.0.1

44.1.23 [Link]

[Link]
Description
The list of preset tracing-options names available for use.
Type
Array of Strings; read-only.

44.1.24 [Link]

[Link]
Description
The class name of the referenced object.
Type
String; read-only.

44.1.25 [Link]

[Link]
Description
What level of interaction with the user should be allowed when handling script commands.
Type
UserInteractionLevel

44.1.26 [Link]

[Link]
Description
The application’s version.
Type
String; read-only.

44.1. Properties 149


Illustrator Scripting Guide, Release 0.0.1

44.1.27 [Link]

[Link]
Description
If true, the application is visible.
Type
Boolean; read-only.

44.2 Methods

44.2.1 [Link]()

[Link]()
Description
Alerts the user.
Returns
Nothing.

44.2.2 [Link]()

[Link](matrix, secondMatrix)
Description
Joins two matrices together.
Parameters

Parameter Type Description


matrix Matrix First matrix
secondMatrix Matrix Second matrix

Returns
jsobjref/Matrix.

150 Chapter 44. Application


Illustrator Scripting Guide, Release 0.0.1

44.2.3 [Link]()

[Link](matrix, angle)
Description
Joins a rotation translation to a transformation matrix.
Parameters

Parameter Type Description


matrix Matrix Matrix
angle Number (double) Angle

Returns
jsobjref/Matrix.

44.2.4 [Link]()

[Link](matrix[, scaleX][, scaleY])


Description
Concatenates a scale translation to a transformation matrix.
Parameters

Parameter Type Description


matrix Matrix Matrix
scaleX Number (double), optional X Scale
scaleY Number (dobule), optional Y Scale

Returns
Matrix

44.2.5 [Link]()

[Link](matrix[, deltaX][, deltaY])


Description
Joins a translation to a transformation matrix.
Parameters

Parameter Type Description


matrix Matrix Matrix
deltaX Number (double), optional X Delta
deltaY Number (dobule), optional Y Delta

Returns

44.2. Methods 151


Illustrator Scripting Guide, Release 0.0.1

Matrix

44.2.6 [Link]()

[Link](sourceColorSpace, sourceColor, destColorSpace,


colorConvertPurpose[, sourceHasAlpha][, destHasAlpha])
Description
Converts a sample-component color from one color space to another.
Parameters

Parameter Type Description


sourceColorSpace ImageColorSpace Color space of source color
sourceColor ColorComponents Source color to convert
destColorSpace ImageColorSpace Destination color space
colorConvertPurpose ColorConvertPurpose The purpose of the convert
sourceHasAlpha Boolean, optional Whether the source has alpha
destHasAlpha Boolean, optional Whether the destination has alpha

Returns
Array of ColorComponents

44.2.7 [Link]()

[Link]()
Description
Copies current selection to the clipboard.
Returns
Nothing.

44.2.8 [Link]()

[Link]()
Description
Cuts current selection to the clipboard.
Returns
Nothing.

152 Chapter 44. Application


Illustrator Scripting Guide, Release 0.0.1

44.2.9 [Link]()

[Link](workspaceName)
Description
Deletes an existing workspace.
Parameters

Parameter Type Description


workspaceName String Name of workspace to delete

Returns
Boolean

44.2.10 [Link]()

[Link]()
Description
Returns an identity matrix.
Returns
Matrix

44.2.11 [Link]()

[Link](filePath)

Note: This functionality was added in Illustrator XX.X (CC2017)

Description
Returns whether the specified filePath is open
Parameters

Parameter Type Description


filePath String File path to check

Returns
Boolean

44.2. Methods 153


Illustrator Scripting Guide, Release 0.0.1

44.2.12 [Link]()

[Link](name)
Description
Gets detailed file information for specified PPD file.
Parameters

Parameter Type Description


name String File name to get info for

Returns
PPDFileInfo

44.2.13 [Link]()

[Link](presetType)
Description
Returns the full path to the application’s default document profile for the specified preset type.
Parameters

Parameter Type Description


presetType DocumentPresetType Preset type to get file of

Returns
File

44.2.14 [Link]()

[Link](preset)
Description
Retrieves the tracing-option settings from the template with a given preset name.
Parameters

Parameter Type Description


preset String Preset name to get settings from

Returns
DocumentPreset

154 Chapter 44. Application


Illustrator Scripting Guide, Release 0.0.1

44.2.15 [Link]()

[Link]([angle])
Description
Returns 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.

Parameters

Parameter Type Description


angle Number (double), optional Angle to get matrix of

Returns
Matrix

44.2.16 [Link]()

[Link]([scaleX][, scaleY])
Description
Returns 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.

Parameters

Parameter Type Description


scaleX Number (double), optional X scale to get matrix of
scaleY Number (double), optional Y scale to get matrix of

Returns
Matrix

44.2. Methods 155


Illustrator Scripting Guide, Release 0.0.1

44.2.17 [Link]()

[Link]()
Description
Gets the scriptable help group object that represents the search widget in the app bar.
Returns
Variant

44.2.18 [Link]()

[Link]([deltaX][, deltaY])
Description
Returns 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.

Parameters

Parameter Type Description


deltaX Number (double), optional X Delta
deltaY Number (dobule), optional Y Delta

Returns
Matrix

44.2.19 [Link]()

[Link](matrix)
Description
Inverts a matrix.
Parameters

Parameter Type Description


matrix Matrix Matrix to invert

Returns
Matrix

156 Chapter 44. Application


Illustrator Scripting Guide, Release 0.0.1

44.2.20 [Link]()

[Link](matrix, secondMatrix)
Description
Checks whether the two matrices are equal.
Parameters

Parameter Type Description


matrix Matrix First matrix to check
secondMatrix Matrix Second matrix to check

Returns
Boolean

44.2.21 [Link]()

[Link](matrix)
Description
Checks whether a matrix is singular and cannot be inverted.
Parameters

Parameter Type Description


matrix Matrix Matrix to check

Returns
Boolean

44.2.22 [Link]()

[Link](fileSpec)
Description
Loads color settings from specified file, or, if file is empty, turns color management off.
Parameters

Parameter Type Description


fileSpec File File to load settings from

Returns
Nothing.

44.2. Methods 157


Illustrator Scripting Guide, Release 0.0.1

44.2.23 [Link]()

[Link](file[, documentColorSpace][, options])


Description
Opens the specified document file.

Note: If you open a pre-Illustrator 9 document that contains both RGB and CMYK colors and documentColorSpace
is supplied, all colors are converted to the specified color space.
If the parameter is not supplied, Illustrator opens a dialog so the user can choose the color space.

Parameters

Parameter Type Description


file File File to open
documentColorSpace DocumentColorSpace, optional Color space of document
options anything todo

Returns
Document

44.2.24 [Link]()

[Link]()
Description
Pastes current clipboard content into the current document.
Returns
Nothing.

44.2.25 [Link]()

[Link]()
Description
Quits Illustrator.

Note: If the clipboard contains data, Illustrator may show a dialog prompting the user to save the data for other
applications.

Returns
Nothing.

158 Chapter 44. Application


Illustrator Scripting Guide, Release 0.0.1

44.2.26 [Link]()

[Link]()
Description
Redoes the most recently undone transaction.
Returns
Nothing.

44.2.27 [Link]()

[Link]()
Description
Forces Illustrator to redraw all its windows.
Returns
Nothing.

44.2.28 [Link]()

[Link]()
Description
Resets the current workspace.
Returns
Boolean

44.2.29 [Link]()

[Link](workspaceName)
Description
Saves a new workspace.
Parameters

Parameter Type Description


workspaceName String Name of workspace to save as

Returns
Boolean

44.2. Methods 159


Illustrator Scripting Guide, Release 0.0.1

44.2.30 [Link]()

[Link](pluginName, messageSelector, inputString)


Description
Sends a plug-in-defined command message to a plug-in with given input arguments, and returns the plug-in-defined
result string.
Parameters

Parameter Type Description


pluginName String Name of plugin to send message to
messageSelector String Message to send to the plugin
inputString String Data to pass into the command

Returns
String

44.2.31 [Link]()

[Link](fileSpec)
Description
Gets presets from the file.
Parameters

Parameter Type Description


fileSpec File File to get presets from

Returns
PrintPresetList

44.2.32 [Link]()

[Link](workspaceName)
Description
Switches to the specified workspace.
Parameters

Parameter Type Description


workspaceName String Name to switch to

Returns
Boolean

160 Chapter 44. Application


Illustrator Scripting Guide, Release 0.0.1

44.2.33 [Link]()

[Link](text)
Description
Translates the placeholder text to regular text (a way to enter Unicode points in hex values).
Parameters

Parameter Type Description


text String String to translate

Returns
String

44.2.34 [Link]()

[Link]()
Description
Undoes the most recent transaction.
Returns
Nothing.

44.3 Example

44.3.1 Duplicating the Active Document

// Duplicates any selected items from


// the active document into a new document.

var newItem;
var docSelected = [Link];

if ([Link] > 0) {
// Create a new document and move the selected items to it.
var newDoc = [Link]();
if ([Link] > 0) {
for (var i = 0; i < [Link]; i++) {
docSelected[i].selected = false;
newItem = docSelected[i].duplicate(newDoc, [Link]);
}
} else {
[Link] = false;
newItem = [Link](newDoc, [Link]);
(continues on next page)

44.3. Example 161


Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)


}
} else {
alert("Please select one or more art objects");
}

162 Chapter 44. Application


CHAPTER

FORTYFIVE

ARTBOARD

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

45.1 Properties

45.1.1 [Link]

[Link]
Description
Size and position of the artboard.
Type
Rect

45.1.2 [Link]

[Link]
Description
The unique identifying name of the artboard.
Type
String

163
Illustrator Scripting Guide, Release 0.0.1

45.1.3 [Link]

[Link]
Description
The parent of this object.
Type
Document; read-only.

45.1.4 [Link]

[Link]
Description
Ruler origin of the artboard, relative to the top left corner of the artboard.
Type
Point

45.1.5 [Link]

[Link]
Description
Pixel aspect ratio, used in ruler visualization if the units are pixels.
Range: 0.1 to 10.
Type
Number (double)

45.1.6 [Link]

[Link]
Description
Show center mark.
Type
Boolean

164 Chapter 45. Artboard


Illustrator Scripting Guide, Release 0.0.1

45.1.7 [Link]

[Link]
Description
Show cross hairs.
Type
Boolean

45.1.8 [Link]

[Link]
Description
Show title and action safe areas (for video).
Type
Boolean

45.1.9 [Link]

[Link]
Description
Read-only. The class name of this object.
Type
String

45.2 Methods

45.2.1 [Link]()

[Link]()
Description
Deletes this artboard object. You cannot remove the last artboard in a document.
Returns
Nothing.

45.2. Methods 165


Illustrator Scripting Guide, Release 0.0.1

166 Chapter 45. Artboard


CHAPTER

FORTYSIX

ARTBOARDS

artboards
Description
A collection of Artboard objects.

46.1 Properties

46.1.1 [Link]

[Link]
Description
The number of datasets in the collection
Type
Number; read-only.

46.1.2 [Link]

[Link]
Description
The name of the object that contains this dataset
Type
Artboard; read-only.

167
Illustrator Scripting Guide, Release 0.0.1

46.1.3 [Link]

[Link]
Description
The class name of the referenced object.
Type
String; read-only.

46.2 Methods

46.2.1 [Link]()

[Link](artboardRect)
Description
Creates a new Artboard object.
Parameters

Parameter Type Description


artboardRect Rect Artboard dimensions

Returns
Artboard

46.2.2 [Link]()

[Link]()
Description
Retrieves the index position of the active artboard in the document’s list.
Returns the 0-based index.
Returns
Number (long)

168 Chapter 46. Artboards


Illustrator Scripting Guide, Release 0.0.1

46.2.3 [Link]()

[Link](name)
Description
Gets the first element in the collection with the specified name.
Parameters

Parameter Type Description


name String Name of element to get

Returns
Artboard

46.2.4 [Link]()

[Link](artboardRect, index)
Description
Creates a new Artboard object and inserts it at the given index in the list.
Parameters

Parameter Type Description


artboardRect Rect Artboard dimensions
index Number (long) Index to insert artboard at

Returns
Nothing.

46.2.5 [Link]()

[Link](index)
Description
Deletes an artboard object. You cannot remove the last artboard in a document.
Parameters

Parameter Type Description


index Number (long) Index of artboard to remove

Returns
Nothing.

46.2. Methods 169


Illustrator Scripting Guide, Release 0.0.1

46.2.6 [Link]()

[Link](index)
Description
Makes a specific artboard active and makes it current in the iteration order.
Parameters

Parameter Type Description


index Number (long) Index of artboard to set active

Returns
Nothing.

170 Chapter 46. Artboards


CHAPTER

FORTYSEVEN

BRUSH

[Link][index
Description
A brush in an Illustrator document. Brushes are contained in documents. Additional brushes may be created by the
user within Illustrator. You can access brushes within a script, but you cannot create them.

47.1 Properties

47.1.1 [Link]

[Link][index].name
Description
The name of the brush
Type
String

47.1.2 [Link]

[Link][index].parent
Description
The document that contains this brush.
Type
Document; read-only.

171
Illustrator Scripting Guide, Release 0.0.1

47.1.3 [Link]

[Link][index].typename
Description
The class name of the referenced object.
Type
String; read-only.

47.2 Methods

47.2.1 [Link]()

[Link][index].applyTo(artItem)
Description
Applies the brush to a specific art item.
Parameters

Parameter Type Description


artItem PageItem Art item to apply brush to

Returns
Nothing.

47.3 Example

47.3.1 Applying a Brush

// Duplicates and groups all items in the current selection,


// then applies the same brush to each item in the group

if ([Link] > 0) {
var docSelection = [Link];
if ([Link] > 0) {
var newGroup = [Link]();

for (var i = 0; i < [Link]; i++) {


var newItem = docSelection[i].duplicate();
[Link](newGroup);
}

var brush = [Link][1];


(continues on next page)

172 Chapter 47. Brush


Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)


[Link](newGroup);
}
}

47.3. Example 173


Illustrator Scripting Guide, Release 0.0.1

174 Chapter 47. Brush


CHAPTER

FORTYEIGHT

BRUSHES

[Link]
Description
A collection of brush objects in a document.

48.1 Properties

48.1.1 [Link]

[Link]
Description
The number of objects in the collection
Type
Number; read-only.

48.1.2 [Link]

[Link]
Description
The document that contains this brushes collection.
Type
Object; read-only.

175
Illustrator Scripting Guide, Release 0.0.1

48.1.3 [Link]

[Link]
Description
The class name of the referenced object.
Type
String; read-only.

48.2 Methods

48.2.1 [Link]()

[Link](name)
Description
Gets the first element in the collection with the specified name.
Parameters

Parameter Type Description


name String Name of element to get

Returns
Brush

48.2.2 [Link]()

[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number String or number key

Returns
Brush

176 Chapter 48. Brushes


Illustrator Scripting Guide, Release 0.0.1

48.3 Example

48.3.1 Counting brushes

// Counts all brushes in the active document

if ([Link] > 0) {
var numberOfBrushes = [Link];
}

48.3. Example 177


Illustrator Scripting Guide, Release 0.0.1

178 Chapter 48. Brushes


CHAPTER

FORTYNINE

CHARACTERATTRIBUTES

characterAttributes
Description
Specifies the properties of a character contained in a text frame. A CharacterStyle object associates these attributes
with a specific text range through its characterAttributes property.

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

// todo: get the absolute path to characterAttributes.. [Link].


characters[index].characterAttributes ?

49.1 Properties

49.1.1 [Link]

[Link]
Description
The amount of inter-character spacing to be added to the left side of the character, in thousandths of an em (that amount
will not compress or expand during full-justification).
Type
Number (double)

49.1.2 [Link]

[Link]
Description
The amount of inter-character spacing to be added to the right side of the character, in thousandths of an em (that
amount will not compress or expand during full-justification).
Type
Number (double)

179
Illustrator Scripting Guide, Release 0.0.1

49.1.3 [Link]

[Link]
Description
The character alignment type.
Type
StyleRunAlignmentType

49.1.4 [Link]

[Link]
Description
The alternate glyphs form.
Type
AlternateGlyphsForm

49.1.5 [Link]

[Link]
Description
If true, the automatic leading should be used.
Type
Boolean

49.1.6 [Link]

[Link]
Description
The Japanese text baseline direction.
Type
BaselineDirectionType

180 Chapter 49. CharacterAttributes


Illustrator Scripting Guide, Release 0.0.1

49.1.7 [Link]

[Link]
Description
The baseline position of text.
Type
FontBaselineOption

49.1.8 [Link]

[Link]
Description
The amount of shift in points of the text baseline.
Type
Number (double)

49.1.9 [Link]

[Link]
Description
The case of text.
Type
FontCapsOption

49.1.10 [Link]

[Link]
Description
If true, the OpenType® connection forms should be used.
Type
Boolean

49.1. Properties 181


Illustrator Scripting Guide, Release 0.0.1

49.1.11 [Link]

[Link]
Description
If true, the contextual ligature should be used.
Type
Boolean

49.1.12 [Link]

[Link]
Description
If true, the discretionary ligature should be used.
Type
Boolean

49.1.13 [Link]

[Link]
Description
The number style in a OpenType font.
Type
FigureStyleType

49.1.14 [Link]

[Link]
Description
The color of the text fill.
Type
Color

182 Chapter 49. CharacterAttributes


Illustrator Scripting Guide, Release 0.0.1

49.1.15 [Link]

[Link]
Description
If true, the OpenType fractions should be used.
Type
Boolean

49.1.16 [Link]

[Link]
Description
The character horizontal scaling factor expressed as a percentage (100 = 100%).
Type
Number (double)

49.1.17 [Link]

[Link]
Description
If true, the Japanese OpenType font supports italics.
Type
Boolean

49.1.18 [Link]

[Link]
Description
The automatic kerning method to use.
Type
AutoKernType

49.1. Properties 183


Illustrator Scripting Guide, Release 0.0.1

49.1.19 [Link]

[Link]
Description
The language of text.
Type
LanguageType

49.1.20 [Link]

[Link]
Description
The amount of space between two lines of text, in points.
Type
Number (double)

49.1.21 [Link]

[Link]
Description
If true, the ligature should be used.
Type
Boolean

49.1.22 [Link]

[Link]
Description
If true, line breaks are not allowed.
Type
Boolean

184 Chapter 49. CharacterAttributes


Illustrator Scripting Guide, Release 0.0.1

49.1.23 [Link]

[Link]
Description
The OpenType baseline position.
Type
FontOpenTypePositionOption

49.1.24 [Link]

[Link]
Description
If true, the OpenType ordinals should be used.
Type
Boolean

49.1.25 [Link]

[Link]
Description
If true, the OpenType ornaments should be used.
Type
Boolean

49.1.26 [Link]

[Link]
Description
If true, the fill of the text should be overprinted.
Type
Boolean

49.1. Properties 185


Illustrator Scripting Guide, Release 0.0.1

49.1.27 [Link]

[Link]
Description
If true, the stroke of the text should be overprinted.
Type
Boolean

49.1.28 [Link]

[Link]
Description
The object’s container.
Type
Object, read-only.

49.1.29 [Link]

[Link]
Description
If true, the Japanese OpenType font supports proportional glyphs.
Type
Boolean

49.1.30 [Link]

[Link]
Description
The character rotation angle in degrees.
Type
Number (double)

186 Chapter 49. CharacterAttributes


Illustrator Scripting Guide, Release 0.0.1

49.1.31 [Link]

[Link]
Description
Font size in points.
Type
Number (double)

49.1.32 [Link]

[Link]
Description
If true, characters use strike-through style.
Type
Boolean

49.1.33 [Link]

[Link]
Description
The color of the text stroke.
Type
Color

49.1.34 [Link]

[Link]
Description
Line width of stroke.
Type
Number (double)

49.1. Properties 187


Illustrator Scripting Guide, Release 0.0.1

49.1.35 [Link]

[Link]
Description
If true, the OpenType stylistic alternates should be used.
Type
Boolean

49.1.36 [Link]

[Link]
Description
If true, the OpenType swash should be used.
Type
Boolean

49.1.37 [Link]

[Link]
Description
The Tate-Chu-Yoko horizontal adjustment in points.
Type
Number (long)

49.1.38 [Link]

[Link]
Description
The Tate-Chu-Yoko vertical adjustment in points.
Type
Number (long)

188 Chapter 49. CharacterAttributes


Illustrator Scripting Guide, Release 0.0.1

49.1.39 [Link]

[Link]
Description
The text font.
Type
TextFont

49.1.40 [Link]

[Link]
Description
If true, the OpenType titling alternates should be used.
Type
Boolean

49.1.41 [Link]

[Link]
Description
The tracking or range kerning amount, in thousandths of an em.
Type
Number (long)

49.1.42 [Link]

[Link]
Description
The percentage of space reduction around a Japanese character.
Type
Number (double)

49.1. Properties 189


Illustrator Scripting Guide, Release 0.0.1

49.1.43 [Link]

[Link]
Description
The class name of the object.
Type
String, read-only.

49.1.44 [Link]

[Link]
Description
If true, characters are underlined.
Type
Boolean

49.1.45 [Link]

[Link]
Description
Character vertical scaling factor expressed as a percentage (= 100%).
Type
Number (double)

49.1.46 [Link]

[Link]
Description
Specifies how the characters in Wari-Chu text (an inset note in Japanese text) are divided into two or more lines.
Type
Number (long)

190 Chapter 49. CharacterAttributes


Illustrator Scripting Guide, Release 0.0.1

49.1.47 [Link]

[Link]
Description
Specifies how the characters in Wari-Chu text (an inset note in Japanese text) are divided into two or more lines.
Type
Number (long)

49.1.48 [Link]

[Link]
Description
If true, Wari-Chu is enabled.
Type
Boolean

49.1.49 [Link]

[Link]
Description
The Wari-Chu justification.
Type
WariChuJustificationType

49.1.50 [Link]

[Link]
Description
The Wari-Chu line gap.
Type
Number (long)

49.1. Properties 191


Illustrator Scripting Guide, Release 0.0.1

49.1.51 [Link]

[Link]
Description
The number of Wari-Chu (multiple text lines fit into a space meant for one) lines.
Type
Number (long)

49.1.52 [Link]

[Link]
Description
The Wari-Chu scale.
Type
Number (double)

49.2 Example

49.2.1 Setting character attributes

// Creates a new document, adds a simple text item


// then incrementally increases the horizontal and
// vertical scale attributes of each character

var docRef = [Link]();


var textRef = [Link]();
[Link] = "I Love Scripting!";
[Link] = 400;
[Link] = 100;

// incrementally increase the scale of each character


var charCount = [Link];
var size = 100;
for (var i = 0; i < charCount; i++, size *= 1.2) {
[Link][i].[Link] = size;
[Link][i].[Link] = size;
}

192 Chapter 49. CharacterAttributes


CHAPTER

FIFTY

CHARACTERS

[Link][index].contents
Description
A collection of characters (TextRange objects of length 1).
The elements are not named; you must access them by index.

50.1 Properties

50.1.1 [Link]

[Link][index].[Link]
Description
The number of characters in the collection.
Type
Number; read-only.

50.1.2 [Link]

[Link][index].[Link]
Description
The text art item that contains this character.
Type
Object; read-only.

193
Illustrator Scripting Guide, Release 0.0.1

50.1.3 [Link]

[Link][index].[Link]
Description
The class name of the referenced object.
Type
String; read-only.

50.2 Methods

50.2.1 [Link]()

[Link][index].[Link](contents[,relativeObject][,
insertionLocation])
Description
Adds a new character with specified text contents at the specified location in the current document.
If a location is not specified, adds the new character to the containing text frame after the current text selection or
insertion point.
Parameters

Parameter Type Description


contents String Text contents to add
relativeObject TextFrameItem, optional Object to add item to
insertionLocation ElementPlacement, optional Location to place text

Returns
TextRange

50.2.2 [Link]()

[Link][index].[Link](contents)
Description
Adds a character before the specified text selection.
Parameters

Parameter Type Description


contents String Text contents to add

Returns
TextRange

194 Chapter 50. Characters


Illustrator Scripting Guide, Release 0.0.1

50.2.3 [Link]()

[Link][index].[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number String or number key

Returns
TextRange

50.2.4 [Link]()

[Link][index].[Link]()
Description
Deletes all elements in the collection.
Returns
Nothing.

50.3 Example

50.3.1 Counting characters

// Counts all characters in the active document,


// including whitespace, and stores in numChars

if ([Link] > 0) {
var doc = [Link];
var numChars = 0;
for (var i = 0; i < [Link]; i++) {
var textArtRange = [Link][i].contents;
numChars += [Link];
}
}

50.3. Example 195


Illustrator Scripting Guide, Release 0.0.1

196 Chapter 50. Characters


CHAPTER

FIFTYONE

CHARACTERSTYLE

characterStyle
Description
Associates character attributes with characters. For an example, see CharacterStyles.

51.1 Properties

51.1.1 [Link]

[Link]
Description
The character properties for the style.
Type
CharacterAttributes, read-only.

51.1.2 [Link]

[Link]
Description
The character style’s name.
Type
String

197
Illustrator Scripting Guide, Release 0.0.1

51.1.3 [Link]

[Link]
Description
The object’s container.
Type
Object, read-only.

51.1.4 [Link]

[Link]
Description
The class name of the object.
Type
String, read-only.

51.2 Methods

51.2.1 [Link]()

[Link](textItem [,clearingOverrides])
Description
Applies the character style to the text object or objects.
Paramaters

Parameter Type Description


textItem Object Text item to apply style to
clearingOverrides Boolean, optional Whether to clear overrides

Returns
Nothing

198 Chapter 51. CharacterStyle


Illustrator Scripting Guide, Release 0.0.1

51.2.2 [Link]()

[Link]()
Description
Deletes the object.
Returns
Nothing.

51.2. Methods 199


Illustrator Scripting Guide, Release 0.0.1

200 Chapter 51. CharacterStyle


CHAPTER

FIFTYTWO

CHARACTERSTYLES

[Link]
Description
A collection of CharacterStyle objects.

52.1 Properties

52.1.1 [Link]

[Link]
Description
The number of characters in the collection.
Type
Number; read-only.

52.1.2 [Link]

[Link]
Description
The object’s container.
Type
Object; read-only.

201
Illustrator Scripting Guide, Release 0.0.1

52.1.3 [Link]

[Link]
Description
The class name of the object.
Type
String; read-only.

52.2 Methods

52.2.1 [Link]()

add(name)
Description
Creates a named character style.
Parameters

Parameter Type Description


name String Element name to create

Returns
CharacterStyle

52.2.2 [Link]()

getByName(name)
Description
Gets the first element in the collection with the provided name.
Parameters

Parameter Type Description


name String Name of element to get

Returns
CharacterStyle

202 Chapter 52. CharacterStyles


Illustrator Scripting Guide, Release 0.0.1

52.2.3 [Link]()

index(itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number String or number key

Returns
CharacterStyle

52.2.4 [Link]()

removeAll()
Description
Deletes all elements in this collection.
Returns
Nothing.

52.3 Example

52.3.1 Using characters styles

// Creates 3 text frames in a new document then creates


// a character style and applies it to each text frame.

var docRef = [Link]();


var textRef1 = [Link]();
[Link] = "Scripting is fun!";
[Link] = 700;
[Link] = 50;

var textRef2 = [Link]();


[Link] = "Scripting is easy!";
[Link] = 625;
[Link] = 100;

var textRef3 = [Link]();


[Link] = "Everyone should script!";
[Link] = 550;
(continues on next page)

52.3. Example 203


Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)


[Link] = 150;
redraw();

// Create a new character style


var charStyle = [Link]("BigRed");

// set character attributes


var charAttr = [Link];
[Link] = 40;
[Link] = -50;
[Link] = [Link];

var redColor = new RGBColor();


[Link] = 255;
[Link] = 0;
[Link] = 0;
[Link] = redColor;

// apply to each textFrame in the document


[Link]([Link]);
[Link]([Link]);
[Link]([Link]);

204 Chapter 52. CharacterStyles


CHAPTER

FIFTYTHREE

CMYKCOLOR

new cmykColor()
Description
A CMYK color specification, used where a color object is required.
If the color space of a document is RGB and you specify the color value for a page item in that document using CMYK,
Illustrator will translate the CMYK color specification into an RGB color specification. The same thing happens if the
document’s color space is CMYK and you specify colors using RGB. Since this translation can lose information, you
should specify colors using the class that matches the document’s actual color space.

53.1 Properties

53.1.1 [Link]

[Link]
Description
The black color value. Range 0.0–100.0. Default: 0.0
Type
Number (double)

53.1.2 [Link]

[Link]
Description
The cyan color value. Range 0.0–100.0. Default: 0.0
Type
Number (double)

205
Illustrator Scripting Guide, Release 0.0.1

53.1.3 [Link]

[Link]
Description
The magenta color value. Range 0.0–100.0. Default: 0.0
Type
Number (double)

53.1.4 [Link]

[Link]
Description
The class name of the referenced object.
Type
String; read-only.

53.1.5 [Link]

[Link]
Description
The yellow color value. Range 0.0–100.0. Default: 0.0
Type
Number (double)

53.2 Example

53.2.1 Setting a CMYK color

// Sets the fill color of the frontmost path item in


// the current document to a light purple CMYK color

if ([Link] > 0 && [Link] > 0) {


var frontPath = [Link][0];

// Set color values for the CMYK object


var newCMYKColor = new cmykColor();
[Link] = 0;
[Link] = 30.4;
(continues on next page)

206 Chapter 53. CMYKColor


Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)


[Link] = 32;
[Link] = 0;

// Use the color object in the path item


[Link] = true;
[Link] = newCMYKColor;
}

53.2. Example 207


Illustrator Scripting Guide, Release 0.0.1

208 Chapter 53. CMYKColor


CHAPTER

FIFTYFOUR

COLOR

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

54.1 GradientColor
gradientColor
Description
A gradient color specification in a Gradient object. A script can create a new gradient color using a reference to an
existing gradient in the document. If no existing gradient object is referenced, a default gradient is supplied.

54.1.1 Properties

[Link]

[Link]
Description
The gradient vector angle in degrees. Default: 0.0.
Type
Number (double).

209
Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link]
Description
Reference to the object defining the gradient.
Type
Gradient

[Link]

[Link]
Description
The gradient highlight vector angle in degrees.
Type
Number (double).

[Link]

[Link]
Description
The gradient highlight vector length.
Type
Number (double).

[Link]

[Link]
Description
The gradient vector length.
Type
Number (double).

210 Chapter 54. Color


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link]
Description
An additional transformation matrix to manipulate the gradient path.
Type
Matrix.

[Link]

[Link]
Description
The gradient vector origin, the center point of the gradient in this color.
Type
Array of 2 numbers.

[Link]

[Link]
Description
The class name of the referenced object.
Type
String, read-only.

54.1.2 Example

Changing a gradient stop color

// Creates a new RGB document, then changes the color of the first gradient stop of an␣
˓→indexed gradient

[Link]([Link]);

// Get a reference to the gradient that you want to change


var gradientRef = [Link][1];

// Create the new color


var startColor = new RGBColor();
[Link] = 255;
[Link] = 238;
(continues on next page)

54.1. GradientColor 211


Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)


[Link] = 98;

// apply new color to the first gradient stop


[Link][0].color = startColor;

54.2 GrayColor

new GrayColor()
Description
A grayscale color specification, used where a color object is required.

54.2.1 Properties

[Link]

[Link]
Description
The tint of the gray. Range: 0.0 to 100.0, where 0.0 is black and 100.0 is white.
Type
Number (double).

[Link]

[Link]
Description
The class name of the referenced object.
Type
String, read-only.

54.2.2 Example

Changing a color to gray

212 Chapter 54. Color


Illustrator Scripting Guide, Release 0.0.1

// Sets the color of the first word in the active document to a shade of gray

if ([Link] > 0 && [Link] > 0) {


var text = [Link][0].textRange;
var firstWord = [Link][0];

// Create the new color


var textColor = new GrayColor();
[Link] = 45;

[Link] = true;
[Link] = textColor;
}

54.3 LabColor

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

54.3.1 Properties

LabColor.a

labColor.a
Description
The a (red-green) color value. Range -128.0–128.0. Default: 0.0.
Type
Number (double).

LabColor.b

labColor.b
Description
The b (yellow-blue) color value. Range -128.0–128.0. Default: 0.0.
Type
Number (double).

54.3. LabColor 213


Illustrator Scripting Guide, Release 0.0.1

LabColor.l

labColor.l
Description
The l (lightness) color value. Range -128.0–128.0. Default: 0.0.
Type
Number (double).

54.4 NoColor

new NoColor()
Description
Represents the “none” color. Assigning a NoColor object to the fill or stroke color of an art item is equivalent to setting
the filled or stroked property to false.

54.4.1 Properties

[Link]

[Link]
Description
The class name of the object.
Type
String, read-only.

54.4.2 Example

Using NoColor to remove a fill color

// Creates 2 overlapping objects with different fill colors.


// Assign the top object a fill color of "NoColor"
// allowing the bottom object to become visible.

// Create 2 overlapping objects one blue, one red;


var docRef = [Link]();
var itemRef1 = [Link](500, 200, 200, 100);
var itemRef2 = [Link](550, 150, 200, 200);
var rgbColor = new RGBColor();
[Link] = 255;
[Link] = rgbColor;
(continues on next page)

214 Chapter 54. Color


Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)

[Link] = 255;
[Link] = 0;
[Link] = rgbColor;
redraw();

// create a nocolor and assign it to the top object


var noColor = new NoColor();
[Link] = noColor;
redraw();

54.5 PatternColor
patternColor
Description
A pattern color specification. You can create a new pattern color by modifying an existing pattern in the document.
Any modification you make to a pattern affects that pattern in the Palette.
PatternColor objects can be used in any property that takes a color object, such as fillColor or strokeColor.

54.5.1 Properties

[Link]

[Link]
Description
Additional transformation arising from manipulating the path.
Type
Matrix

[Link]

[Link]
Description
A reference to the pattern object that defines the pattern to use in this color definition.
Type
Pattern

54.5. PatternColor 215


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link]
Description
If true, the prototype should be reflected before filling.
Default: false
Type
Boolean

[Link]

[Link]
Description
The axis around which to reflect, in points.
Default: 0.0
Type
Number (double)

[Link]

[Link]
Description
The angle in radians to rotate the prototype pattern before filling.
Default: 0.0
Type
Number (double)

[Link]

[Link]
Description
The fraction to which to scale the prototype pattern before filling, represented as a point containing horizontal and
vertical scaling percentages.
Type
Array of 2 numbers

216 Chapter 54. Color


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link]
Description
The angle in radians by which to slant the shear.
Default: 0.0
Type
Number (double)

[Link]

[Link]
Description
The axis to shear with respect to, in points.
Default: 0.0
Type
Number (double)

[Link]

[Link]
Description
The angle in radians to which to translate the unscaled prototype pattern before filling.
Default: 0.0
Type
Number (double)

[Link]

[Link]
Description
The distance in points to which to translate the unscaled prototype pattern before filling.
Default: 0.0
Type
Number (double)

54.5. PatternColor 217


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link]
Description
The class name of the referenced object.
Type
String; read-only.

54.5.2 Example

Modifying and applying pattern colors

// Rotates the color of each pattern in the current document,


// then applies the last pattern to the first path item
if ([Link] > 0 && [Link] > 0) {
var doc = [Link];
var swatchIndex = 0;

for (i = 0; i < [Link]; i++) {


// Get the generic color object of the swatch
var currentSwatch = [Link][i];
var swatchColor = [Link];

// Only operate on patterns


if ([Link] == "PatternColor") {

// Change a pattern property


[Link] = 10;
swatchIndex = i;
}
}

// Apply the last pattern color swatch to the frontmost path


var firstPath = [Link][0];
[Link] = true;
[Link] = [Link][swatchIndex].color;
}

54.6 RGBColor

new RGBColor()
Description
An RGB color specification, used to apply an RGB color to a layer or art item.
If the color space of a document is RGB and you specify the color value for a page item in that document using CMYK,
Illustrator will translate the CMYK color specification into an RGB color specification. The same thing happens if the

218 Chapter 54. Color


Illustrator Scripting Guide, Release 0.0.1

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.

54.6.1 Properties

[Link]

[Link]
Description
The blue color value. Range: 0.0 to 255.0.
Type
Number (double).

[Link]

[Link]
Description
The green color value. Range: 0.0 to 255.0.
Type
Number (double).

[Link]

[Link]
Description
The red color value. Range: 0.0 to 255.0.
Type
Number (double).

[Link]

[Link]
Description
The class name of the referenced object.
Type
String, read-only.

54.6. RGBColor 219


Illustrator Scripting Guide, Release 0.0.1

54.6.2 Example

Setting an RGB color

// Sets the default fill color in the current document to yellow.

if ([Link] > 0) {
// Define the new color
var newRGBColor = new RGBColor();
[Link] = 255;
[Link] = 255;
[Link] = 0;

[Link] = newRGBColor;
}

54.7 SpotColor

new SpotColor()
Description
Color class used to apply the color value of a spot at a specified tint value. Can be used in any property that takes a
color object.

54.7.1 Properties

[Link]

[Link]
Description
A reference to the spot color object that defines the color.
Type
Spot

[Link]

[Link]
Description
The tint of the color. Range: 0.0 to 100.0
Type
Number (double)

220 Chapter 54. Color


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link]
Description
The class name of the referenced object.
Type
String; read-only.

54.7. SpotColor 221


Illustrator Scripting Guide, Release 0.0.1

222 Chapter 54. Color


CHAPTER

FIFTYFIVE

COMPOUNDPATHITEM

[Link][index
Description
A compound path. These objects are composed of multiple intersecting paths, resulting in transparent interior spaces
where the component paths overlap. The pathItems property provides access to the paths that make up the compound
path.
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 that contains the compound path or group.
All paths within 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, the properties of all other component paths are updated with the new value.

55.1 Properties

55.1.1 [Link]

[Link][index].artworkKnockout
Description
Is this object used to create a knockout, and if so, what kind of knockout.
Type
KnockoutState

55.1.2 [Link]

[Link][index].blendingMode
Description
The mode used when compositing an object.
Type
BlendModes

223
Illustrator Scripting Guide, Release 0.0.1

55.1.3 [Link]

[Link][index].controlBounds
Description
The bounds of the object including stroke width and controls.
Type
Array of 4 numbers, read-only.

55.1.4 [Link]

[Link][index].editable
Description
If true, this item is editable.
Type
Boolean, read-only.

55.1.5 [Link]

[Link][index].geometricBounds
Description
The bounds of the object excluding stroke width.
Type
Array of 4 numbers, read-only.

55.1.6 [Link]

[Link][index].height
Description
The height of the compound path item excluding stroke width.
Type
Number (double).

224 Chapter 55. CompoundPathItem


Illustrator Scripting Guide, Release 0.0.1

55.1.7 [Link]

[Link][index].hidden
Description
If true, this compound path item is hidden.
Type
Boolean.

55.1.8 [Link]

[Link][index].isIsolated
Description
If true, this object is isolated.
Type
Boolean.

55.1.9 [Link]

[Link][index].layer
Description
The layer to which this compound path item belongs.
Type
Layer, read-only.

55.1.10 [Link]

[Link][index].left
Description
The position of the left side of the item (in points, measured from the left side of the page).
Type
Number (double).

55.1. Properties 225


Illustrator Scripting Guide, Release 0.0.1

55.1.11 [Link]

[Link][index].locked
Description
If true, this compound path item is locked.
Type
Boolean.

55.1.12 [Link]

[Link][index].name
Description
The name of this compound path item.
Type
String.

55.1.13 [Link]

[Link][index].note
Description
The note assigned to this item.
Type
String.

55.1.14 [Link]

[Link][index].opacity
Description
The opacity of the object. Range: 0.0 to 100.0
Type
Number (double).

226 Chapter 55. CompoundPathItem


Illustrator Scripting Guide, Release 0.0.1

55.1.15 [Link]

[Link][index].parent
Description
The parent of this object.
Type
Layer or GroupItem, read-only.

55.1.16 [Link]

[Link][index].pathItems
Description
The path art items in this compound path.
Type
PathItems, read-only.

55.1.17 [Link]

[Link][index].position
Description
The position (in points) of the top left corner of the compoundPathItem object in the format [x, y]. Does not include
stroke weight.
Type
Array of 2 numbers.

55.1.18 [Link]

[Link][index].selected
Description
If true, this compound path item is selected.
Type
Boolean.

55.1. Properties 227


Illustrator Scripting Guide, Release 0.0.1

55.1.19 [Link]

[Link][index].sliced
Description
If true, the item is sliced. Default: false
Type
Boolean.

55.1.20 [Link]

[Link][index].tags
Description
The tags contained in this object.
Type
Tags, read-only.

55.1.21 [Link]

[Link][index].top
Description
The position of the top of the item (in points, measured from the bottom of the page).
Type
Number (double).

55.1.22 [Link]

[Link][index].typename
Description
The class name of the referenced object.
Type
String, read-only.

228 Chapter 55. CompoundPathItem


Illustrator Scripting Guide, Release 0.0.1

55.1.23 [Link]

[Link][index].uRL
Description
The value of the Adobe URL tag assigned to this compound path item.
Type
String.

55.1.24 [Link]

[Link][index].visibilityVariable
Description
The visibility variable bound to the item.
Type
Variant.

55.1.25 [Link]

[Link][index].visibleBounds
Description
The visible bounds of the compound path item including stroke width.
Type
Array of 4 numbers, read-only.

55.1.26 [Link]

[Link][index].width
Description
The width of the compound path item excluding stroke width.
Type
Number (double).

55.1. Properties 229


Illustrator Scripting Guide, Release 0.0.1

55.1.27 [Link]

[Link][index].wrapInside
Description
If true, the text frame object should be wrapped inside this object.
Type
Boolean.

55.1.28 [Link]

[Link][index].wrapOffset
Description
The offset to use when wrapping text around this object.
Type
Number (double).

55.1.29 [Link]

[Link][index].wrapped
Description
If true, wrap text frame objects around this object (text frame must be above the object).
Type
Boolean.

55.1.30 [Link]

[Link][index].zOrderPosition
Description
The position of this art item within the stacking order of the group or layer (Parent) that contains the art item.
Type
Number (long), read-only.

230 Chapter 55. CompoundPathItem


Illustrator Scripting Guide, Release 0.0.1

55.2 Methods

55.2.1 [Link]()

[Link][index].duplicate([relativeObject][,
insertionLocation])
Description
Creates a duplicate of the selected object.
Parameters

Parameter Type Description


relativeObject Object, optional Object to duplicate to
insertionLocation ElementPlacement, optional Location to insert element

Returns
CompoundPathItem

55.2.2 [Link]()

[Link][index].move(relativeObject,
insertionLocation)
Description
Moves the object.
Parameters

Parameter Type Description


relativeObject Object Object to move element within
insertionLocation ElementPlacement, optional Location to move element to

Returns
Nothing.

55.2.3 [Link]()

[Link][index].remove()
Description
Deletes this object.
Returns
Nothing.

55.2. Methods 231


Illustrator Scripting Guide, Release 0.0.1

55.2.4 [Link]()

[Link][index].resize(
scaleX, scaleY [,changePositions] [,changeFillPatterns] [,changeFillGradients]
[,changeStrokePattern] [,changeLineWidths] [,scaleAbout]
)

Description
Scales the art item where scaleX is the horizontal scaling factor and scaleY is the vertical scaling factor. 100.0 =
100%.
Parameters

Parameter Type Description


scaleX Number (double) Horizontal scaling factor
scaleY Number (double) Vertical scaling factor
changePositions Boolean, optional Whether to effect art object positions and orientations
changeFillPatterns Boolean, optional Whether to transform fill patterns
changeFillGradients Boolean, optional Whether to transform fill gradients
changeStrokePattern Boolean, optional Whether to transform stroke patterns
changeLineWidths Number (double), optional The amount to scale line widths
scaleAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

55.2.5 [Link]()

[Link][index].rotate(
angle [,changePositions] [,changeFillPatterns]
[,changeFillGradients] [,changeStrokePattern] [,rotateAbout]
)

Description
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.
Parameters

Parameter Type Description


angle Number (double) The angle amount to rotate the element
changePositions Boolean, optional Whether to effect art object positions and orientations
changeFillPatterns Boolean, optional Whether to transform fill patterns
changeFillGradients Boolean, optional Whether to transform fill gradients
changeStrokePattern Boolean, optional Whether to transform stroke patterns
rotateAbout Transformation, optional The point to use as anchor, to transform about

Returns

232 Chapter 55. CompoundPathItem


Illustrator Scripting Guide, Release 0.0.1

Nothing.

55.2.6 [Link]()

[Link][index].transform(
transformationMatrix [,changePositions] [,changeFillPatterns] [,changeFillGradients]
[,changeStrokePattern] [,changeLineWidths] [,transformAbout]
)

Description
Transforms the art item by applying a transformation matrix.
Parameters

Parameter Type Description


transformationMatrix Matrix Transformation matrix to apply
changePositions Boolean, optional Whether to change Positions
changeFillPatterns Boolean, optional Whether to change Fill Patterns
changeFillGradients Boolean, optional Whether to change Fill Gradients
changeStrokePattern Boolean, optional Whether to change Stroke Pattern
changeLineWidths Number (double), optional The amount to scale line widths
transformAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

55.2.7 [Link]()

[Link][index].translate(
deltaX [,deltaY] [,transformObjects] [,transformFillPatterns]
[,transformFillGradients] [,transformStrokePatterns]
)

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

Parameter Type Description


deltaX Number (double), optional Horizontal offset
deltaY Number (double), optional Vertical offset
transformObjects Boolean, optional Whether to transform Objects
transformFillPatterns Boolean, optional Whether to transform Fill Patterns
transformFillGradients Boolean, optional Whether to transform Fill Gradients
transformStrokePatterns Boolean, optional Whether to transform Stroke Patterns

55.2. Methods 233


Illustrator Scripting Guide, Release 0.0.1

Returns
Nothing.

55.2.8 [Link]()

[Link][index].zOrder(zOrderCmd)
Description
Arranges the art item’s position in the stacking order of the group or layer (parent) of this object.
Parameters

Parameter Type Description


zOrderCmd ZOrderMethod Stacking order arrangement method

Returns
Nothing.

55.3 Example

55.3.1 Selecting paths in a document

// Selects all paths not part of a compound path


if ( [Link] > 0 ) {
var doc = [Link];
var count = 0;
if ( [Link] > 0 ) {
var thePaths = [Link];
var numPaths = [Link];
for ( var i = 0; i < [Link]; i++ ) {
var pathArt = [Link][i];
if ( [Link] != "compoundPathItem" ) {
[Link] = true;
count++;
}
}
}

234 Chapter 55. CompoundPathItem


Illustrator Scripting Guide, Release 0.0.1

55.3.2 Creating and modifying a compound path item

// Creates a new compound path item containing 3 path


// items, then sets the width and the color of the stroke
// to all items in the compound path

if ([Link] > 0) {
var doc = [Link];
var newCompoundPath = [Link]();

// Create the path items


var newPath = [Link]();
[Link](Array(Array(30, 50), Array(30, 100)));

newPath = [Link]();
[Link](Array(Array(40, 100), Array(100, 100)));

newPath = [Link]();
[Link](Array(Array(100, 110), Array(100, 300)));

// Set stroke and width properties of the compound path


[Link] = true;
[Link] = 3.5;
[Link] = [Link][3].color;
}

55.3. Example 235


Illustrator Scripting Guide, Release 0.0.1

236 Chapter 55. CompoundPathItem


CHAPTER

FIFTYSIX

COMPOUNDPATHITEMS

[Link]
Description
A collection of CompoundPathItem objects.

56.1 Properties

56.1.1 [Link]

[Link]
Description
The number of objects in the collection.
Type
Number, read-only.

56.1.2 [Link]

[Link]
Description
The parent of this collection (either a Layer or a GroupItem).
Type
Object, read-only.

237
Illustrator Scripting Guide, Release 0.0.1

56.1.3 [Link]

[Link]
Description
The class name of the referenced object.
Type
String, read-only.

56.2 Methods

56.2.1 [Link]()

[Link]()
Description
Creates a new CompoundPathItem.
Returns
CompoundPathItem

56.2.2 [Link]()

[Link](name)
Description
Gets the first element in the collection with the specified name.
Parameters

Parameter Type Description


name String Name of element to get

Returns
CompoundPathItem

238 Chapter 56. CompoundPathItems


Illustrator Scripting Guide, Release 0.0.1

56.2.3 [Link]()

[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number String or number key

Returns
CompoundPathItem

56.2.4 [Link]()

[Link]()
Description
Deletes all elements in this collection.
Returns
Nothing.

56.3 Example

56.3.1 Counting compound paths

// Counts all compound path items in layer 1 of the current document


if ([Link] > 0) {
var doc = [Link];
var numCompoundPaths = [Link][0].[Link];
}

56.3. Example 239


Illustrator Scripting Guide, Release 0.0.1

240 Chapter 56. CompoundPathItems


CHAPTER

FIFTYSEVEN

DATASET

[Link][index
Description
A set of data used for dynamic publishing. A dataset allows you to collect a number of variables and their dynamic
data into one object. You must have at least one variable bound to an art item in order to create a dataset. See the class
Variable.

57.1 Properties

57.1.1 [Link]

[Link][index].name
Description
Then name of the dataset.
Type
String.

57.1.2 [Link]

[Link][index].parent
Description
The name of the object that contains this dataset.
Type
Document, read-only.

241
Illustrator Scripting Guide, Release 0.0.1

57.1.3 [Link]

[Link][index].typename
Description
The class name of the referenced object.
Type
String.

57.2 Methods

57.2.1 [Link]()

[Link][index].display()
Description
Displays the dataset.
Returns
Nothing.

57.2.2 [Link]()

[Link][index].remove()
Description
Deletes this object.
Returns
Nothing.

57.2.3 [Link]()

[Link][index].update()
Description
Updates the dataset.
Returns
Nothing.

242 Chapter 57. Dataset


Illustrator Scripting Guide, Release 0.0.1

57.3 Example

57.3.1 Using variables and datasets

// Creates two variables, 1 visibility and 1 text,


// creates two datasets each with different values for the variables,
// then displays both datasets

var docRef = [Link]();

// Create visibility variable


var itemRef = [Link](600, 200, 150, 150);
var colorRef = new RGBColor;
[Link] = 255;
[Link] = colorRef;

var visibilityVar = [Link]();


[Link] = [Link];
[Link] = visibilityVar;

// Create text variable


var textRef = [Link]();
[Link] = "Text Variable, dataset 1";
[Link] = 400;
[Link] = 200;

var textVar = [Link]();


[Link] = [Link];
[Link] = textVar;
redraw();

// Create dataset 1
var ds1 = [Link]();

// Change variable values and create dataset 2


[Link] = true;
[Link] = "Text Variable, dataset 2";
redraw();
var ds2 = [Link]();

// display each dataset


[Link]();
redraw();
[Link]();
redraw();

57.3. Example 243


Illustrator Scripting Guide, Release 0.0.1

244 Chapter 57. Dataset


CHAPTER

FIFTYEIGHT

DATASETS

[Link]
Description
A collection of Dataset objects.

58.1 Properties

58.1.1 [Link]

[Link]
Description
The number of datasets in the collection.
Type
Number, read-only.

58.1.2 [Link]

[Link]
Description
The name of the object that contains this dataset.
Type
Document, read-only.

245
Illustrator Scripting Guide, Release 0.0.1

58.1.3 [Link]

[Link]
Description
The class name of the referenced object.
Type
String, read-only.

58.2 Methods

58.2.1 [Link]()

[Link]()
Description
Creates a new dataset object.
Returns
Dataset

58.2.2 [Link]()

[Link](name)
Description
Gets the first element in the collection with the specified name.
Parameters

Parameter Type Description


name String Name of element to get

Returns
Dataset

246 Chapter 58. Datasets


Illustrator Scripting Guide, Release 0.0.1

58.2.3 [Link]()

[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number String or number key

Returns
Dataset

58.2.4 [Link]()

[Link]()
Description
Removes all elements in the collection.
Returns
Nothing.

58.2. Methods 247


Illustrator Scripting Guide, Release 0.0.1

248 Chapter 58. Datasets


CHAPTER

FIFTYNINE

DOCUMENT

[Link]
Description
An Illustrator document. Documents are contained in the Application object.
The default document settings—those properties starting with the word “default”—are global settings that affect the
current document. Be sure to modify these default properties only when a document is open. Note that if you set
default properties to desired values before creating new objects, you can streamline your scripts, eliminating the need
to specify specific properties such as fillColor and stroked that have default properties.
A document’s color space, height, and width can only be set when the document is created. You cannot modify these
properties in an existing document. See [Link]() for more information on how document color spaces are
handled.

59.1 Properties

59.1.1 [Link]

[Link]
Description
The currently opened dataset.
Type
Dataset

59.1.2 [Link]

[Link]
Description
The active layer in the document.
Type
Layer

249
Illustrator Scripting Guide, Release 0.0.1

59.1.3 [Link]

[Link]
Description
The document’s current view.
Type
View, read-only.

59.1.4 [Link]

[Link]
Description
All artboards in the document.
Type
Artboards, read-only.

59.1.5 [Link]

[Link]
Description
The brushes contained in the document.
Type
Brushes, read-only.

59.1.6 [Link]

[Link]
Description
The list of character styles in this document.
Type
CharacterStyles, read-only.

250 Chapter 59. Document


Illustrator Scripting Guide, Release 0.0.1

59.1.7 [Link]

[Link]
Description
The compound path items contained in the document.
Type
CompoundPathItems, read-only.

59.1.8 [Link]

[Link]
Description
The boundary of the document’s cropping box for output, or null if no value has been set.
Type
Array of 4 numbers.

59.1.9 [Link]

[Link]
Description
The style of the document’s cropping box.
Type
CropOptions

59.1.10 [Link]

[Link]
Description
The datasets contained in the document.
Type
Datasets, read-only.

59.1. Properties 251


Illustrator Scripting Guide, Release 0.0.1

59.1.11 [Link]

[Link]
Description
The color to use to fill new paths if defaultFilled is true.
Type
Color

59.1.12 [Link]

[Link]
Description
If true, a new path should be filled.
Type
Boolean.

59.1.13 [Link]

[Link]
Description
If true, the art beneath a filled object should be overprinted by default.
Type
Boolean.

59.1.14 [Link]

[Link]
Description
Default type of line capping for paths created.
Type
StrokeCap

252 Chapter 59. Document


Illustrator Scripting Guide, Release 0.0.1

59.1.15 [Link]

[Link]
Description
The stroke color for new paths if default stroked is true.
Type
Color

59.1.16 [Link]

[Link]
Description
If true, a new path should be stroked.
Type
Boolean.

59.1.17 [Link]

[Link]
Description
Default lengths for dashes and gaps in dashed lines, starting with the first dash length, followed by the first gap length,
and so on. Set to an empty object, {}, for solid line.
Type
Object.

59.1.18 [Link]

[Link]
Description
The default distance into the dash pattern at which the pattern should be started for new paths.
Type
Number (double).

59.1. Properties 253


Illustrator Scripting Guide, Release 0.0.1

59.1.19 [Link]

[Link]
Description
Default type of joints in new paths.
Type
StrokeJoin

59.1.20 [Link]

[Link]
Description
When a default stroke join is set to mitered, this property specifies when the join will be converted to beveled (squared-
off ) by default. The default miter limit of 4 means that when the length of the point reaches four times the stroke weight,
the join switches from a miter join to a bevel join. Range: 1 to 500; a value of 1 specifies a bevel join.
Type
Number (double).

59.1.21 [Link]

[Link]
Description
If true, the art beneath a stroked object should be overprinted by default.
Type
Boolean.

59.1.22 [Link]

[Link]
Description
Default width of stroke for new paths.
Type
Number (double).

254 Chapter 59. Document


Illustrator Scripting Guide, Release 0.0.1

59.1.23 [Link]

[Link]
Description
The color specification system to use for this document’s color space.
Type
DocumentColorSpace

59.1.24 [Link]

[Link]
Description
The file associated with the document, which includes the complete path to the file.
Type
File, read-only.

59.1.25 [Link]

[Link]
Description
The bounds of the illustration excluding the stroke width of any objects in the document.
Type
Array of 4 numbers, read-only.

59.1.26 [Link]

[Link]
Description
The gradients contained in the document.
Type
Gradients, read-only.

59.1. Properties 255


Illustrator Scripting Guide, Release 0.0.1

59.1.27 [Link]

[Link]
Description
The graphic styles defined in this document.
Type
GraphicStyles, read-only.

59.1.28 [Link]

[Link]
Description
The graph art items in this document.
Type
GraphItems, read-only.

59.1.29 [Link]

[Link]
Description
The group items contained in the document.
Type
GroupItems, read-only.

59.1.30 [Link]

[Link]
Description
The height of the document.
Type
Number (double), read-only.

256 Chapter 59. Document


Illustrator Scripting Guide, Release 0.0.1

59.1.31 [Link]

[Link]
Description
The list of inks in this document.
Type
Object, read-only.

59.1.32 [Link]

[Link]
Description
The Kinsoku set of characters that cannot begin or end a line of Japanese text.
Type
Object, read-only.

59.1.33 [Link]

[Link]
Description
The layers contained in the document.
Type
Layers, read-only.

59.1.34 [Link]

[Link]
Description
The legacy text items in the document.
Type
LegacyTextItems, read-only.

59.1. Properties 257


Illustrator Scripting Guide, Release 0.0.1

59.1.35 [Link]

[Link]
Description
The mesh art items contained in the document.
Type
MeshItems, read-only.

59.1.36 [Link]

[Link]
Description
A list of names of predefined Mojikumi sets which specify the spacing for the layout and composition of Japanese text.
Type
Object, read-only.

59.1.37 [Link]

[Link]
Description
The document’s name (not the complete file path to the document).
Type
String, read-only.

59.1.38 [Link]

[Link]
Description
The non-native art items in this document.
Type
NonNativeItems, read-only.

258 Chapter 59. Document


Illustrator Scripting Guide, Release 0.0.1

59.1.39 [Link]

[Link]
Description
The current output resolution for the document in dots per inch (dpi).
Type
Number (double), read-only.

59.1.40 [Link]

[Link]
Description
The page items (all art item classes) contained in the document.
Type
PageItems, read-only.

59.1.41 [Link]

[Link]
Description
The zero-point of the page in the document without margins, relative to the overall height and width.
Type
Array of 2 numbers.

59.1.42 [Link]

[Link]
Description
The list of paragraph styles in this document.
Type
ParagraphStyles, read-only.

59.1. Properties 259


Illustrator Scripting Guide, Release 0.0.1

59.1.43 [Link]

[Link]
Description
The application that contains this document.
Type
Application, read-only.

59.1.44 [Link]

[Link]
Description
The file associated with the document, which includes the complete path to the file.
Type
File, read-only.

59.1.45 [Link]

[Link]
Description
The path items contained in this document.
Type
PathItems, read-only.

59.1.46 [Link]

[Link]
Description
The patterns contained in this document.
Type
Patterns, read-only.

260 Chapter 59. Document


Illustrator Scripting Guide, Release 0.0.1

59.1.47 [Link]

[Link]
Description
The placed items contained in this document.
Type
PlacedItems, read-only.

59.1.48 [Link]

[Link]
Description
The plug-in items contained in this document.
Type
PluginItems, read-only.

59.1.49 [Link]

[Link]
Description
If true, this document should be printed as tiled output.
Type
Boolean, read-only.

59.1.50 [Link]

[Link]
Description
The document’s raster effect settings.
Type
RasterEffectOptions, read-only.

59.1. Properties 261


Illustrator Scripting Guide, Release 0.0.1

59.1.51 [Link]

[Link]
Description
The raster items contained in this document.
Type
RasterItems, read-only.

59.1.52 [Link]

[Link]
Description
The zero-point of the rulers in the document relative to the bottom left of the document.
Type
Array of 2 numbers.

59.1.53 [Link]

[Link]
Description
The default measurement units for the rulers in the document.
Type
RulerUnits, read-only.

59.1.54 [Link]

[Link]
Description
If true, the document has not been changed since last time it was saved.
Type
Boolean.

262 Chapter 59. Document


Illustrator Scripting Guide, Release 0.0.1

59.1.55 [Link]

[Link]
Description
References to the objects in this document’s current selection, or null when nothing is selected.
A reference to an insertion point is returned when there is an active insertion point in the contents of a selected text art
item. Similarly, a reference to a range of text is returned when characters are selected in the contents of a text art item.
Type
Array of objects.

59.1.56 [Link]

[Link]
Description
If true, placed images should be displayed in the document.
Type
Boolean, read-only.

59.1.57 [Link]

[Link]
Description
If true, long paths should be split when printing.
Type
Boolean, read-only.

59.1.58 [Link]

[Link]
Description
The spot colors contained in this document.
Type
Spots, read-only.

59.1. Properties 263


Illustrator Scripting Guide, Release 0.0.1

59.1.59 [Link]

[Link]
Description
If true, the file is a stationery file.
Type
Boolean, read-only.

59.1.60 [Link]

[Link]
Description
The story items in this document.
Type
Stories, read-only.

59.1.61 [Link]

[Link]
Description
The swatches in this document.
Type
Swatches, read-only.

59.1.62 [Link]

[Link]
Description
The swatch groups in this document.
Type
SwatchGroups, read-only.

264 Chapter 59. Document


Illustrator Scripting Guide, Release 0.0.1

59.1.63 [Link]

[Link]
Description
The art items in the document linked to symbols.
Type
SymbolItems, read-only.

59.1.64 [Link]

[Link]
Description
The symbols in this document.
Type
Symbols, read-only.

59.1.65 [Link]

[Link]
Description
The tags in this document.
Type
Tags, read-only.

59.1.66 [Link]

[Link]
Description
The text frames in this document.
Type
TextFrameItems, read-only.

59.1. Properties 265


Illustrator Scripting Guide, Release 0.0.1

59.1.67 [Link]

[Link]
Description
If true, full pages should be tiled when printing this document.
Type
Boolean, read-only.

59.1.68 [Link]

[Link]
Description
The class name of the referenced object.
Type
String, read-only.

59.1.69 [Link]

[Link]
Description
If true, the printer’s default screen should be used when printing this document.
Type
Boolean, read-only.

59.1.70 [Link]

[Link]
Description
The variables defined in this document.
Type
Variables, read-only.

266 Chapter 59. Document


Illustrator Scripting Guide, Release 0.0.1

59.1.71 [Link]

[Link]
Description
If true, the variables are locked.
Type
Boolean.

59.1.72 [Link]

[Link]
Description
The views contained in this document.
Type
Views, read-only.

59.1.73 [Link]

[Link]
Description
The visible bounds of the document, including stroke width of any objects in the illustration.
Type
Array of 4 numbers, read-only.

59.1.74 [Link]

[Link]
Description
The width of this document.
Type
Number (double), read-only.

59.1. Properties 267


Illustrator Scripting Guide, Release 0.0.1

59.1.75 [Link]

[Link]
Description
The XMP metadata packet associated with this document.
Type
String.

59.2 Methods

59.2.1 [Link]()

[Link]()
Description
Brings the first window associated with the document to the front.
Returns
Nothing.

59.2.2 [Link]()

[Link]([layoutStyle])
Description
Arranges multiple documents in the given layout style.
Parameters

Parameter Type Description


layoutStyle DocumentLayoutStyle, optional The layout style to arrange documents in

Returns
Boolean.

268 Chapter 59. Document


Illustrator Scripting Guide, Release 0.0.1

59.2.3 [Link]()

[Link]([saveOptions])
Description
Closes a document using specified save options.
When you close a document, you should set your document reference to null to prevent your script from accidentally
trying to access closed documents.
Parameters

Parameter Type Description


saveOptions SaveOptions Save options to close with

Returns
Nothing.

59.2.4 [Link]()

[Link]()
Description
Closes the specified non-UI document.
Returns
Nothing.

59.2.5 [Link]()

[Link](coordinate, source, destination)


Description
Converts the given point between artboard and document coordinate systems. Returns the converted point coordinates.
Parameters

Parameter Type Description


coordinate Point Point to convert
source CoordinateSystem Source coordinate system
destination CoordinateSystem Destination coordinate system

Returns
Point.

59.2. Methods 269


Illustrator Scripting Guide, Release 0.0.1

59.2.6 [Link]()

[Link](exportFile, exportFormat [,options])


Description
Exports the document to the specified file using one of the predefined export file formats. 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.
Parameters

Parameter Type Description


exportFile File File to save
exportFormat ExportType Export file format
options Variable, optional todo

Returns
Nothing.

59.2.7 [Link]()

[Link](file)
Description
Exports the current PDF preset values to the file.
Parameters

Parameter Type Description


file File Preset file to export to

Returns
Nothing.

59.2.8 [Link]()

[Link](file)
Description
Exports the current perspective grid preset values to the file.
Parameters

Parameter Type Description


file File Preset file to export to

Returns

270 Chapter 59. Document


Illustrator Scripting Guide, Release 0.0.1

Nothing.

59.2.9 [Link]()

[Link](file)
Description
Exports the current print preset values to the file.
Parameters

Parameter Type Description


file File Preset file to export to

Returns
Nothing.

59.2.10 [Link]()

[Link](fileSpec)
Description
Saves datasets into an XML library. The datasets contain variables and their associated dynamic data.
Parameters

Parameter Type Description


fileSpec File XML Library file to export to

Returns
Nothing.

59.2.11 [Link]()

[Link]([index])
Description
Resizes the artboard at the given index to fit currently selected art. Index default is 0. Returns true on success.
Parameters

Parameter Type Description


index Number (long), optional Artboard index to resize

Returns

59.2. Methods 271


Illustrator Scripting Guide, Release 0.0.1

Boolean.

59.2.12 [Link]()

[Link](uuid)

Note: This functionality was added in Illustrator 24.0. (CC2020)

Description
Retrieves the pageitem using Uuid.
Parameters

Parameter Type Description


uuid String uuid of PageItem

Returns
PageItem.

59.2.13 [Link]()

[Link]()
Description
Retrieves the active plane of the active perspective grid of the document.
Returns
PerspectiveGridPlaneType

59.2.14 [Link]()

[Link]()
Description
Hides the current active grid for the document. If no grid is visible, does nothing. Returns true if a grid is hidden.
Returns
Boolean.

272 Chapter 59. Document


Illustrator Scripting Guide, Release 0.0.1

59.2.15 [Link]()

[Link](imageFile [,clipBounds] [,options])


Description
Captures the artwork content within the clipping boundaries in this document as a raster image, and writes the image
data to a specified file.
If the bounds parameter is omitted, captures the entire artwork.
Parameters

Parameter Type Description


imageFile File Image file to write to
clipBounds Rect, optional Clipping bounds
options ImageCaptureOptions, optional todo

Returns
Nothing.

59.2.16 [Link]()

[Link](fileSpec)
Description
Loads the character styles from the Illustrator file.
Parameters

Parameter Type Description


fileSpec File File to load character styles from

Returns
Nothing.

59.2.17 [Link]()

[Link](fileSpec)
Description
Loads the paragraph styles from the Illustrator file.
Parameters

Parameter Type Description


fileSpec File File to load paragraph styles from

Returns

59.2. Methods 273


Illustrator Scripting Guide, Release 0.0.1

Nothing.

59.2.18 [Link]()

[Link](fileSpec [, replacingPreset])
Description
Loads all PDF presets from a file.
Parameters

Parameter Type Description


fileSpec File File to load PDF presets from
replacingPreset String, optional Whether to replace existing presets

Returns
Nothing.

59.2.19 [Link]()

[Link](printPreset, fileSpec)
Description
Loads the named print preset from the file.
Parameters

Parameter Type Description


printPreset String Name of preset to load
fileSpec File File to load print presets from

Returns
Nothing.

59.2.20 [Link]()

[Link](fileSpec)
Description
Imports a library containing datasets, variables, and their associated dynamic data. Importing variables overwrites
existing variables and datasets.
Parameters

Parameter Type Description


fileSpec File File to import variables from

274 Chapter 59. Document


Illustrator Scripting Guide, Release 0.0.1

Returns
Nothing.

59.2.21 [Link]()

[Link]([options])
Description
Prints the document.
Parameters

Parameter Type Description


options PrintOptions, optional todo

Returns
Nothing.

59.2.22 [Link]()

[Link](sourceArt [, clipBounds] [, options])


Description
Rasterizes the source art(s) within the specified clip bounds. The source art(s) is disposed of as a result of the rasteri-
zation.
Parameters

Parameter Type Description


sourceArt Variable Source art to rasterize
clipBounds Rect, optional Clipping bounds
options RasterizeOptions, optional todo

Returns
RasterItem

59.2.23 [Link]()

[Link]([artboardLayout] [, artboardRowsOrCols] [,
artboardSpacing] [, artboardMoveArtwork])
Description
Rearranges artboards in the document. All arguments are optional.
Default layout style is DocumentArtboard [Link].

59.2. Methods 275


Illustrator Scripting Guide, Release 0.0.1

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

Parameter Type Description


artboardLayout DocumentArtboardLayout, optional Artboard layout
artboardRowsOrCols Integer, optional Number of rows or columns
artboardSpacing Number, optional Number of pixels for spacing
artboardMoveArtwork Boolean, optional Whether to move artwork with the artboards

Returns
Boolean.

59.2.24 [Link]()

[Link]()
Description
Saves the document in it current location.
Returns
Nothing.

59.2.25 [Link]()

[Link](saveIn [, options])
Description
Saves the document in the specified file as an Illustrator, EPS, or PDF file.
Parameters

Parameter Type Description


saveIn File File to save the document as
options SaveOptions, optional Save options to close with

Returns
Nothing.

276 Chapter 59. Document


Illustrator Scripting Guide, Release 0.0.1

59.2.26 [Link]()

[Link](saveIn)
Description
Saves the non-UI document at the specified path
Parameters

Parameter Type Description


saveIn File File to save the document as

Returns
Nothing.

59.2.27 [Link]()

[Link]()
Description
Selects the objects on the currently active artboard. Returns true on success.
Returns
Boolean.

59.2.28 [Link]()

[Link](gridPlane)
Description
Sets the active plane of the active perspective grid of the document. Returns true on success.
Parameters

Parameter Type Description


gridPlane PerspectiveGridPlaneType Grid plane type

Returns
Boolean.

59.2. Methods 277


Illustrator Scripting Guide, Release 0.0.1

59.2.29 [Link]()

[Link](gridType, presetName)
Description
Selects a predefined preset to define grid for the current document. Returns true on success.
Parameters

Parameter Type Description


gridType PerspectiveGridType Grid type
presetName String Preset name to select

Returns
Boolean.

59.2.30 [Link]()

[Link]()
Description
Shows the current active grid for the document, or if no grid is active, shows the default grid. Returns true on success.
Returns
Boolean.

59.2.31 [Link]()

[Link](imageFile, windowSize)
Description
Captures the current document window to the target TIFF image file.
Parameters

Parameter Type Description


imageFile File Image file to save as
windowSize Array of 2 numbers Window size

Returns
Nothing.

278 Chapter 59. Document


Illustrator Scripting Guide, Release 0.0.1

59.3 Example

59.3.1 Deselecting all objects in the current document

Note: The frontmost document can be referred to as either activeDocument or documents[0.

var docRef = activeDocument;


[Link] = null;

59.3.2 Closing a document

// Closes the active document without saving changes


if ( [Link] > 0 ) {
var aiDocument = [Link];
[Link]( [Link] );
aiDocument = null;
}

59.3.3 Creating a document with defaults

// Creates a new document if none exists then sets fill and stroke defaults to true
var doc;
if ([Link] == 0) {
doc = [Link]();
} else {
doc = [Link];
}

[Link] = true;
[Link] = true;

59.3. Example 279


Illustrator Scripting Guide, Release 0.0.1

280 Chapter 59. Document


CHAPTER

SIXTY

DOCUMENTPRESET

documentPreset
Description
A preset document template to use when creating a new document. See [Link]().

60.1 Properties

60.1.1 [Link]

[Link]
Description
The layout of artboards in the new document. Default: GridByRow.
Type
DocumentArtboardLayout

60.1.2 [Link]

[Link]
Description
The number of rows (for rows layout) or columns (for column layout) of artboards. Range: 1 to (numArtboards - 1)
or 1 for single row or column layouts. Default: 1
Type
Number (long).

281
Illustrator Scripting Guide, Release 0.0.1

60.1.3 [Link]

[Link]
Description
The spacing between artboards in the new document. Default: 20.0
Type
Number (double).

60.1.4 [Link]

[Link]
Description
The color space for the new document.
Type
DocumentColorSpace

60.1.5 [Link]

[Link]
Description
The document link for bleed values.
Type
Boolean.

60.1.6 [Link]

[Link]
Description
The document bleed offset rectangle.
Type
Rectangle.

282 Chapter 60. DocumentPreset


Illustrator Scripting Guide, Release 0.0.1

60.1.7 [Link]

[Link]
Description
The height in document points. Default: 792.0
Type
Number (double).

60.1.8 [Link]

[Link]
Description
The number of artboards for the new document. Range: 1 to 100. Default: 1.
Type
Number (long).

60.1.9 [Link]

[Link]
Description
The preview mode for the new document.
Type
DocumentPreviewMode

60.1.10 [Link]

[Link]
Description
The raster resolution for the new document.
Type
DocumentRasterResolution

60.1. Properties 283


Illustrator Scripting Guide, Release 0.0.1

60.1.11 [Link]

[Link]
Description
The document title.
Type
String.

60.1.12 [Link]

[Link]
Description
The transparency grid color for the new document.
Type
DocumentTransparencyGrid

60.1.13 [Link]

[Link]
Description
The class name of the referenced object.
Type
String, read-only.

60.1.14 [Link]

[Link]
Description
The ruler units for the new document.
Type
RulerUnits

284 Chapter 60. DocumentPreset


Illustrator Scripting Guide, Release 0.0.1

60.1.15 [Link]

[Link]
Description
The width in document points. Default: 612.0
Type
Number (double).

60.1. Properties 285


Illustrator Scripting Guide, Release 0.0.1

286 Chapter 60. DocumentPreset


CHAPTER

SIXTYONE

DOCUMENTS

[Link]
Description
A collection of Document objects.

61.1 Properties

61.1.1 [Link]

[Link]
Description
The number of objects in the collection.
Type
Number, read-only.

61.1.2 [Link]

[Link]
Description
The parent of this object.
Type
Object, read-only.

287
Illustrator Scripting Guide, Release 0.0.1

61.1.3 [Link]

[Link]
Description
The class name of the referenced object.
Type
String, read-only.

61.2 Methods

61.2.1 [Link]()

[Link]([documentColorSpace] [, width] [, height] [, numArtBoards]


[, artboardLayout] [, artboardSpacing] [, artboardRowsOrCols]
)

Description
Creates a new document using optional parameters and returns a reference to the new document.
Parameters

Parameter Type Description


documentColorSpace DocumentColorSpace, optional Color space of document
width Number (double), optional Width of document to add
height Number (double), optional Height of document to add
numArtBoards Number (long), optional Number of artboards to create
artboardLayout DocumentArtboardLayout, optional Artboard layout
artboardSpacing Number, optional Number of pixels for spacing
artboardRowsOrCols Integer, optional Number of rows or columns

Returns
Document

61.2.2 [Link]()

[Link](startupPreset [, presetSettings] [, showOptionsDialog])


Description
Creates a document from the preset, replacing any provided setting values, and returns a reference to the new document.
Parameters

288 Chapter 61. Documents


Illustrator Scripting Guide, Release 0.0.1

Parameter Type Description


startupPreset String Startup preset to use
presetSettings DocumentPreset, optional Preset document template
showOptionsDialog Boolean, optional Whether to show options dialog

Returns
Document

61.2.3 [Link]()

[Link](startupPreset)
Description
Creates a document without showing in UI.
Parameters

Parameter Type Description


startupPreset String Startup preset to use

Returns
Document

61.2.4 [Link]()

[Link](name)
Description
Gets the first element in the collection with the specified name.
Parameters

Parameter Type Description


name String Name of element to get

Returns
Document

61.2. Methods 289


Illustrator Scripting Guide, Release 0.0.1

61.2.5 [Link]()

[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number String or number key

Returns
Document

61.3 Example

61.3.1 Creating a new document

// Creates a new document with an RGB color space

[Link]([Link]);

290 Chapter 61. Documents


CHAPTER

SIXTYTWO

EPSSAVEOPTIONS

epsSaveOptions
Description
Options for saving a document as an Illustrator EPS file, used with the [Link]() method.
All properties are optional.

62.1 Properties

62.1.1 [Link]

[Link]
Description
If saveMultipleArtboards is true, this is considered for multi-asset extraction, which specifies the artboard range.
An empty string extracts all the artboards. Default: empty string
Type
String.

62.1.2 [Link]

[Link]
Description
If true, use CMYK PostScript.
Type
Boolean.

291
Illustrator Scripting Guide, Release 0.0.1

62.1.3 [Link]

[Link]
Description
Specifies the version of the EPS file format to save.
Default: Compatibility.ILLUSTRATOR1719.
Type
Compatibility

62.1.4 [Link]

[Link]
Description
If true, create a raster item of the gradient or gradient mesh so that PostScript Level 2 printers can print the object.
Default: false.
Type
Boolean.

62.1.5 [Link]

[Link]
Description
If true, all fonts used by the document should be embedded in the saved file (version 7 or later).
Default: false.
Type
Boolean.

62.1.6 [Link]

[Link]
Description
If true, linked image files are to be included in the saved document.
Type
Boolean.

292 Chapter 62. EPSSaveOptions


Illustrator Scripting Guide, Release 0.0.1

62.1.7 [Link]

[Link]
Description
How should transparency be flattened for file formats older than Illustrator 9.
Type
OutputFlattening

62.1.8 [Link]

[Link]
Description
If true, thumbnail image of the EPS artwork should be included.
Type
Boolean.

62.1.9 [Link]

[Link]
Description
Whether to preserve, discard, or simulate the overprint.
Default: [Link].
Type
PDFOverprint

62.1.10 [Link]

[Link]
Description
PostScript Language Level to use (Level 1 valid for file format version 8 or older).
Default: EPSPostScriptLevelEnum.LEVEL2.
Type
EPSPostScriptLevelEnum

62.1. Properties 293


Illustrator Scripting Guide, Release 0.0.1

62.1.11 [Link]

[Link]
Description
The format for the EPS preview image.
Type
EPSPreview

62.1.12 [Link]

[Link]
Description
If true, all artboards or range of artboards are saved.
Default: false.
Type
Boolean.

62.1.13 [Link]

[Link]
Description
The class name of the referenced object.
Type
String, read-only.

62.2 Example

62.2.1 Exporting to EPS format

// Exports current document to destFile as an EPS file with specified options,


// destFile contains the full path including the file name

function exportFileAsEPS(destFile) {
var newFile = new File(destFile);
var saveDoc;
if ([Link] == 0) {
saveDoc = [Link]();
} else {
(continues on next page)

294 Chapter 62. EPSSaveOptions


Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)


saveDoc = [Link];
}

var saveOpts = new ePSSaveOptions();


[Link] = true;
[Link] = true;

[Link](newFile, saveOpts);
}

62.2. Example 295


Illustrator Scripting Guide, Release 0.0.1

296 Chapter 62. EPSSaveOptions


CHAPTER

SIXTYTHREE

EXPORTOPTIONSAUTOCAD

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

63.1 Properties

63.1.1 [Link]

[Link]
Description
If true, paths are altered if needed to maintain appearance.
Default: false.
Type
Boolean.

63.1.2 [Link]

[Link]
Description
The colors exported into the AutoCAD file.
Type
AutoCADColors

297
Illustrator Scripting Guide, Release 0.0.1

63.1.3 [Link]

[Link]
Description
If true, text is converted to vector paths; preserves the visual appearance of type.
Default: false.
Type
Boolean.

63.1.4 [Link]

[Link]
Description
The format to which the file is exported.
Default: [Link].
Type
AutoCADExportFileFormat

63.1.5 [Link]

[Link]
Description
Specifies whether to preserve appearance or editability during export.
Default: [Link].
Type
AutoCADExportOption

63.1.6 [Link]

[Link]
Description
If true, only selected artwork is exported.
Default: false.
Type
Boolean.

298 Chapter 63. ExportOptionsAutoCAD


Illustrator Scripting Guide, Release 0.0.1

63.1.7 [Link]

[Link]
Description
The format in which raster art is exported.
Type
AutoCADRasterFormat

63.1.8 [Link]

[Link]
Description
If true, line weights are scaled by the same scaling factor as the rest of the drawing.
Default: false.
Type
Boolean.

63.1.9 [Link]

[Link]
Description
The class name of the referenced object.
Type
String, read-only.

63.1.10 [Link]

[Link]
Description
The measurement units from which to map.
Type
AutoCADUnit

63.1. Properties 299


Illustrator Scripting Guide, Release 0.0.1

63.1.11 [Link]

[Link]
Description
The ratio (as a percentage) by which output is scaled.
Range: 0 to 1000
Type
Number (double).

63.1.12 [Link]

[Link]
Description
The release of AutoCAD to which the file is exported.
Default: AutoCADCompatibility.AutoCADRelease24.
Type
AutoCADCompatibility

300 Chapter 63. ExportOptionsAutoCAD


CHAPTER

SIXTYFOUR

EXPORTOPTIONSFLASH

exportOptionsFlash
Description
Options for exporting a document as a Macromedia® Flash® (SWF) file, used with the [Link]() method.
All properties are optional.
When you export a document, the appropriate file extension is appended automatically. You should not include any file
extension in the file specification.

64.1 Properties

64.1.1 [Link]

[Link]
Description
How the art should be clipped during output. Default: [Link].
Type
ArtClippingOption

64.1.2 [Link]

[Link]
Description
If saveMultipleArtboards is true, this is considered for multi-asset extraction, which specifies the artboard range.
An empty string extracts all the artboards. Default: empty String.
Type
String.

301
Illustrator Scripting Guide, Release 0.0.1

64.1.3 [Link]

[Link]
Description
The background color of the exported Flash frames.
Type
RGBColor

64.1.4 [Link]

[Link]
Description
A list of layers to be included as the static background of the exported Flash frames.
Type
Array of Layers

64.1.5 [Link]

[Link]
Description
The animation type for blended objects. Default: [Link].
Type
BlendAnimationType

64.1.6 [Link]

[Link]
Description
If true, the exported file should be exported compressed. Default: false.
Type
Boolean.

302 Chapter 64. ExportOptionsFlash


Illustrator Scripting Guide, Release 0.0.1

64.1.7 [Link]

[Link]
Description
If true, all text is converted to vector paths; preserves the visual appearance of type in all Flash players. Default:
false.
Type
Boolean.

64.1.8 [Link]

[Link]
Description
The amount of curve information that should be presented. Default: 7.
Type
Number (long).

64.1.9 [Link]

[Link]
Description
If true, export all symbols defined in the palette. Default: false.
Type
Boolean.

64.1.10 [Link]

[Link]
Description
The style in which the exported data should be created in Flash. Default: [Link].
Type
FlashExportStyle

64.1. Properties 303


Illustrator Scripting Guide, Release 0.0.1

64.1.11 [Link]

[Link]
Description
The version of the exported SWF file. Default: FlashExportVersion.FlashVersion9.
Type
FlashExportVersion

64.1.12 [Link]

[Link]
Description
The display rate in frames per second. Range: 0.01–120.0. Default: 12.0.
Type
Number (double).

64.1.13 [Link]

[Link]
Description
If true, ignore kerning information in text objects. Default: false.
Type
Boolean.

64.1.14 [Link]

[Link]
Description
How should the image in the exported Flash file be compressed. Default: [Link].
Type
FlashImageFormat

304 Chapter 64. ExportOptionsFlash


Illustrator Scripting Guide, Release 0.0.1

64.1.15 [Link]

[Link]
Description
If true, include minimal XMP metadata in the SWF file. Default: false.
Type
Boolean.

64.1.16 [Link]

[Link]
Description
Specifies the JPEG method to use. Default: [Link].
Type
FlashJPEGMethod

64.1.17 [Link]

[Link]
Description
Level of compression to use. Range 1 to 10. Default: 3.
Type
Number (long).

64.1.18 [Link]

[Link]
Description
The order in which layers are exported to Flash frames. Default: [Link].
Type
LayerOrderType

64.1. Properties 305


Illustrator Scripting Guide, Release 0.0.1

64.1.19 [Link]

[Link]
Description
If true, the Flash file is set to loop when run. Default: false.
Type
Boolean.

64.1.20 [Link]

[Link]
Description
The access level for the exported SWF file. Default: [Link].
Type
FlashPlaybackSecurity

64.1.21 [Link]

[Link]
Description
If true, preserve appearance. If false, preserve editability. Default: false.
Type
Boolean.

64.1.22 [Link]

[Link]
Description
If true, export as read-only file. Default: false.
Type
Boolean.

306 Chapter 64. ExportOptionsFlash


Illustrator Scripting Guide, Release 0.0.1

64.1.23 [Link]

[Link]
Description
If a file with the same name already exists, should it be replaced. Default: [Link].
Type
SaveOptions

64.1.24 [Link]

[Link]
Description
The resolution in pixels per inch. Range: 72–2400. Default: 72.
Type
Number (double).

64.1.25 [Link]

[Link]
Description
If true, all artboards or range of artboards are saved. Default: false.
Type
Boolean.

64.1.26 [Link]

[Link]
Description
The class name of the referenced object.
Type
String, read-only.

64.1. Properties 307


Illustrator Scripting Guide, Release 0.0.1

64.2 Example

64.2.1 Exporting to Flash format

// Exports current document to destFile as a flash file with specified options,


// destFile contains the full path including the file name

function exportToFlashFile(destFile) {
if ([Link] > 0) {
var exportOptions = new ExportOptionsFlash();
[Link] = 150;

var type = [Link];


var fileSpec = new File(destFile);

[Link](fileSpec, type, exportOptions);


}
}

308 Chapter 64. ExportOptionsFlash


CHAPTER

SIXTYFIVE

EXPORTOPTIONSGIF

exportOptionsGIF
Description
Options for exporting a document as a GIF file, used with the [Link]() method. All properties are
optional.
When you export a document, the appropriate file extension is appended automatically. You should not include any file
extension in the file specification.

65.1 Properties

65.1.1 [Link]

[Link]
Description
If true, the exported image should be anti-aliased. Default: true.
Type
Boolean.

65.1.2 [Link]

[Link]
Description
If true, the exported image should be clipped to the art board. Default: false.
Type
Boolean.

309
Illustrator Scripting Guide, Release 0.0.1

65.1.3 [Link]

[Link]
Description
The number of colors in the exported image’s color table. Range: 2 to 256. Default: 128.
Type
Number (long).

65.1.4 [Link]

[Link]
Description
The method used to dither colors in the exported image. Default: [Link].
Type
ColorDitherMethod

65.1.5 [Link]

[Link]
Description
The method used to reduce the number of colors in the exported image. Default: ColorReductionMethod.
SELECTIVE.
Type
ColorReductionMethod

65.1.6 [Link]

[Link]
Description
How much should the colors of the exported image be dithered, where 100.0 is 100%.
Type
Number (long).

310 Chapter 65. ExportOptionsGIF


Illustrator Scripting Guide, Release 0.0.1

65.1.7 [Link]

[Link]
Description
The horizontal scaling factor to apply to the exported image, where 100.0 is 100%. Default: 100.0.
Type
Number (double).

65.1.8 [Link]

[Link]
Description
The level of information loss allowed during compression, where 100.0 is 100%.
Type
Number (long).

65.1.9 [Link]

[Link]
Description
If true, the exported image should be interlaced. Default: false.
Type
Boolean.

65.1.10 [Link]

[Link]
Description
If true, the art board should be matted with a color. Default: true.
Type
Boolean.

65.1. Properties 311


Illustrator Scripting Guide, Release 0.0.1

65.1.11 [Link]

[Link]
Description
The color to use when matting the art board. Default: WHITE.
Type
RGBColor

65.1.12 [Link]

[Link]
Description
If true, the exported image should be saved with an accompanying HTML file. Default: false.
Type
Boolean.

65.1.13 [Link]

[Link]
Description
If true, the exported image should use transparency. Default: true.
Type
Boolean.

65.1.14 [Link]

[Link]
Description
The class name of the referenced object.
Type
String, read-only.

312 Chapter 65. ExportOptionsGIF


Illustrator Scripting Guide, Release 0.0.1

65.1.15 [Link]

[Link]
Description
The vertical scaling factor to apply to the exported image, where 100.0 is 100%. Default: 100.0.
Type
Number (double).

65.1.16 [Link]

[Link]
Description
Howmuchshouldthecolortablebechangedtomatch the web palette, where 100 is maximum. Default: 0.
Type
Number (long).

65.2 Example

65.2.1 Exporting to GIF format

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


// dest contains the full path including the file name

function exportToGIFFile(dest) {
if ([Link] > 0) {
var exportOptions = new ExportOptionsGIF();
[Link] = false;
[Link] = 64;
[Link] = [Link];

var type = [Link];


var fileSpec = new File(dest);

[Link](fileSpec, type, exportOptions);


}
}

65.2. Example 313


Illustrator Scripting Guide, Release 0.0.1

314 Chapter 65. ExportOptionsGIF


CHAPTER

SIXTYSIX

EXPORTOPTIONSJPEG

exportOptionsJPEG
Description
Options for exporting a document as a JPEG file, used with the [Link]() method. All properties are
optional.
When you export a document, the appropriate file extension is appended automatically. You should not include any file
extension in the file specification.

66.1 Properties

66.1.1 [Link]

[Link]
Description
If true, the exported image should be anti-aliased. Default: true.
Type
Boolean.

66.1.2 [Link]

[Link]
Description
If true, the exported image should be clipped to the art board.
Type
Boolean.

315
Illustrator Scripting Guide, Release 0.0.1

66.1.3 [Link]

[Link]
Description
The amount of blur to apply to the exported image. Range: 0.0 to 2.0. Default: 0.0.
Type
Number (double).

66.1.4 [Link]

[Link]
Description
The horizontal scaling factor to apply to the exported image, where 100.0 is 100%. Default: 100.0.
Type
Number (double).

66.1.5 [Link]

[Link]
Description
If true, the art board should be matted with a color. Default: true.
Type
Boolean.

66.1.6 [Link]

[Link]
Description
The color to use when matting the art board. Default: white.
Type
RGBColor

316 Chapter 66. ExportOptionsJPEG


Illustrator Scripting Guide, Release 0.0.1

66.1.7 [Link]

[Link]
Description
If true, the exported image should be optimized for web viewing. Default: true.
Type
Boolean.

66.1.8 [Link]

[Link]
Description
The quality of the exported image. Range: 0 to 100. Default: 30.
Type
Number (long).

66.1.9 [Link]

[Link]
Description
If true, the exported image should be saved with an accompanying HTML file. Default: false.
Type
Boolean.

66.1.10 [Link]

[Link]
Description
The class name of the referenced object.
Type
String, read-only.

66.1. Properties 317


Illustrator Scripting Guide, Release 0.0.1

66.1.11 [Link]

[Link]
Description
The vertical scaling factor to apply to the exported image. Range: 0.0 to 776.19. Default: 100.0.
Type
Number (double)

66.2 Example

66.2.1 Exporting to JPEG format

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


// dest contains the full path including the file name

function exportFileToJPEG(dest) {
if ([Link] > 0) {
var exportOptions = new ExportOptionsJPEG();
[Link] = false;
[Link] = 70;

var type = [Link];


var fileSpec = new File(dest);

[Link](fileSpec, type, exportOptions);


}
}

318 Chapter 66. ExportOptionsJPEG


CHAPTER

SIXTYSEVEN

EXPORTOPTIONSPHOTOSHOP

exportOptionsPhotoshop
Description
Options for exporting a document as a Photoshop file, used with the [Link]() method. All properties are
optional.
When you export a document, the appropriate file extension is appended automatically. You should not include any file
extension in the file specification.

67.1 Properties

67.1.1 [Link]

[Link]
Description
If true, the exported image should be anti-aliased. Default: true.
Type
Boolean.

67.1.2 [Link]

[Link]
Description
If saveMultipleArtboards is true, this is considered for multi-asset extraction, which specifies the artboard range.
An empty string extracts all the artboards. Default: empty String.
Type
String.

319
Illustrator Scripting Guide, Release 0.0.1

67.1.3 [Link]

[Link]
Description
If true, text objects should be exported as editable text layers. Default: true.
Type
Boolean.

67.1.4 [Link]

[Link]
Description
If true, an ICC profile should be embedded in the exported file. Default: false.
Type
Boolean.

67.1.5 [Link]

[Link]
Description
The color space of the exported file. Default: [Link].
Type
ImageColorSpace

67.1.6 [Link]

[Link]
Description
Preserve as much of the original document’s structure as possible when exporting. Default: true.
Type
Boolean.

320 Chapter 67. ExportOptionsPhotoshop


Illustrator Scripting Guide, Release 0.0.1

67.1.7 [Link]

[Link]
Description
Resolution of the exported file in dots per inch (dpi). Range: 72.0 to 2400.0. Default: 150.0.
Type
Number (double).

67.1.8 [Link]

[Link]
Description
If true, all artboards or range of artboards are saved. Default: false.
Type
Boolean.

67.1.9 [Link]

[Link]
Description
The class name of the referenced object.
Type
String, read-only.

67.1.10 [Link]

[Link]
Description
If true, a warning dialog should be displayed in case of conflicts in the export settings. Default: true.
Type
Boolean.

67.1. Properties 321


Illustrator Scripting Guide, Release 0.0.1

67.1.11 [Link]

[Link]
Description
If true, the document layers should be presented in the exported document. Default: true.
Type
Boolean.

67.2 Example

67.2.1 Exporting to Photoshop format

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


// dest contains the full path including the file name

function exportFileToPSD(dest) {
if ([Link] > 0) {
var exportOptions = new ExportOptionsPhotoshop();
[Link] = 150;

var type = [Link];


var fileSpec = new File(dest);

[Link](fileSpec, type, exportOptions);


}
}

322 Chapter 67. ExportOptionsPhotoshop


CHAPTER

SIXTYEIGHT

EXPORTOPTIONSPNG24

exportOptionsPNG24
Description
Options for exporting a document as a 24-bit PNG file, used with the [Link]() method. All properties
are optional.
When you export a document, the appropriate file extension is appended automatically. You should not include any file
extension in the file specification.

68.1 Properties

68.1.1 [Link]

[Link]
Description
If true, the exported image be anti-aliased. Default: true.
Type
Boolean.

68.1.2 [Link]

[Link]
Description
If true, the exported image be clipped to the art board. Default: false.
Type
Boolean.

323
Illustrator Scripting Guide, Release 0.0.1

68.1.3 [Link]

[Link]
Description
The horizontal scaling factor to apply to the exported image, where 100.0 is 100%. Default: 100.0.
Type
Number (double).

68.1.4 [Link]

[Link]
Description
If true, the art board be matted with a color. Default: true.
Type
Boolean.

68.1.5 [Link]

[Link]
Description
The color to use when matting the art board. Default: white.
Type
RGBColor

68.1.6 [Link]

[Link]
Description
If true, the exported image be saved with an accompanying HTML file. Default: false.
Type
Boolean.

324 Chapter 68. ExportOptionsPNG24


Illustrator Scripting Guide, Release 0.0.1

68.1.7 [Link]

[Link]
Description
If true, the exported image use transparency. Default: true.
Type
Boolean.

68.1.8 [Link]

[Link]
Description
The class name of the referenced object.
Type
String, read-only.

68.1.9 [Link]

[Link]
Description
The vertical scaling factor to apply to the exported image, where 100.0 is 100. Default: 100.0.
Type
Number (double).

68.2 Example

68.2.1 Exporting to PNG24 format

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


// dest contains the full path including the file name,
// saveAsHTML option creates an HTML version with the PNG file in an images folder

function exportFileToPNG24(dest) {
if ([Link] > 0) {
var exportOptions = new ExportOptionsPNG24();
[Link] = false;
[Link] = false;
[Link] = true;
(continues on next page)

68.2. Example 325


Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)

var type = ExportType.PNG24;


var fileSpec = new File(dest);

[Link](fileSpec, type, exportOptions);


}
}

326 Chapter 68. ExportOptionsPNG24


CHAPTER

SIXTYNINE

EXPORTOPTIONSPNG8

exportOptionsPNG8
Description
Options for exporting a document as an 8-bit PNG file, used with the [Link]() method. All properties
are optional.
When you export a document, the appropriate file extension is appended automatically. You should not include any file
extension in the file specification.

69.1 Properties

69.1.1 [Link]

[Link]
Description
If true, the exported image should be anti-aliased. Default: true.
Type
Boolean.

69.1.2 [Link]

[Link]
Description
If true, the exported image should be clipped to the art board. Default: false.
Type
Boolean.

327
Illustrator Scripting Guide, Release 0.0.1

69.1.3 [Link]

[Link]
Description
The number of colors in the exported image’s color table. Range: 2 to 256. Default: 128.
Type
Number (long).

69.1.4 [Link]

[Link]
Description
The method used to dither colors in the exported image. Default: [Link].
Type
ColorDitherMethod

69.1.5 [Link]

[Link]
Description
The method used to reduce the number of colors in the exported image. Default: ColorReductionMethod.
SELECTIVE.
Type
ColorReductionMethod

69.1.6 [Link]

[Link]
Description
The amount (as a percentage) that the colors of the exported image are dithered, where 100.0 is 100%. Range: 0 to
100. Default: 88.
Type
Number (long).

328 Chapter 69. ExportOptionsPNG8


Illustrator Scripting Guide, Release 0.0.1

69.1.7 [Link]

[Link]
Description
The horizontal scaling factor to apply to the exported image, where 100.0 is 100%. Default: 100.0.
Type
Number (double).

69.1.8 [Link]

[Link]
Description
If true, the exported image should be interlaced. Default: false.
Type
Boolean.

69.1.9 [Link]

[Link]
Description
If true, the art board should be matted with a color. Default: true.
Type
Boolean.

69.1.10 [Link]

[Link]
Description
The color to use when matting the art board. Default: white.
Type
RGBColor

69.1. Properties 329


Illustrator Scripting Guide, Release 0.0.1

69.1.11 [Link]

[Link]
Description
If true, the exported image be saved with an accompanying HTML file. Default: false.
Type
Boolean.

69.1.12 [Link]

[Link]
Description
If true, the exported image use transparency. Default: true.
Type
Boolean.

69.1.13 [Link]

[Link]
Description
The class name of the referenced object.
Type
String, read-only.

69.1.14 [Link]

[Link]
Description
The vertical scaling factor to apply to the exported image, where 100.0 is 100. Default: 100.0.
Type
Number (double).

330 Chapter 69. ExportOptionsPNG8


Illustrator Scripting Guide, Release 0.0.1

69.1.15 [Link]

[Link]
Description
Specifies how much the color table should be changed to match the web palette, where 100 is maximum. Default: 0.
Type
Number (long).

69.2 Example

69.2.1 Exporting to PNG8 format

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


// dest contains the full path including the file name

function exportFileToPNG8(dest) {
if ([Link] > 0) {
var exportOptions = new ExportOptionsPNG8();
[Link] = 8;
[Link] = false;

var type = ExportType.PNG8;


var fileSpec = new File(dest);

[Link](fileSpec, type, exportOptions);


}
}

69.2. Example 331


Illustrator Scripting Guide, Release 0.0.1

332 Chapter 69. ExportOptionsPNG8


CHAPTER

SEVENTY

EXPORTOPTIONSSVG

exportOptionsSVG
Description
Options for exporting a document as a SVG file, used with the [Link]() method. All properties are
optional.
When you export a document, the appropriate file extension is appended automatically. You should not include any file
extension in the file specification.

70.1 Properties

70.1.1 [Link]

[Link]
Description
A 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.
Type
String.

70.1.2 [Link]

[Link]
Description
If true, the exported file should be compressed. Default: false.
Type
Boolean.

333
Illustrator Scripting Guide, Release 0.0.1

70.1.3 [Link]

[Link]
Description
The decimal precision for element coordinate values. Range: 1 to 7. Default: 3.
Type
Number (long)

70.1.4 [Link]

[Link]
Description
How the CSS properties of the document should be included in the exported file. Default:
[Link].
Type
SVGCSSPropertyLocation

70.1.5 [Link]

[Link]
Description
How the text in the document should be encoded. Default: [Link].
Type
SVGDocumentEncoding

70.1.6 [Link]

[Link]
Description
The SVG version to which the file should conform. Default: SVGDTDVersion.SVG1_1.
Type
SVGDTDVersion

334 Chapter 70. ExportOptionsSVG


Illustrator Scripting Guide, Release 0.0.1

70.1.7 [Link]

[Link]
Description
If true, the raster images contained in the document should be embedded in the exported file. Default: false.
Type
Boolean.

70.1.8 [Link]

[Link]
Description
Which font glyphs should be included in the exported file. Default: [Link].
Type
SVGFontSubsetting

70.1.9 [Link]

[Link]
Description
The type of font to included in the exported file. Default: [Link].
Type
SVGFontType

70.1.10 [Link]

[Link]
Description
If true, file information should be saved in the exported file. Default: false.
Type
Boolean.

70.1. Properties 335


Illustrator Scripting Guide, Release 0.0.1

70.1.11 [Link]

[Link]
Description
If true, save unused styles in the exported file. Default: false.
Type
Boolean.

70.1.12 [Link]

[Link]
Description
If true, variables and datasets should be saved in the exported file. Default: false.
Type
Boolean.

70.1.13 [Link]

[Link]
Description
If true, the exported file should be optimized for the SVG Viewer. Default: false.
Type
Boolean.

70.1.14 [Link]

[Link]
Description
If true, Illustrator editing capabilities should be preserved when exporting the document. Default: false.
Type
Boolean.

336 Chapter 70. ExportOptionsSVG


Illustrator Scripting Guide, Release 0.0.1

70.1.15 [Link]

[Link]
Description
If true, save the artboards specified by artboardRange in the exported file. Default: false.
Type
Boolean.

70.1.16 [Link]

[Link]
Description
If true, slice data should be exported with the file. Default: false.
Type
Boolean.

70.1.17 [Link]

[Link]
Description
If true, SVG automatic kerning is allowed in the file. Default: false.
Type
Boolean.

70.1.18 [Link]

[Link]
Description
If true, the SVG text-on-path construct is allowed in the file. Default: false.
Type
Boolean.

70.1. Properties 337


Illustrator Scripting Guide, Release 0.0.1

70.1.19 [Link]

[Link]
Description
The class name of the referenced object.
Type
String, read-only.

70.2 Example

70.2.1 Exporting to SVG format

// Exports current document to dest as an SVG file with specified options,


// dest contains the full path including the file name

function exportFileToSVG(dest) {
if ([Link] > 0) {
var exportOptions = new ExportOptionsSVG();
[Link] = true;
[Link] = false;
[Link] = [Link];

var type = [Link];


var fileSpec = new File(dest);

[Link](fileSpec, type, exportOptions);


}
}

338 Chapter 70. ExportOptionsSVG


CHAPTER

SEVENTYONE

EXPORTOPTIONSTIFF

exportOptionsTIFF
Description
Options for exporting a document as a TIFF file, used with the [Link]() method. All properties are
optional.
When you export a document, the appropriate file extension is appended automatically. You should not include any file
extension in the file specification.

71.1 Properties

71.1.1 [Link]

[Link]
Description
If true, the exported image should be anti-aliased. Default: true.
Type
Boolean.

71.1.2 [Link]

[Link]
Description
If saveMultipleArtboards is true, this is considered for multi-asset extraction, which specifies the artboard range.
An empty string extracts all the artboards. Default: empty String.
Type
String.

339
Illustrator Scripting Guide, Release 0.0.1

71.1.3 [Link]

[Link]
Description
The byte order to use in the new file.
Type
TIFFByteOrder

71.1.4 [Link]

[Link]
Description
The color space of the exported file. Default: [Link].
Type
ImageColorSpace

71.1.5 [Link]

[Link]
Description
If true, use IZW compression in the new file.
Type
Boolean.

71.1.6 [Link]

[Link]
Description
Resolution of the exported file in dots per inch (dpi). Range: 72.0 to 2400.0. Default: 150.0.
Type
Number (double).

340 Chapter 71. ExportOptionsTIFF


Illustrator Scripting Guide, Release 0.0.1

71.1.7 [Link]

[Link]
Description
If true, all artboards or range of artboards are saved. Default: false.
Type
Number (double).

71.2 Example

71.2.1 Exporting to TIFF format

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


// dest contains the full path including the file name

function exportFileToPSD(dest) {
if ([Link] > 0) {
var exportOptions = new ExportOptionsTIFF();
[Link] = 150;
[Link] = [Link];
[Link] = false;

var type = [Link];


var fileSpec = new File(dest);

[Link](fileSpec, type, exportOptions);


}
}

71.2. Example 341


Illustrator Scripting Guide, Release 0.0.1

342 Chapter 71. ExportOptionsTIFF


CHAPTER

SEVENTYTWO

FXGSAVEOPTIONS

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

72.1 Properties

72.1.1 [Link]

[Link]
Description
If saveMultipleArtboards is true, this is considered for multi-asset extraction, which specifies the artboard range. An
empty string extracts all the artboards. Default: empty String.
Type
String.

72.1.2 [Link]

[Link]
Description
The policy used by FXG to expand blends. Default: [Link].
Type
BlendsExpandPolicy

343
Illustrator Scripting Guide, Release 0.0.1

72.1.3 [Link]

[Link]
Description
If true, linked images are downsampled (at 72 dpi). Default: false.
Type
Boolean.

72.1.4 [Link]

[Link]
Description
The policy used by FXG to preserve filters. Default: [Link].
Type
FiltersPreservePolicy

72.1.5 [Link]

[Link]
Description
The policy used by FXG to preserve gradients. Default: GradientsPreservePolicy.
AUTOMATICALLYCONVERTGRADIENTS.
Type
GradientsPreservePolicy

72.1.6 [Link]

[Link]
Description
If true, unused symbols are included. Default: false.
Type
Boolean.

344 Chapter 72. FXGSaveOptions


Illustrator Scripting Guide, Release 0.0.1

72.1.7 [Link]

[Link]
Description
If true, the editing capabilities of FXG are preserved. Default: true.
Type
Boolean.

72.1.8 [Link]

[Link]
Description
If true, all artboards or range of artboards are saved. Default: false.
Type
Boolean.

72.1.9 [Link]

[Link]
Description
The policy used by FXG to preserve text. Default: [Link].
Type
TextPreservePolicy

72.1.10 [Link]

[Link]
Description
The version of the FXG file format to create. Default FXGVersion.VERSION2PT0.
Type
FXGVersion

72.1. Properties 345


Illustrator Scripting Guide, Release 0.0.1

346 Chapter 72. FXGSaveOptions


CHAPTER

SEVENTYTHREE

GRADIENT

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

73.1 Properties

73.1.1 [Link]

[Link]
Description
The gradient stops contained in this gradient.
Type
GradientStops, read-only.

73.1.2 [Link]

[Link]
Description
The gradient’s name.
Type
String.

347
Illustrator Scripting Guide, Release 0.0.1

73.1.3 [Link]

[Link]
Description
The document that contains this gradient.
Type
Document, read-only.

73.1.4 [Link]

[Link]
Description
The kind of the gradient, either radial or linear.
Type
GradientType

73.1.5 [Link]

[Link]
Description
The class name of the referenced object.
Type
String, read-only.

73.2 Methods

73.2.1 [Link]()

[Link][index].remove()
Description
Removes the referenced object from the document.
Returns
Nothing.

348 Chapter 73. Gradient


Illustrator Scripting Guide, Release 0.0.1

73.3 Example

73.3.1 Creating and applying a gradient

// Creates a new gradient in current document then applies the gradient to the frontmost␣
˓→path item

if ([Link] > 0) {
// Create a color for both ends of the gradient
var startColor = new RGBColor();
[Link] = 0;
[Link] = 100;
[Link] = 255;

var endColor = new RGBColor();


[Link] = 220;
[Link] = 0;
[Link] = 100;

// Create a new gradient


// A new gradient always has 2 stops
var newGradient = [Link]();
[Link] = "NewGradient";
[Link] = [Link];

// Modify the first gradient stop


[Link][0].rampPoint = 30;
[Link][0].midPoint = 60;
[Link][0].color = startColor;

// Modify the last gradient stop


[Link][1].rampPoint = 80;
[Link][1].color = endColor;

// construct an [Link] object referring to the newly created␣


˓→ gradient
var colorOfGradient = new GradientColor();
[Link] = newGradient;

// get first path item, apply new gradient as its fill


var topPath = [Link][0];
[Link] = true;
[Link] = colorOfGradient;
}

73.3. Example 349


Illustrator Scripting Guide, Release 0.0.1

350 Chapter 73. Gradient


CHAPTER

SEVENTYFOUR

GRADIENTS

[Link]
Description
A collection of Gradient objects in a document.

74.1 Properties

74.1.1 [Link]

[Link]
Description
The number of objects in the collection.
Type
Number, read-only.

74.1.2 [Link]

[Link]
Description
The parent of this object.
Type
Object, read-only.

351
Illustrator Scripting Guide, Release 0.0.1

74.1.3 [Link]

[Link]
Description
The class name of the referenced object.
Type
String, read-only.

74.2 Methods

74.2.1 [Link]()

[Link]()
Description
Creates a new Gradient object.
Returns
Gradient

74.2.2 [Link]()

[Link](name)
Description
Gets the first element in the collection with the specified name.
Parameters

Parameter Type Description


name String Name of element to get

Returns
Gradient

352 Chapter 74. Gradients


Illustrator Scripting Guide, Release 0.0.1

74.2.3 [Link]()

[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number String or number key

Returns
Gradient

74.2.4 [Link]()

[Link]()
Description
Deletes all elements in this collection.
Returns
Nothing.

74.3 Example

74.3.1 Removing a gradient

// Deletes the first gradient from the current document


if ([Link] > 0) {
[Link][0].remove();
}

74.3. Example 353


Illustrator Scripting Guide, Release 0.0.1

354 Chapter 74. Gradients


CHAPTER

SEVENTYFIVE

GRADIENTSTOP

[Link][index].gradientStops[index
Description
A gradient stop definition that represents a point on a specific gradient defined in the document. Each gradient stop
specifies a color change in the containing gradient. See Changing a gradient stop color for an example.

75.1 Properties

75.1.1 [Link]

[Link][index].gradientStops[index].color
Description
The color linked to this gradient stop.
Type
Color

75.1.2 [Link]

[Link][index].gradientStops[index].midPoint
Description
The midpoint key value, specified as a percentage from 13.0 to 87.0.
Type
Number (double).

355
Illustrator Scripting Guide, Release 0.0.1

75.1.3 [Link]

[Link][index].gradientStops[index].opacity
Description
The opacity value for the gradient stop. Range: 0.0 to 100.0
Type
Number (double).

75.1.4 [Link]

[Link][index].gradientStops[index].parent
Description
The gradient that contains this gradient stop.
Type
Gradient, read-only.

75.1.5 [Link]

[Link][index].gradientStops[index].rampPoint
Description
The location of the color in the blend in a range from 0.0 to 100.0, where 100.0 is 100%.
Type
Number (double).

75.1.6 [Link]

[Link][index].gradientStops[index].typename
Description
The class name of the referenced object.
Type
String, read-only.

356 Chapter 75. GradientStop


Illustrator Scripting Guide, Release 0.0.1

75.2 Methods

75.2.1 [Link]()

[Link][index].gradientStops[index].remove()
Description
Deletes this object.
Returns
Nothing.

75.2. Methods 357


Illustrator Scripting Guide, Release 0.0.1

358 Chapter 75. GradientStop


CHAPTER

SEVENTYSIX

GRADIENTSTOPS

[Link][index].gradientStops
Description
A collection of GradientStop objects in a specific gradient. The elements are not named; you must access them by
index.

76.1 Properties

76.1.1 [Link]

[Link][index].[Link]
Description
The number of objects in the collection.
Type
Number, read-only.

76.1.2 [Link]

[Link][index].[Link]
Description
The parent of this object.
Type
Object, read-only.

359
Illustrator Scripting Guide, Release 0.0.1

76.1.3 [Link]

[Link][index].[Link]
Description
The class name of the referenced object.
Type
String, read-only.

76.2 Methods

76.2.1 [Link]()

[Link][index].[Link]()
Description
Creates a new object.
Returns
GradientStop

76.2.2 [Link]()

[Link][index].[Link](name)
Description
Gets the first element in the collection with the specified name.
Parameters

Parameter Type Description


name String Name of element to get

Returns
GradientStop

360 Chapter 76. GradientStops


Illustrator Scripting Guide, Release 0.0.1

76.2.3 [Link]()

[Link][index].[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number String or number key

Returns
GradientStop

76.2.4 [Link]()

[Link][index].[Link]()
Description
Deletes all objects in this collection.
Returns
Nothing.

76.3 Example

76.3.1 Adding a new gradient stop

// Adds a new gradient stop to a gradient, color of new stop is 70% gray
if ([Link] > 0 && [Link] > 0) {
// Get a reference to the gradient to change
var changeGradient = [Link][0];

// Get a reference to the last gradient stop


var origCount = [Link];
var lastStop = [Link][origCount - 1];

// add the new gradient stop


var newStop = [Link]();

// 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 position

[Link] = [Link];
[Link] = [Link] - 10;
(continues on next page)

76.3. Example 361


Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)

// Create a new color to apply to the newly created gradient stop


var newStopColor = new GrayColor();
[Link] = 70.0;
[Link] = newStopColor;
}

362 Chapter 76. GradientStops


CHAPTER

SEVENTYSEVEN

GRAPHICSTYLE

[Link][index
Description
A graphic style. Each graphic style defines a set of appearance attributes that you can apply non-destructively to page
items. Graphic styles are contained in documents. Scripts cannot create new graphic styles.

77.1 Properties

77.1.1 [Link]

[Link][index].name
Description
The graphic style name.
Type
String.

77.1.2 [Link]

[Link][index].parent
Description
The document that contains this graphic style.
Type
Document, read-only.

363
Illustrator Scripting Guide, Release 0.0.1

77.1.3 [Link]

[Link][index].typename
Description
The class name of the referenced object.
Type
String, read-only.

77.2 Methods

77.2.1 [Link]()

[Link][index].applyTo(artItem)
Description
Applies this art style to a specified art item.
Parameters

Parameter Type Description


artItem PageItem Target art item

Returns
Nothing.

77.2.2 [Link]()

[Link][index].mergeTo(artItem)
Description
Merges this art style into the current styles of a specified art item.
Parameters

Parameter Type Description


artItem PageItem Target art item

Returns
Nothing.

364 Chapter 77. GraphicStyle


Illustrator Scripting Guide, Release 0.0.1

77.2.3 [Link]()

[Link][index].remove()
Description
Deletes this object.
Returns
Nothing.

77.3 Example

77.3.1 Applying a graphic style

// Duplicates each path item in the selection, places the duplicate into a new group,
// then applies a graphic style to the new groups items

if ([Link] > 0) {
var doc = [Link];
var selected = [Link];
var newGroup = [Link]();
[Link] = "NewGroup";
[Link](doc, [Link]);

var endIndex = [Link];


for (var i = 0; i < endIndex; i++) {
if (selected[i].typename == "PathItem")
selected[i].duplicate(newGroup, [Link]);
}

for (i = 0; i < [Link]; i++) {


[Link][1].applyTo([Link][i]);
}
}

77.3. Example 365


Illustrator Scripting Guide, Release 0.0.1

366 Chapter 77. GraphicStyle


CHAPTER

SEVENTYEIGHT

GRAPHICSTYLES

[Link]
Description
A collection of GraphicStyle objects in a document.

78.1 Properties

78.1.1 [Link]

[Link]
Description
The number of graphic styles in the document.
Type
Number, read-only.

78.1.2 [Link]

[Link]
Description
The document that contains this graphic styles collection.
Type
Object, read-only.

367
Illustrator Scripting Guide, Release 0.0.1

78.1.3 [Link]

[Link]
Description
The class name of the referenced object.
Type
String, read-only.

78.2 Methods

78.2.1 [Link]()

[Link](name)
Description
Gets the first element in the collection with the specified name.
Parameters

Parameter Type Description


name String Name of element to get

Returns
String.

78.2.2 [Link]()

[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number String or number key

Returns
String, Number.

368 Chapter 78. GraphicStyles


Illustrator Scripting Guide, Release 0.0.1

78.2.3 [Link]()

[Link]()
Description
Removes all elements in the referenced collection.
Returns
Nothing.

78.3 Example

78.3.1 Counting graphics styles

// Counts the number of graphic styles in the active document


// and stores result in numberOfStyles

if ([Link] > 0) {
var numberOfStyles = [Link];
}

78.3. Example 369


Illustrator Scripting Guide, Release 0.0.1

370 Chapter 78. GraphicStyles


CHAPTER

SEVENTYNINE

GRAPHITEM

[Link][index
Description
Any graph artwork object. See example Rotating graph items.

79.1 Properties

79.1.1 [Link]

[Link][index].artworkKnockout
Description
Is this object used to create a knockout, and if so, what kind of knockout. You cannot set this value to KnockoutState.
Unknown.
Type
KnockoutState

79.1.2 [Link]

[Link][index].blendingMode
Description
The mode used when compositing an object.
Type
BlendModes

371
Illustrator Scripting Guide, Release 0.0.1

79.1.3 [Link]

[Link][index].contentVariable
Description
The content variable bound to the graph item.
It is not necessary to set the type of the contentVariable before binding. Illustrator automatically set the type to
GRAPH.
Type
Variable

79.1.4 [Link]

[Link][index].controlBounds
Description
The content variable bound to the graph item.
The bounds of the object including stroke width and controls.
Type
Array of 4 numbers, read-only.

79.1.5 [Link]

[Link][index].editable
Description
If true, this graph item is editable.
Type
Boolean, read-only.

79.1.6 [Link]

[Link][index].geometricBounds
Description
The bounds of the object excluding stroke width.
Type
Array of 4 numbers, read-only.

372 Chapter 79. GraphItem


Illustrator Scripting Guide, Release 0.0.1

79.1.7 [Link]

[Link][index].height
Description
The height of the graph item.
Type
Number (double), read-only.

79.1.8 [Link]

[Link][index].hidden
Description
If true, this graph item is hidden.
Type
Boolean.

79.1.9 [Link]

[Link][index].isIsolated
Description
If true, this object is isolated.
Type
Boolean.

79.1.10 [Link]

[Link][index].layer
Description
The layer to which this graph item belongs.
Type
Layer, read-only.

79.1. Properties 373


Illustrator Scripting Guide, Release 0.0.1

79.1.11 [Link]

[Link][index].left
Description
The offset (in points) of the left side of the graph item from the left side of the page.
Type
Number.

79.1.12 [Link]

[Link][index].locked
Description
If true, this graph item is locked.
Type
Boolean.

79.1.13 [Link]

[Link][index].name
Description
The name of this graph item.
Type
String.

79.1.14 [Link]

[Link][index].note
Description
The note assigned to this item.
Type
String.

374 Chapter 79. GraphItem


Illustrator Scripting Guide, Release 0.0.1

79.1.15 [Link]

[Link][index].opacity
Description
The opacity of the object; the value is between 0.0 and 100.0.
Type
Number (double)

79.1.16 [Link]

[Link][index].parent
Description
The parent of this object.
Type
Layer or GroupItem

79.1.17 [Link]

[Link][index].position
Description
The position (in points) of the top left corner of the graphItem object in the format [x, y]. Does not include stroke
weight.
Type
Array of 2 numbers.

79.1.18 [Link]

[Link][index].selected
Description
If true, this object is selected.
Type
Boolean.

79.1. Properties 375


Illustrator Scripting Guide, Release 0.0.1

79.1.19 [Link]

[Link][index].sliced
Description
If true, the graph item is sliced. Default: false.
Type
Boolean.

79.1.20 [Link]

[Link][index].tags
Description
The tags contained in this graph item.
Type
Tags, read-only.

79.1.21 [Link]

[Link][index].top
Description
The offset (in points) of the top of the graph item from the bottom of the page.
Type
Number (double).

79.1.22 [Link]

[Link][index].typename
Description
The type of the graph item.
Type
String, read-only.

376 Chapter 79. GraphItem


Illustrator Scripting Guide, Release 0.0.1

79.1.23 [Link]

[Link][index].uRL
Description
The value of the Adobe URL tag assigned to this graph item.
Type
String.

79.1.24 [Link]

[Link][index].visibilityVariable
Description
The visibility variable bound to the graph item.
It is not necessary to set the type of the visibilityVariable before binding. Illustrator automatically set the type to
VISIBILITY.
Type
Variable

79.1.25 [Link]

[Link][index].visibleBounds
Description
The visible bounds of the graph item including stroke width.
Type
Array of 4 numbers, read-only.

79.1.26 [Link]

[Link][index].width
Description
The width of the graph item. Range: 0.0 to 16348.0.
Type
Number (double).

79.1. Properties 377


Illustrator Scripting Guide, Release 0.0.1

79.1.27 [Link]

[Link][index].wrapInside
Description
If true, the text frame object should be wrapped inside this object.
Type
Boolean.

79.1.28 [Link]

[Link][index].wrapOffset
Description
The offset to use when wrapping text around this object.
Type
Number (double).

79.1.29 [Link]

[Link][index].wrapped
Description
If true, wrap text frame objects around this object. (Text frame must be above the object.)
Type
Boolean.

79.1.30 [Link]

[Link][index].zOrderPosition
Description
The position of this art item within the stacking order of the group or layer (parent) that contains the art item.
Type
Number (long).

378 Chapter 79. GraphItem


Illustrator Scripting Guide, Release 0.0.1

79.2 Methods

79.2.1 [Link]()

[Link][index].duplicate([relativeObject] [,insertionLocation])
Description
Creates a duplicate of the selected object.
Parameters

Parameter Type Description


relativeObject Object, optional Object to duplicate to
insertionLocation ElementPlacement, optional Location to insert element

Returns
GraphItem

79.2.2 [Link]()

[Link][index].move(relativeObject, insertionLocation)
Description
Moves the object.
Parameters

Parameter Type Description


relativeObject Object Object to move element within
insertionLocation ElementPlacement, optional Location to move element to

Returns
GraphItem

79.2.3 [Link]()

[Link][index].remove()
Description
Deletes this object.
Returns
Nothing.

79.2. Methods 379


Illustrator Scripting Guide, Release 0.0.1

79.2.4 [Link]()

[Link][index].resize(scaleX, scaleY
[,changePositions] [,changeFillPatterns] [,changeFillGradients]
[,changeStrokePattern] [,changeLineWidths] [,scaleAbout])
)

Description
Scales the art item where scaleX is the horizontal scaling factor and scaleY is the vertical scaling factor. 100.0 =
100%.
Parameters

Parameter Type Description


scaleX Number (double) Horizontal scaling factor
scaleY Number (double) Vertical scaling factor
changePositions Boolean, optional Whether to effect art object positions and orientations
changeFillPatterns Boolean, optional Whether to transform fill patterns
changeFillGradients Boolean, optional Whether to transform fill gradients
changeStrokePattern Boolean, optional Whether to transform stroke patterns
changeLineWidths Number (double), optional The amount to scale line widths
scaleAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

79.2.5 [Link]()

[Link][index].rotate(angle
[,changePositions] [,changeFillPatterns] [,changeFillGradients]
[,changeStrokePattern] [,rotateAbout]
)

Description
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.
Parameters

Parameter Type Description


angle Number (double) The angle amount to rotate the element
changePositions Boolean, optional Whether to effect art object positions and orientations
changeFillPatterns Boolean, optional Whether to transform fill patterns
changeFillGradients Boolean, optional Whether to transform fill gradients
changeStrokePattern Boolean, optional Whether to transform stroke patterns
rotateAbout Transformation, optional The point to use as anchor, to transform about

Returns

380 Chapter 79. GraphItem


Illustrator Scripting Guide, Release 0.0.1

Nothing.

79.2.6 [Link]()

[Link][index].transform(transformationMatrix
[,changePositions] [,changeFillPatterns] [,changeFillGradients]
[,changeStrokePattern] [,changeLineWidths] [,transformAbout]
)

Description
Transforms the art item by applying a transformation matrix.
Parameters

Parameter Type Description


transformationMatrix Matrix Transformation matrix to apply
changePositions Boolean, optional Whether to change Positions
changeFillPatterns Boolean, optional Whether to change Fill Patterns
changeFillGradients Boolean, optional Whether to change Fill Gradients
changeStrokePattern Boolean, optional Whether to change Stroke Pattern
changeLineWidths Number (double), optional The amount to scale line widths
transformAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

79.2.7 [Link]()

[Link][index].translate([deltaX] [,deltaY]
[,transformObjects] [,transformFillPatterns]
[,transformFillGradients] [,transformStrokePatterns]
)

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

Parameter Type Description


deltaX Number (double), optional Horizontal offset
deltaY Number (double), optional Vertical offset
transformObjects Boolean, optional Whether to transform Objects
transformFillPatterns Boolean, optional Whether to transform Fill Patterns
transformFillGradients Boolean, optional Whether to transform Fill Gradients
transformStrokePatterns Boolean, optional Whether to transform Stroke Patterns

79.2. Methods 381


Illustrator Scripting Guide, Release 0.0.1

Returns
Nothing.

79.2.8 [Link]()

[Link][index].zOrder(zOrderCmd)
Description
Arranges the art item’s position in the stacking order of the group or layer (parent) of this object.
Parameters

Parameter Type Description


zOrderCmd ZOrderMethod Stacking order arrangement method

Returns
Nothing.

382 Chapter 79. GraphItem


CHAPTER

EIGHTY

GRAPHITEMS

[Link]
Description
A collection GraphItems objects, which gives you access to all the graph art items in an Illustrator document.

80.1 Properties

80.1.1 [Link]

[Link]
Description
The number of objects in the collection.
Type
Number, read-only.

80.1.2 [Link]

[Link]
Description
The parent of this object.
Type
Object, read-only.

383
Illustrator Scripting Guide, Release 0.0.1

80.1.3 [Link]

[Link]
Description
The class name of the referenced object.
Type
String, read-only.

80.2 Methods

80.2.1 [Link]()

[Link](name)
Description
Gets the first element in the collection with the specified name.
Parameters

Parameter Type Description


name String Name of element to get

Returns
GraphItems

80.2.2 [Link]()

[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number String or number key

Returns
GraphItems

384 Chapter 80. GraphItems


Illustrator Scripting Guide, Release 0.0.1

80.2.3 [Link]()

[Link]()
Description
Deletes all elements in the collection.
Returns
Nothing.

80.3 Example

80.3.1 Rotating graph items

// Rotates each graph item in the current document 90 degrees.

// Verify a document with a graph item is open


var ok = false;

if ([Link] > 0) {
var docRef = activeDocument;
var iCount = [Link];
if (iCount > 0) {
ok = true;
for (var i = 0; i < iCount; i++) {
var graphRef = [Link][i];
[Link] = true;
[Link](90); //rotate clockwise 90 degrees
}
redraw();
}
}

80.3. Example 385


Illustrator Scripting Guide, Release 0.0.1

386 Chapter 80. GraphItems


CHAPTER

EIGHTYONE

GROUPITEM

[Link][index
Description
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 in 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.

81.1 Properties

81.1.1 [Link]

[Link][index].artworkKnockout
Description
Is this object used to create a knockout, and if so, what kind of knockout.
Type
KnockoutState

81.1.2 [Link]

[Link][index].blendingMode
Description
The blend mode used when compositing an object.
Type
BlendModes

387
Illustrator Scripting Guide, Release 0.0.1

81.1.3 [Link]

[Link][index].clipped
Description
If true, the group is clipped to the clipping mask.
Type
Boolean.

81.1.4 [Link]

[Link][index].compoundPathItems
Description
The compound path items contained in this group.
Type
CompoundPathItems, read-only.

81.1.5 [Link]

[Link][index].controlBounds
Description
The bounds of the object including stroke width and controls.
Type
Array of 4 numbers, read-only.

81.1.6 [Link]

[Link][index].editable
Description
If true, this item is editable.
Type
Boolean, read-only.

388 Chapter 81. GroupItem


Illustrator Scripting Guide, Release 0.0.1

81.1.7 [Link]

[Link][index].geometricBounds
Description
The bounds of the object excluding stroke width.
Type
Array of 4 numbers, read-only.

81.1.8 [Link]

[Link][index].graphItems
Description
he graph items contained in this group.
Type
GraphItems, read-only.

81.1.9 [Link]

[Link][index].groupItems
Description
The group items contained in this group.
Type
GroupItems, read-only.

81.1.10 [Link]

[Link][index].height
Description
The height of the group item.
Type
Number (double).

81.1. Properties 389


Illustrator Scripting Guide, Release 0.0.1

81.1.11 [Link]

[Link][index].hidden
Description
If true, this group item is hidden.
Type
Boolean.

81.1.12 [Link]

[Link][index].isIsolated
Description
If true, this object is isolated.
Type
Boolean.

81.1.13 [Link]

[Link][index].layer
Description
The layer to which this group item belongs.
Type
Layer, read-only.

81.1.14 [Link]

[Link][index].left
Description
The position of the left side of the item (in points, measured from the left side of the page).
Type
Number (double).

390 Chapter 81. GroupItem


Illustrator Scripting Guide, Release 0.0.1

81.1.15 [Link]

[Link][index].legacyTextItems
Description
The legacy text items in the group.
Type
LegacyTextItems, read-only.

81.1.16 [Link]

[Link][index].locked
Description
If true, this group item is locked.
Type
Boolean.

81.1.17 [Link]

[Link][index].meshItems
Description
The mesh items contained in this group.
Type
MeshItems, read-only.

81.1.18 [Link]

[Link][index].name
Description
The name of this group item.
Type
String.

81.1. Properties 391


Illustrator Scripting Guide, Release 0.0.1

81.1.19 [Link]

[Link][index].nonNativeItems
Description
The non-native art items in this group.
Type
NonNativeItems

81.1.20 [Link]

[Link][index].note
Description
The note assigned to this item.
Type
String.

81.1.21 [Link]

[Link][index].opacity
Description
The opacity of the object. Range: 0.0 to 100.0.
Type
Number (double).

81.1.22 [Link]

[Link][index].pageItems
Description
The page items (all art item classes) contained in this group.
Type
PageItems, read-only.

392 Chapter 81. GroupItem


Illustrator Scripting Guide, Release 0.0.1

81.1.23 [Link]

[Link][index].parent
Description
The parent of this object.
Type
Layer or GroupItem, read-only.

81.1.24 [Link]

[Link][index].pathItems
Description
The path items contained in this group.
Type
PathItems, read-only.

81.1.25 [Link]

[Link][index].placedItems
Description
The placed items contained in this group.
Type
PlacedItems, read-only.

81.1.26 [Link]

[Link][index].pluginItems
Description
The plug-in items contained in this group.
Type
PluginItems, read-only.

81.1. Properties 393


Illustrator Scripting Guide, Release 0.0.1

81.1.27 [Link]

[Link][index].position
Description
The position (in points) of the top left corner of the groupItem object in the format [x, y]. Does not include stroke
weight.
Type
Array of 2 numbers.

81.1.28 [Link]

[Link][index].rasterItems
Description
The raster items contained in this group.
Type
RasterItems, read-only.

81.1.29 [Link]

[Link][index].selected
Description
If true, this group item is selected.
Type
Boolean.

81.1.30 [Link]

[Link][index].sliced
Description
If true, the item sliced. Default: false.
Type
Boolean.

394 Chapter 81. GroupItem


Illustrator Scripting Guide, Release 0.0.1

81.1.31 [Link]

[Link][index].symbolItems
Description
The symbol item objects in this group.
Type
SymbolItems, read-only.

81.1.32 [Link]

[Link][index].tags
Description
The tags contained in this group.
Type
Tags, read-only.

81.1.33 [Link]

[Link][index].textFrames
Description
The text art items contained in this group.
Type
TextFrameItems, read-only.

81.1.34 [Link]

[Link][index].top
Description
The position of the top of the item (in points, measured from the bottom of the page).
Type
Number (double).

81.1. Properties 395


Illustrator Scripting Guide, Release 0.0.1

81.1.35 [Link]

[Link][index].typename
Description
The class name of the referenced object.
Type
String, read-only.

81.1.36 [Link]

[Link][index].uRL
Description
The value of the Adobe URL tag assigned to this group item.
Type
String.

81.1.37 [Link]

[Link][index].visibilityVariable
Description
The visibility variable bound to the item.
Type
Variable

81.1.38 [Link]

[Link][index].visibleBounds
Description
The visible bounds of the group item including stroke width.
Type
Array of 4 numbers, read-only.

396 Chapter 81. GroupItem


Illustrator Scripting Guide, Release 0.0.1

81.1.39 [Link]

[Link][index].width
Description
The width of the group item.
Type
Number (double).

81.1.40 [Link]

[Link][index].wrapInside
Description
If true, the text frame object should be wrapped inside this object.
Type
Boolean.

81.1.41 [Link]

[Link][index].wrapOffset
Description
The offset to use when wrapping text around this object.
Type
Number (double).

81.1.42 [Link]

[Link][index].wrapped
Description
If true, wrap text frame objects around this object (text frame must be above the object).
Type
Boolean.

81.1. Properties 397


Illustrator Scripting Guide, Release 0.0.1

81.1.43 [Link]

[Link][index].zOrderPosition
Description
The position of this group object within the stacking order of the group or layer (parent) that contains the group object.
Type
Number (long).

81.2 Methods

81.2.1 [Link]()

[Link][index].duplicate([relativeObject] [,insertionLocation])
Description
Creates a duplicate of the selected object.
Parameters

Parameter Type Description


relativeObject Object, optional Object to duplicate to
insertionLocation ElementPlacement, optional Location to insert element

Returns
GroupItem

81.2.2 [Link]()

[Link][index].move(relativeObject, insertionLocation)
Description
Moves the object.
Parameters

Parameter Type Description


relativeObject Object Object to move element within
insertionLocation ElementPlacement, optional Location to move element to

Returns
GroupItem

398 Chapter 81. GroupItem


Illustrator Scripting Guide, Release 0.0.1

81.2.3 [Link]()

[Link][index].remove()
Description
Deletes this object.
Returns
Nothing.

81.2.4 [Link]()

[Link][index].resize(scaleX, scaleY
[,changePositions] [,changeFillPatterns] [,changeFillGradients]
[,changeStrokePattern] [,changeLineWidths] [,scaleAbout]
)

Description
Scales the art item where scaleX is the horizontal scaling factor and scaleY is the vertical scaling factor. 100.0 =
100%.
Parameters

Parameter Type Description


scaleX Number (double) Horizontal scaling factor
scaleY Number (double) Vertical scaling factor
changePositions Boolean, optional Whether to effect art object positions and orientations
changeFillPatterns Boolean, optional Whether to transform fill patterns
changeFillGradients Boolean, optional Whether to transform fill gradients
changeStrokePattern Boolean, optional Whether to transform stroke patterns
changeLineWidths Number (double), optional The amount to scale line widths
scaleAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

81.2.5 [Link]()

[Link][index].rotate(angle
[,changePositions] [,changeFillPatterns] [,changeFillGradients]
[,changeStrokePattern] [,rotateAbout]
)

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

81.2. Methods 399


Illustrator Scripting Guide, Release 0.0.1

Parameters

Parameter Type Description


angle Number (double) The angle amount to rotate the element
changePositions Boolean, optional Whether to effect art object positions and orientations
changeFillPatterns Boolean, optional Whether to transform fill patterns
changeFillGradients Boolean, optional Whether to transform fill gradients
changeStrokePattern Boolean, optional Whether to transform stroke patterns
rotateAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

81.2.6 [Link]()

[Link][index].transform(transformationMatrix
[,changePositions] [,changeFillPatterns] [,changeFillGradients]
[,changeStrokePattern] [,changeLineWidths] [,transformAbout]
)

Description
Transforms the art item by applying a transformation matrix.
Parameters

Parameter Type Description


transformationMatrix Matrix Transformation matrix to apply
changePositions Boolean, optional Whether to change Positions
changeFillPatterns Boolean, optional Whether to change Fill Patterns
changeFillGradients Boolean, optional Whether to change Fill Gradients
changeStrokePattern Boolean, optional Whether to change Stroke Pattern
changeLineWidths Number (double), optional The amount to scale line widths
transformAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

81.2.7 [Link]()

[Link][index].translate([deltaX] [,deltaY]
[,transformObjects] [,transformFillPatterns]
[,transformFillGradients] [,transformStrokePatterns]
)

400 Chapter 81. GroupItem


Illustrator Scripting Guide, Release 0.0.1

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

Parameter Type Description


deltaX Number (double), optional Horizontal offset
deltaY Number (double), optional Vertical offset
transformObjects Boolean, optional Whether to transform Objects
transformFillPatterns Boolean, optional Whether to transform Fill Patterns
transformFillGradients Boolean, optional Whether to transform Fill Gradients
transformStrokePatterns Boolean, optional Whether to transform Stroke Patterns

Returns
Nothing.

81.2.8 [Link]()

[Link][index].zOrder(zOrderCmd)
Description
Arranges the art item’s position in the stacking order of the group or layer (parent) of this object.
Parameters

Parameter Type Description


zOrderCmd ZOrderMethod Stacking order arrangement method

Returns
Nothing.

81.3 Example

81.3.1 Modifying all objects in 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 group to contain them.

// Creates a new group item, adds a new path item, of triangle shape, to the group,
// then adds a new text item to the group and sets the fill color of the text to red

if ([Link] > 0) {
var triangleGroup = [Link]();

(continues on next page)

81.3. Example 401


Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)


// Create a triangle and add text, the new art is created inside the group
var trianglePath = [Link]();
[Link](Array(Array(100, 100), Array(300, 100), Array(200, Math.
˓→tan(1.0471975) * 100 + 100)));

[Link] = true;
[Link] = true;
[Link] = false;
[Link] = 3;

var captionText = [Link]();


[Link] = Array(100, 150);
[Link] = 48;
[Link] = "A triangle";

var fillColor = new RGBColor();


[Link] = 255;
[Link] = 0;
[Link] = 0;
[Link] = fillColor;
}

402 Chapter 81. GroupItem


CHAPTER

EIGHTYTWO

GROUPITEMS

[Link]
Description
The collection of grouped art items in a document.

82.1 Properties

82.1.1 [Link]

[Link]
Description
The number of objects in the collection.
Type
Number, read-only.

82.1.2 [Link]

[Link]
Description
The parent of this object.
Type
Object, read-only.

403
Illustrator Scripting Guide, Release 0.0.1

82.1.3 [Link]

[Link]
Description
The class name of the referenced object.
Type
String, read-only.

82.2 Methods

82.2.1 [Link]()

[Link]()
Description
Creates a new object.
Returns
GroupItem

82.2.2 [Link]()

[Link](imageFile)
Description
Places an external vector art file as a group item in the document.
Parameters

Parameter Type Description


imageFile File Vector art file to place

Returns
GroupItem

404 Chapter 82. GroupItems


Illustrator Scripting Guide, Release 0.0.1

82.2.3 [Link]()

[Link](name)
Description
Gets the first element in the collection with the specified name.
Parameters

Parameter Type Description


name String Name of element to get

Returns
GroupItem

82.2.4 [Link]()

[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number String or number key

Returns
GroupItem

82.2.5 [Link]()

[Link]()
Description
Deletes all elements in this collection.
Returns
Nothing.

82.2. Methods 405


Illustrator Scripting Guide, Release 0.0.1

82.3 Example

82.3.1 Importing a PDF as a group item

The following script shows how you can import a PDF document using the [Link]() function.

Note: Before running this script you must create a one page PDF file and put it in the location /temp/[Link].

// Embeds a new group item in to the current document from a file specified by dest
// dest should contain the full path and file name

function embedPDF(dest) {
var embedDoc = new File(dest);
if ([Link] > 0 && [Link]) {
var doc = [Link];
var placed = [Link](embedDoc);
}
}

406 Chapter 82. GroupItems


CHAPTER

EIGHTYTHREE

ILLUSTRATORSAVEOPTIONS

illustratorSaveOptions
Description
Options for saving a document as an Illustrator file, used with the [Link]() method. All properties are
optional.

83.1 Properties

83.1.1 [Link]

[Link]
Description
If saveMultipleArtboards is true (which is valid only for Illustrator 13 or earlier), the document is considered
for multi-asset extraction, which specifies an artboard range. An empty string extracts all artboards. Default: empty
String.
Type
String.

83.1.2 [Link]

[Link]
Description
Specifies the version of Illustrator file format to create. Default: Compatibility.ILLUSTRATOR19.
Type
Compatibility

407
Illustrator Scripting Guide, Release 0.0.1

83.1.3 [Link]

[Link]
Description
(Illustrator version 10 or later.) If true, the saved file is compressed. Default: true.
Type
Boolean.

83.1.4 [Link]

[Link]
Description
(Illustrator version 9 or later.) If true, the document’s ICC profile is embedded in the saved file. Default: false.
Type
Boolean.

83.1.5 [Link]

[Link]
Description
(Illustrator version 7 or later.) If true, the linked image files is embedded in the saved file. Default: false.
Type
Boolean.

83.1.6 [Link]

[Link]
Description
(Versions before Illustrator 9.) How transparency should be flattened for older file format versions. Default:
[Link].
Type
OutputFlattening

408 Chapter 83. IllustratorSaveOptions


Illustrator Scripting Guide, Release 0.0.1

83.1.7 [Link]

[Link]
Description
(Illustrator version 9 or later.) Include a subset of fonts when less than this percentage of characters is used in the
document. Range: 0.0 to 100.0. Default: 100.0.
Type
Number (double).

83.1.8 [Link]

[Link]
Description
(Illustrator version 10 or later.) If true, the file is saved as a PDF compatible file. Default: true.
Type
Boolean.

83.1.9 [Link]

[Link]
Description
If true, all artboards or range of the artboards are saved. Valid for Illustrator 13 or earlier.
Type
Boolean.

83.1.10 [Link]

[Link]
Description
The class name of the referenced object.
Type
String, read-only.

83.1. Properties 409


Illustrator Scripting Guide, Release 0.0.1

83.2 Example

83.2.1 Saving with options

// Saves the current document to dest as an AI file with specified options,


// dest specifies the full path and file name of the new file

function exportFileToAI(dest) {
if ([Link] > 0) {
var ai8Doc = new File(dest);
var saveOptions = new IllustratorSaveOptions();
[Link] = Compatibility.ILLUSTRATOR8;
[Link] = [Link];

[Link](ai8Doc, saveOptions);
}
}

410 Chapter 83. IllustratorSaveOptions


CHAPTER

EIGHTYFOUR

IMAGECAPTUREOPTIONS

imageCaptureOptions
Description
Options for image capture, used with the [Link]() method. All properties are optional.

84.1 Properties

84.1.1 [Link]

[Link]
Description
If true, the image result is anti-aliased. Default: false.
Type
Boolean

84.1.2 [Link]

[Link]
Description
If true, the artboard is matted with a color. Default: false.
Type
Boolean

411
Illustrator Scripting Guide, Release 0.0.1

84.1.3 [Link]

[Link]
Description
The color to use for the artboard matte. Default: white.
Type
RGBColor

84.1.4 [Link]

[Link]
Description
The resolution of the captured image file in points-per-inch (PPI), in the range [72.0 . . . 2400.0]. Default: 150.
Type
Number (double).

84.1.5 [Link]

[Link]
Description
If true, the image result is transparent. Default: false.
Type
Boolean.

84.1.6 [Link]

[Link]
Description
The class name of the referenced object.
Type
String, read-only.

412 Chapter 84. ImageCaptureOptions


CHAPTER

EIGHTYFIVE

INK

[Link][index
Description
Associates a document ink name with ink information.

85.1 Properties

85.1.1 [Link]

[Link][index].inkInfo
Description
The ink information
Type
InkInfo

85.1.2 [Link]

[Link][index].name
Description
The ink’s name.
Type
String.

413
Illustrator Scripting Guide, Release 0.0.1

85.1.3 [Link]

[Link][index].typename
Description
The class name of the object.
Type
String, read-only.

414 Chapter 85. Ink


CHAPTER

EIGHTYSIX

INKINFO

[Link][index].inkInfo
Description
Ink information for printing a document.

86.1 Properties

86.1.1 [Link]

[Link][index].[Link]
Description
The ink’s screen angle in degrees. Range: -360 to 360.
Type
Number (double).

86.1.2 [Link]

[Link][index].[Link]
Description
The color of the custom ink.
Type
Color

415
Illustrator Scripting Guide, Release 0.0.1

86.1.3 [Link]

[Link][index].[Link]
Description
The neutral density. Minimum: 0.0.
Type
Number (double).

86.1.4 [Link]

[Link][index].[Link]
Description
The dot shape name.
Type
String.

86.1.5 [Link]

[Link][index].[Link]
Description
The ink’s frequency. Range: 0.0 to 1000.0.
Type
Number (double).

86.1.6 [Link]

[Link][index].[Link]
Description
The ink type.
Type
InkType

416 Chapter 86. InkInfo


Illustrator Scripting Guide, Release 0.0.1

86.1.7 [Link]

[Link][index].[Link]
Description
The ink printing status.
Type
InkPrintStatus

86.1.8 [Link]

[Link][index].[Link]
Description
The trapping type.
Type
TrappingType

86.1.9 [Link]

[Link][index].[Link]
Description
The order of trapping for the ink. Range: 1 to 4 for CMYK.
Type
Number (long).

86.1.10 [Link]

[Link][index].[Link]
Description
The class name of the object.
Type
String, read-only.

86.1. Properties 417


Illustrator Scripting Guide, Release 0.0.1

86.2 Example

86.2.1 Getting ink information

// Displays the current documents inks in a text frame

var docRef = [Link]();

// assemble a string of the inks in this document


var sInks = "";
var iLength = [Link];
for (var i = 0; i < iLength; i++) {
sInks += [Link][i].name;
sInks += "\r\t";
sInks += "Frequency = " + [Link][i].[Link];
sInks += "\r\t";
sInks += "Density = " + [Link][i].[Link];
sInks += "\r";
}

var textRef = [Link]();


[Link] = sInks;
[Link] = 600;
[Link] = 200;

redraw();

418 Chapter 86. InkInfo


CHAPTER

EIGHTYSEVEN

INSERTIONPOINT

[Link][index].insertionPoints[index
Description
A location between characters that is used to insert new text objects. An insertion point is contained in an
InsertionPoints collection.

87.1 Properties

87.1.1 [Link]

[Link][index].insertionPoints[index].characters
Description
All the characters in this text range.
Type
Characters, read-only.

87.1.2 [Link]

[Link][index].insertionPoints[index].lines
Description
All the lines in this text range.
Type
Lines, read-only.

419
Illustrator Scripting Guide, Release 0.0.1

87.1.3 [Link]

[Link][index].insertionPoints[index].paragraphs
Description
All the paragraphs in this text range.
Type
Paragraphs, read-only.

87.1.4 [Link]

[Link][index].insertionPoints[index].parent
Description
The object’s container.
Type
TextRange, read-only.

87.1.5 [Link]

[Link][index].insertionPoints[index].story
Description
The story to which the text range belongs.
Type
Story, read-only.

87.1.6 [Link]

[Link][index].insertionPoints[index].textRanges
Description
All of the text in this text range.
Type
TextRanges, read-only.

420 Chapter 87. InsertionPoint


Illustrator Scripting Guide, Release 0.0.1

87.1.7 [Link]

[Link][index].insertionPoints[index].typename
Description
The class name of the object.
Type
String, read-only.

87.1.8 [Link]

[Link][index].insertionPoints[index].words
Description
All the words contained in this text range.
Type
Words, read-only.

87.1. Properties 421


Illustrator Scripting Guide, Release 0.0.1

422 Chapter 87. InsertionPoint


CHAPTER

EIGHTYEIGHT

INSERTIONPOINTS

[Link][index].insertionPoints
Description
A collection of InsertionPoint objects.

88.1 Properties

88.1.1 [Link]

[Link][index].[Link]
Description
Number of elements in the collection.
Type
Number, read-only.

88.1.2 [Link]

[Link][index].[Link]
Description
The object’s container.
Type
Object, read-only.

423
Illustrator Scripting Guide, Release 0.0.1

88.1.3 [Link]

[Link][index].[Link]
Description
The class name of the object.
Type
String, read-only.

88.2 Methods

88.2.1 [Link]()

[Link][index].[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number String or number key

Returns
InsertionPoint

88.3 Example

88.3.1 Using insertion points to add spaces

// Creates a new document, adds text then inserts a


// space between each character using insertion points

var docRef = [Link]();


var textRef = [Link]();
[Link] = "Wouldn't you rather be scripting?";
[Link] = 400;
[Link] = 100;
[Link] = 20;

redraw();

// Add a space between each character using insertion points.


var ip;
(continues on next page)

424 Chapter 88. InsertionPoints


Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)


for (var i = 0; i < [Link]; i += 2) {
ip = [Link][i];
[Link](" ");
}

88.3. Example 425


Illustrator Scripting Guide, Release 0.0.1

426 Chapter 88. InsertionPoints


CHAPTER

EIGHTYNINE

LAYER

[Link][index
Description
A layer in an Illustrator document. Layers may contain nested layers, which are called sublayers in the user interface.
The layer object contains all of the page items in the specific layer as elements. Your script can access page items as
elements of either the Layer object or as elements of the Document object. When accessing page items as elements
of a layer, only objects in that layer can be accessed. To access page items throughout the entire document, be sure to
refer to them as contained by the document.

89.1 Properties

89.1.1 [Link]

[Link][index].artworkKnockout
Description
Is this object used to create a knockout, and if so, what kind of knockout. You cannot set this value to KnockoutState.
Unknown.
Type
KnockoutState

89.1.2 [Link]

[Link][index].blendingMode
Description
The mode used when compositing an object.
Type
BlendModes

427
Illustrator Scripting Guide, Release 0.0.1

89.1.3 [Link]

[Link][index].color
Description
The layer’s selection mark color.
Type
RGBColor

89.1.4 [Link]

[Link][index].compoundPathItems
Description
The compound path items contained in this layer.
Type
CompoundPathItems, read-only.

89.1.5 [Link]

[Link][index].dimPlacedImages
Description
If true, placed images should be rendered as dimmed in this layer.
Type
Boolean.

89.1.6 [Link]

[Link][index].graphItems
Description
The graph items contained in this layer.
Type
GraphItems, read-only.

428 Chapter 89. Layer


Illustrator Scripting Guide, Release 0.0.1

89.1.7 [Link]

[Link][index].groupItems
Description
The group items contained in this layer.
Type
GroupItems, read-only.

89.1.8 [Link]

[Link][index].hasSelectedArtwork
Description
If true, an object in this layer has been selected; set to false to deselect all objects in the layer.
Type
Boolean.

89.1.9 [Link]

[Link][index].isIsolated
Description
If true, this object is isolated.
Type
Boolean.

89.1.10 [Link]

[Link][index].layers
Description
The layers contained in this layer.
Type
Layers, read-only.

89.1. Properties 429


Illustrator Scripting Guide, Release 0.0.1

89.1.11 [Link]

[Link][index].legacyTextItems
Description
The legacy text items in this layer.
Type
LegacyTextItems, read-only.

89.1.12 [Link]

[Link][index].locked
Description
If true, this layer is editable; set to false to lock the layer.
Type
Boolean.

89.1.13 [Link]

[Link][index].meshItems
Description
The mesh items contained in this layer.
Type
MeshItems, read-only.

89.1.14 [Link]

[Link][index].name
Description
The name of this layer.
Type
String.

430 Chapter 89. Layer


Illustrator Scripting Guide, Release 0.0.1

89.1.15 [Link]

[Link][index].nonNativeItems
Description
The non-native art items in this layer.
Type
NonNativeItems

89.1.16 [Link]

[Link][index].opacity
Description
The opacity of the layer. Range: 0.0 to 100.0.
Type
Number (double).

89.1.17 [Link]

[Link][index].pageItems
Description
The page items (all art item classes) contained in this layer.
Type
PageItems

89.1.18 [Link]

[Link][index].parent
Description
The document or layer that contains this layer.
Type
Document or Layer, read-only.

89.1. Properties 431


Illustrator Scripting Guide, Release 0.0.1

89.1.19 [Link]

[Link][index].pathItems
Description
The path items contained in this layer.
Type
PathItems, read-only.

89.1.20 [Link]

[Link][index].placedItems
Description
The placed items contained in this layer.
Type
PlacedItems, read-only.

89.1.21 [Link]

[Link][index].pluginItems
Description
The plug-in items contained in this layer.
Type
PluginItems, read-only.

89.1.22 [Link]

[Link][index].preview
Description
If true, this layer should be displayed using preview mode.
Type
Boolean.

432 Chapter 89. Layer


Illustrator Scripting Guide, Release 0.0.1

89.1.23 [Link]

[Link][index].printable
Description
If true, this layer should be printed when printing the document.
Type
Boolean.

89.1.24 [Link]

[Link][index].rasterItems
Description
The raster items contained in this layer.
Type
RasterItems, read-only.

89.1.25 [Link]

[Link][index].sliced
Description
If true, the layer item is sliced. Default: false.
Type
Boolean.

89.1.26 [Link]

[Link][index].symbolItems
Description
The symbol items contained in the layer.
Type
SymbolItems, read-only.

89.1. Properties 433


Illustrator Scripting Guide, Release 0.0.1

89.1.27 [Link]

[Link][index].textFrames
Description
The text art items contained in this layer.
Type
TextFrameItems, read-only.

89.1.28 [Link]

[Link][index].typename
Description
The class name of the referenced object.
Type
String, read-only.

89.1.29 [Link]

[Link][index].visible
Description
If true, this layer is visible.
Type
Boolean.

89.1.30 [Link]

[Link][index].zOrderPosition
Description
The position of this layer within the stacking order of layers in the document.
Type
Number (long), read-only.

434 Chapter 89. Layer


Illustrator Scripting Guide, Release 0.0.1

89.2 Methods

89.2.1 [Link]()

[Link][index].move(relativeObject, insertionLocation)
Description
Moves the object.
Parameters

Parameter Type Description


relativeObject Object Object to move element within
insertionLocation ElementPlacement, optional Location to move element to

Returns
Layer

89.2.2 [Link]()

[Link][index].remove()
Description
Deletes this object.
Returns
Nothing.

89.2.3 [Link]()

[Link][index].zOrder(ZOrderCmd)
Description
Arranges the layer’s position in the stacking order of the containing layer or document (parent) of this object.
Parameters

Parameter Type Description


zOrderCmd ZOrderMethod Stacking order arrangement method

Returns
Nothing.

89.2. Methods 435


Illustrator Scripting Guide, Release 0.0.1

89.3 Example

89.3.1 Bringing a layer to the front

// Moves the bottom layer to become the topmost layer

if ([Link] > 0) {
var countOfLayers = [Link];
if (countOfLayers > 1) {
var bottomLayer = [Link][countOfLayers - 1];
[Link]([Link]);
} else {
alert("The active document only has only 1 layer");
}
}

436 Chapter 89. Layer


CHAPTER

NINETY

LAYERS

[Link]
Description
The collection of layers in the document.

90.1 Properties

90.1.1 [Link]

[Link]
Description
The number of objects in the collection.
Type
Number, read-only.

90.1.2 [Link]

[Link]
Description
The parent of this object.
Type
Object, read-only.

437
Illustrator Scripting Guide, Release 0.0.1

90.1.3 [Link]

[Link]
Description
The class name of the referenced object.
Type
String, read-only.

90.2 Methods

90.2.1 [Link]()

[Link]()
Description
Creates a new layer in the document.
Returns
Layer

90.2.2 [Link]()

[Link](name)
Description
Gets the first element in the collection with the specified name.
Parameters

Parameter Type Description


name String Name of element to get

Returns
Layer

438 Chapter 90. Layers


Illustrator Scripting Guide, Release 0.0.1

90.2.3 [Link]()

[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number String or number key

Returns
Layer

90.2.4 [Link]()

[Link]()
Description
Deletes all elements in this collection.
Returns
Nothing.

90.3 Example

90.3.1 Finding and deleting layers

// Deletes all layers whose name begins with "Temp" in all open documents

var layersDeleted = 0;
for (var i = 0; i < [Link]; i++) {
var targetDocument = [Link][i];
var layerCount = [Link];

// Loop through layers from the back, to preserve index


// of remaining layers when we remove one
for (var ii = layerCount - 1; ii >= 0; ii--) {
var targetLayer = [Link][ii];
var layerName = new String([Link]);
if ([Link]("Temp") == 0) {
[Link][ii].remove();
layersDeleted++;
}
}
}

90.3. Example 439


Illustrator Scripting Guide, Release 0.0.1

440 Chapter 90. Layers


CHAPTER

NINETYONE

LEGACYTEXTITEM

legacyTextItems[index
Description
A text object created in Illustrator CS (version 10) or earlier, which is uneditable until converted. To convert legacy
text, see [Link]().
You can view, move, and print legacy text, but you cant edit it. Legacy text has an “x” through its bounding box when
selected.

91.1 Properties

91.1.1 [Link]

legacyTextItems[index].artworkKnockout
Description
Is this object used to create a knockout, and if so, what kind of knockout.
Type
KnockoutState

91.1.2 [Link]

legacyTextItems[index].blendingMode
Description
The blend mode used when compositing an object.
Type
BlendModes

441
Illustrator Scripting Guide, Release 0.0.1

91.1.3 [Link]

legacyTextItems[index].controlBounds
Description
The bounds of the object including stroke width and controls.
Type
Array of 4 numbers, read-only.

91.1.4 [Link]

legacyTextItems[index].converted
Description
If true, the legacy text item has been updated to a native text frame item.
Type
Boolean, read-only.

91.1.5 [Link]

legacyTextItems[index].editable
Description
If true, this item is editable.
Type
Boolean, read-only.

91.1.6 [Link]

legacyTextItems[index].geometricBounds
Description
The bounds of the object excluding stroke width.
Type
Array of 4 numbers, read-only.

442 Chapter 91. LegacyTextItem


Illustrator Scripting Guide, Release 0.0.1

91.1.7 [Link]

legacyTextItems[index].height
Description
The height of the group item.
Type
Number (double).

91.1.8 [Link]

legacyTextItems[index].hidden
Description
If true, this item is hidden.
Type
Boolean.

91.1.9 [Link]

legacyTextItems[index].isIsolated
Description
If true, this object is isolated.
Type
Boolean.

91.1.10 [Link]

legacyTextItems[index].layer
Description
The layer to which this item belongs.
Type
Layer, read-only.

91.1. Properties 443


Illustrator Scripting Guide, Release 0.0.1

91.1.11 [Link]

legacyTextItems[index].left
Description
The position of the left side of the item (in points, measured from the left side of the page).
Type
Number (double).

91.1.12 [Link]

legacyTextItems[index].locked
Description
If true, this item is locked.
Type
Boolean.

91.1.13 [Link]

legacyTextItems[index].name
Description
The name of this item.
Type
String.

91.1.14 [Link]

legacyTextItems[index].note
Description
The note assigned to this item.
Type
String.

444 Chapter 91. LegacyTextItem


Illustrator Scripting Guide, Release 0.0.1

91.1.15 [Link]

legacyTextItems[index].opacity
Description
The opacity of the object. Range: 0.0 to 100.0.
Type
Number (double).

91.1.16 [Link]

legacyTextItems[index].parent
Description
The parent of this object.
Type
Layer or GroupItem, read-only.

91.1.17 [Link]

legacyTextItems[index].position
Description
The position (in points) of the top left corner of the legacyTextItems[index object in the format [x, y]. Does not
include stroke weight.
Type
Array of 2 numbers.

91.1.18 [Link]

legacyTextItems[index].selected
Description
If true, this item is selected.
Type
Boolean.

91.1. Properties 445


Illustrator Scripting Guide, Release 0.0.1

91.1.19 [Link]

legacyTextItems[index].sliced
Description
If true, the item sliced. Default: false.
Type
Boolean.

91.1.20 [Link]

legacyTextItems[index].tags
Description
The tags contained in this item.
Type
Tags, read-only.

91.1.21 [Link]

legacyTextItems[index].top
Description
The position of the top of the item (in points, measured from the bottom of the page).
Type
Number (double).

91.1.22 [Link]

legacyTextItems[index].typename
Description
The class name of the referenced object.
Type
String, read-only.

446 Chapter 91. LegacyTextItem


Illustrator Scripting Guide, Release 0.0.1

91.1.23 [Link]

legacyTextItems[index].uRL
Description
The value of the Adobe URL tag assigned to this item.
Type
String.

91.1.24 [Link]

legacyTextItems[index].visibilityVariable
Description
The visibility variable bound to the item.
Type
Variable

91.1.25 [Link]

legacyTextItems[index].visibleBounds
Description
The visible bounds of the item including stroke width.
Type
Array of 4 numbers, read-only.

91.1.26 [Link]

legacyTextItems[index].width
Description
The width of the item.
Type
Number (double).

91.1. Properties 447


Illustrator Scripting Guide, Release 0.0.1

91.1.27 [Link]

legacyTextItems[index].wrapInside
Description
If true, the text frame object should be wrapped inside this object.
Type
Boolean.

91.1.28 [Link]

legacyTextItems[index].wrapOffset
Description
The offset to use when wrapping text around this object.
Type
Number (double).

91.1.29 [Link]

legacyTextItems[index].wrapped
Description
If true, wrap text frame objects around this object (text frame must be above the object).
Type
Boolean.

91.1.30 [Link]

legacyTextItems[index].zOrderPosition
Description
The position of this item within the stacking order of the group or layer (parent) that contains the item.
Type
Number (long), read-only.

448 Chapter 91. LegacyTextItem


Illustrator Scripting Guide, Release 0.0.1

91.2 Methods

91.2.1 [Link]()

legacyTextItems[index].convertToNative()
Description
Converts the legacy text item to a text frame and deletes the original legacy text.
Returns
GroupItem

91.2.2 [Link]()

legacyTextItems[index].duplicate([relativeObject] [,insertionLocation])
Description
Creates a duplicate of the selected object.
Parameters

Parameter Type Description


relativeObject Object, optional Object to duplicate to
insertionLocation ElementPlacement, optional Location to insert element

Returns
LegacyTextItem

91.2.3 [Link]()

legacyTextItems[index].move(relativeObject, insertionLocation)
Description
Moves the object.
Parameters

Parameter Type Description


relativeObject Object Object to move element within
insertionLocation ElementPlacement, optional Location to move element to

Returns
LegacyTextItem

91.2. Methods 449


Illustrator Scripting Guide, Release 0.0.1

91.2.4 [Link]()

legacyTextItems[index].remove()
Description
Deletes this object.
Returns
Nothing.

91.2.5 [Link]()

[Link](scaleX, scaleY
[,changePositions] [,changeFillPatterns] [,changeFillGradients]
[,changeStrokePattern] [,changeLineWidths] [,scaleAbout]
)

Description
Scales the art item where scaleX is the horizontal scaling factor and scaleY is the vertical scaling factor. 100.0 = 100%.
Parameters

Parameter Type Description


scaleX Number (double) Horizontal scaling factor
scaleY Number (double) Vertical scaling factor
changePositions Boolean, optional Whether to effect art object positions and orientations
changeFillPatterns Boolean, optional Whether to transform fill patterns
changeFillGradients Boolean, optional Whether to transform fill gradients
changeStrokePattern Boolean, optional Whether to transform stroke patterns
changeLineWidths Number (double), optional The amount to scale line widths
scaleAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

91.2.6 [Link]()

[Link](angle [,changePositions] [,changeFillPatterns]


[,changeFillGradients] [,changeStrokePattern] [,rotateAbout]
)

Description
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.
Parameters

450 Chapter 91. LegacyTextItem


Illustrator Scripting Guide, Release 0.0.1

Parameter Type Description


angle Number (double) The angle amount to rotate the element
changePositions Boolean, optional Whether to effect art object positions and orientations
changeFillPatterns Boolean, optional Whether to transform fill patterns
changeFillGradients Boolean, optional Whether to transform fill gradients
changeStrokePattern Boolean, optional Whether to transform stroke patterns
rotateAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

91.2.7 [Link]()

[Link](transformationMatrix
[,changePositions] [,changeFillPatterns] [,changeFillGradients]
[,changeStrokePattern] [,changeLineWidths] [,transformAbout]
)

Description
Transforms the art item by applying a transformation matrix.
Parameters

Parameter Type Description


transformationMatrix Matrix Transformation matrix to apply
changePositions Boolean, optional Whether to change Positions
changeFillPatterns Boolean, optional Whether to change Fill Patterns
changeFillGradients Boolean, optional Whether to change Fill Gradients
changeStrokePattern Boolean, optional Whether to change Stroke Pattern
changeLineWidths Number (double), optional The amount to scale line widths
transformAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

91.2.8 [Link]()

[Link]([deltaX] [,deltaY]
[,transformObjects] [,transformFillPatterns]
[,transformFillGradients] [,transformStrokePatterns]
)

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

91.2. Methods 451


Illustrator Scripting Guide, Release 0.0.1

Parameters

Parameter Type Description


deltaX Number (double), optional Horizontal offset
deltaY Number (double), optional Vertical offset
transformObjects Boolean, optional Whether to transform Objects
transformFillPatterns Boolean, optional Whether to transform Fill Patterns
transformFillGradients Boolean, optional Whether to transform Fill Gradients
transformStrokePatterns Boolean, optional Whether to transform Stroke Patterns

Returns
Nothing.

91.2.9 [Link]()

legacyTextItems[index].zOrder(zOrderCmd)
Description
Arranges the art item’s position in the stacking order of the group or layer (parent) of this object.
Parameters

Parameter Type Description


zOrderCmd ZOrderMethod Stacking order arrangement method

Returns
Nothing.

452 Chapter 91. LegacyTextItem


CHAPTER

NINETYTWO

LEGACYTEXTITEMS

legacyTextItems
Description
A collection of LegacyTextItem objects.

92.1 Properties

92.1.1 [Link]

[Link]
Description
Number of elements in the collection.
Type
Number, read-only.

92.1.2 [Link]

[Link]
Description
The object’s container.
Type
Object, read-only.

453
Illustrator Scripting Guide, Release 0.0.1

92.1.3 [Link]

[Link]
Description
The class name of the object.
Type
String, read-only.

92.2 Methods

92.2.1 [Link]()

[Link]()
Description
Creates text frames from all legacy text items; the original legacy text items are deleted. Returns true on success.
Returns
Boolean.

92.2.2 [Link]()

[Link](name)
Description
Get the first element in the collection with the specified name.
Parameters

Parameter Type Description


name String Name of element to get

Returns
LegacyTextItem

454 Chapter 92. LegacyTextItems


Illustrator Scripting Guide, Release 0.0.1

92.2.3 [Link]()

[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number String or number key

Returns
LegacyTextItem

92.2.4 [Link]()

[Link]()
Description
Deletes all elements in this collection.
Returns
Nothing.

92.2. Methods 455


Illustrator Scripting Guide, Release 0.0.1

456 Chapter 92. LegacyTextItems


CHAPTER

NINETYTHREE

LINES

lines
Description
A collection of TextRange objects representing lines of text in a text frame. The elements are not named; you must
access them by index.

93.1 Properties

93.1.1 [Link]

[Link]
Description
Number of elements in the collection.
Type
Number, read-only.

93.1.2 [Link]

[Link]
Description
The object’s container.
Type
Object, read-only.

457
Illustrator Scripting Guide, Release 0.0.1

93.1.3 [Link]

[Link]
Description
The class name of the object.
Type
String, read-only.

93.2 Methods

93.2.1 [Link]()

[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number String or number key

Returns
TextRange

93.2.2 [Link]()

[Link]()
Description
Deletes all elements in this collection.
Returns
Nothing.

458 Chapter 93. Lines


CHAPTER

NINETYFOUR

MATRIX

matrix
Description
A transformation matrix specification, used to transform the geometry of objects. Use it to specify and retrieve matrix
information from an Illustrator document or from page items in a document.
Matrices are used in conjunction with the transform method and as a property of a number of objects. A matrix
specifies how to transform the geometry of an object. You can generate an original matrix using the Application object
methods [Link](), [Link](), or [Link]().
A Matrix is a record containing the matrix values, not a reference to a matrix object. The matrix commands 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.

94.1 Properties

94.1.1 [Link]

[Link]
Description
Matrix property a.
Type
Number (double).

94.1.2 [Link]

[Link]
Description
Matrix property b.
Type
Number (double).

459
Illustrator Scripting Guide, Release 0.0.1

94.1.3 [Link]

[Link]
Description
Matrix property c.
Type
Number (double).

94.1.4 [Link]

[Link]
Description
Matrix property d.
Type
Number (double).

94.1.5 [Link]

[Link]
Description
Matrix property tx.
Type
Number (double).

94.1.6 [Link]

[Link]
Description
Matrix property ty.
Type
Number (double).

460 Chapter 94. Matrix


Illustrator Scripting Guide, Release 0.0.1

94.1.7 [Link]

[Link]
Description
The class name of the referenced object.
Type
String, read-only.

94.2 Example

94.2.1 Combining matrices to apply multiple transformations

To apply multiple transformations to objects, it is more efficient to use the matrix suite than to apply the transformations
one at a time. The following script demonstrates how to combine multiple matrices.

// Tranforms all art in a document using translation and rotation matrices,


// moves art half an inch to the right and 1.5 inches up on the page
if ([Link] > 0) {
var moveMatrix = [Link](0.5, 1.5);

// Add a rotation to the translation, 10 degrees counter clockwise


var totalMatrix = concatenateRotationMatrix(moveMatrix, 10);

// apply the transformation to all art in the document


var doc = [Link];
for (var i = 0; i < [Link]; i++) {
[Link][i].transform(totalMatrix);
}
}

94.2. Example 461


Illustrator Scripting Guide, Release 0.0.1

462 Chapter 94. Matrix


CHAPTER

NINETYFIVE

MESHITEM

[Link][index
Description
A gradient mesh art item. You cannot create mesh items from a script. However, you can copy an existing mesh item
with the duplicate method, then use the one of the move methods to place the copy at the proper location.

95.1 Properties

95.1.1 [Link]

[Link][index].artworkKnockout
Description
Is this object used to create a knockout, and if so, what kind of knockout.
Type
KnockoutState

95.1.2 [Link]

[Link][index].blendingMode
Description
The blend mode used when compositing an object.
Type
BlendModes

463
Illustrator Scripting Guide, Release 0.0.1

95.1.3 [Link]

[Link][index].controlBounds
Description
The bounds of the object including stroke width and controls.
Type
Array of 4 numbers, read-only.

95.1.4 [Link]

[Link][index].editable
Description
If true, this item is editable.
Type
Boolean, read-only.

95.1.5 [Link]

[Link][index].geometricBounds
Description
The bounds of the object excluding stroke width.
Type
Array of 4 numbers, read-only.

95.1.6 [Link]

[Link][index].height
Description
The height of the group item.
Type
Number (double).

464 Chapter 95. MeshItem


Illustrator Scripting Guide, Release 0.0.1

95.1.7 [Link]

[Link][index].hidden
Description
If true, this item is hidden.
Type
Boolean.

95.1.8 [Link]

[Link][index].isIsolated
Description
If true, this object is isolated.
Type
Boolean.

95.1.9 [Link]

[Link][index].layer
Description
The layer to which this item belongs.
Type
Layer, read-only.

95.1.10 [Link]

[Link][index].left
Description
The position of the left side of the item (in points, measured from the left side of the page).
Type
Number (double).

95.1. Properties 465


Illustrator Scripting Guide, Release 0.0.1

95.1.11 [Link]

[Link][index].locked
Description
If true, this item is locked.
Type
Boolean.

95.1.12 [Link]

[Link][index].name
Description
The name of this item.
Type
String.

95.1.13 [Link]

[Link][index].note
Description
The note assigned to this item.
Type
String.

95.1.14 [Link]

[Link][index].opacity
Description
The opacity of the object. Range: 0.0 to 100.0.
Type
Number (double).

466 Chapter 95. MeshItem


Illustrator Scripting Guide, Release 0.0.1

95.1.15 [Link]

[Link][index].parent
Description
The parent of this object.
Type
Layer or GroupItem, read-only.

95.1.16 [Link]

[Link][index].position
Description
The position (in points) of the top left corner of the MeshItem object in the format [x, y]. Does not include stroke
weight.
Type
Array of 2 numbers.

95.1.17 [Link]

[Link][index].selected
Description
If true, this item is selected.
Type
Boolean.

95.1.18 [Link]

[Link][index].sliced
Description
If true, the item sliced. Default: false.
Type
Boolean.

95.1. Properties 467


Illustrator Scripting Guide, Release 0.0.1

95.1.19 [Link]

[Link][index].tags
Description
The tags contained in this item.
Type
Tags, read-only.

95.1.20 [Link]

[Link][index].top
Description
The position of the top of the item (in points, measured from the bottom of the page).
Type
Number (double).

95.1.21 [Link]

[Link][index].typename
Description
The class name of the referenced object.
Type
String, read-only.

95.1.22 [Link]

[Link][index].uRL
Description
The value of the Adobe URL tag assigned to this item.
Type
String.

468 Chapter 95. MeshItem


Illustrator Scripting Guide, Release 0.0.1

95.1.23 [Link]

[Link][index].visibilityVariable
Description
The visibility variable bound to the item.
Type
Variable

95.1.24 [Link]

[Link][index].visibleBounds
Description
The visible bounds of the item including stroke width.
Type
Array of 4 numbers, read-only.

95.1.25 [Link]

[Link][index].width
Description
The width of the item.
Type
Number (double).

95.1.26 [Link]

[Link][index].wrapInside
Description
If true, the text frame object should be wrapped inside this object.
Type
Boolean.

95.1. Properties 469


Illustrator Scripting Guide, Release 0.0.1

95.1.27 [Link]

[Link][index].wrapOffset
Description
The offset to use when wrapping text around this object.
Type
Number (double).

95.1.28 [Link]

[Link][index].wrapped
Description
If true, wrap text frame objects around this object (text frame must be above the object).
Type
Boolean.

95.1.29 [Link]

[Link][index].zOrderPosition
Description
The position of this item within the stacking order of the group or layer (parent) that contains the item.
Type
Number (long), read-only.

95.2 Methods

95.2.1 [Link]()

[Link][index].duplicate([relativeObject] [,insertionLocation])
Description
Creates a duplicate of the selected object.
Parameters

Parameter Type Description


relativeObject Object, optional Object to duplicate to
insertionLocation ElementPlacement, optional Location to insert element

470 Chapter 95. MeshItem


Illustrator Scripting Guide, Release 0.0.1

Returns
MeshItem

95.2.2 [Link]()

[Link][index].move(relativeObject, insertionLocation)
Description
Moves the object.
Parameters

Parameter Type Description


relativeObject Object Object to move element within
insertionLocation ElementPlacement, optional Location to move element to

Returns
MeshItem

95.2.3 [Link]()

[Link][index].move()
Description
Deletes this object.
Returns
Nothing.

95.2.4 [Link]()

[Link][index].resize(scaleX, scaleY
[,changePositions] [,changeFillPatterns] [,changeFillGradients]
[,changeStrokePattern] [,changeLineWidths] [,scaleAbout]
)

Description
Scales the art item where scaleX is the horizontal scaling factor and scaleY is the vertical scaling factor. 100.0 =
100%.
Parameters

95.2. Methods 471


Illustrator Scripting Guide, Release 0.0.1

Parameter Type Description


scaleX Number (double) Horizontal scaling factor
scaleY Number (double) Vertical scaling factor
changePositions Boolean, optional Whether to effect art object positions and orientations
changeFillPatterns Boolean, optional Whether to transform fill patterns
changeFillGradients Boolean, optional Whether to transform fill gradients
changeStrokePattern Boolean, optional Whether to transform stroke patterns
changeLineWidths Number (double), optional The amount to scale line widths
scaleAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

95.2.5 [Link]()

[Link][index].rotate(angle [,changePositions]
[,changeFillPatterns] [,changeFillGradients]
[,changeStrokePattern] [,rotateAbout]
)

Description
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.
Parameters

Parameter Type Description


angle Number (double) The angle amount to rotate the element
changePositions Boolean, optional Whether to effect art object positions and orientations
changeFillPatterns Boolean, optional Whether to transform fill patterns
changeFillGradients Boolean, optional Whether to transform fill gradients
changeStrokePattern Boolean, optional Whether to transform stroke patterns
rotateAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

472 Chapter 95. MeshItem


Illustrator Scripting Guide, Release 0.0.1

95.2.6 [Link]()

[Link][index].transform(transformationMatrix
[,changePositions] [,changeFillPatterns] [,changeFillGradients]
[,changeStrokePattern] [,changeLineWidths] [,transformAbout]
)

Description
Transforms the art item by applying a transformation matrix.
Parameters

Parameter Type Description


transformationMatrix Matrix Transformation matrix to apply
changePositions Boolean, optional Whether to change Positions
changeFillPatterns Boolean, optional Whether to change Fill Patterns
changeFillGradients Boolean, optional Whether to change Fill Gradients
changeStrokePattern Boolean, optional Whether to change Stroke Pattern
changeLineWidths Number (double), optional The amount to scale line widths
transformAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

95.2.7 [Link]()

[Link][index].translate([deltaX] [,deltaY]
[,transformObjects] [,transformFillPatterns]
[,transformFillGradients] [,transformStrokePatterns]
)

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

Parameter Type Description


deltaX Number (double), optional Horizontal offset
deltaY Number (double), optional Vertical offset
transformObjects Boolean, optional Whether to transform Objects
transformFillPatterns Boolean, optional Whether to transform Fill Patterns
transformFillGradients Boolean, optional Whether to transform Fill Gradients
transformStrokePatterns Boolean, optional Whether to transform Stroke Patterns

Returns
Nothing.

95.2. Methods 473


Illustrator Scripting Guide, Release 0.0.1

95.2.8 [Link]()

[Link][index].zOrder(zOrderCmd)
Description
Arranges the art item’s position in the stacking order of the group or layer (parent) of this object.
Parameters

Parameter Type Description


zOrderCmd ZOrderMethod Stacking order arrangement method

Returns
Nothing.

95.3 Example

95.3.1 Example name

// Locks all mesh items in the current document


if ([Link] > 0) {
var doc = [Link];
for (var i = 0; i < [Link]; i++) {
[Link][i].locked = true;
}
}

474 Chapter 95. MeshItem


CHAPTER

NINETYSIX

MESHITEMS

[Link]
Description
A collection of MeshItem objects.

96.1 Properties

96.1.1 [Link]

[Link]
Description
The number of objects in the collection.
Type
Number, read-only.

96.1.2 [Link]

[Link]
Description
The parent of this object.
Type
Object, read-only.

475
Illustrator Scripting Guide, Release 0.0.1

96.1.3 [Link]

[Link]
Description
The class name of the referenced object.
Type
String, read-only.

96.2 Methods

96.2.1 [Link]()

[Link](name)
Description
Gets the first element in the collection with the specified name.
Parameters

Parameter Type Description


name String Name of element to get

Returns
MeshItem

96.2.2 [Link]()

[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number String or number key

Returns
MeshItem

476 Chapter 96. MeshItems


Illustrator Scripting Guide, Release 0.0.1

96.2.3 [Link]()

[Link]()
Description
Deletes all elements in this collection.
Returns
Nothing.

96.3 Example

96.3.1 Copying mesh items to another document

To run this script, have two open documents. One document should contain at least one mesh item, the other document
can be empty. Make the empty document the frontmost before running the script.

// Copies all mesh items from one document to a new document


if ([Link] > 0) {
var srcDoc = documents[0];
var locationOffset = 0;
var targetDoc = [Link]();
for (var i = 0; i < [Link]; i++) {
var srcItem = [Link][i];
var dupItem = [Link][i].duplicate(targetDoc, [Link]);

// offset the copied items' position on the y axis


[Link] = Array(100, 50 + locationOffset);
locationOffset += 50;
}
}

96.3. Example 477


Illustrator Scripting Guide, Release 0.0.1

478 Chapter 96. MeshItems


CHAPTER

NINETYSEVEN

NONNATIVEITEM

nonNativeItems[index
Description
A non-native artwork item.

97.1 Properties

97.1.1 [Link]

nonNativeItems[index].artworkKnockout
Description
Is this object used to create a knockout, and if so, what kind of knockout.
Type
KnockoutState

97.1.2 [Link]

nonNativeItems[index].blendingMode
Description
The blend mode used when compositing an object.
Type
BlendModes

479
Illustrator Scripting Guide, Release 0.0.1

97.1.3 [Link]

nonNativeItems[index].controlBounds
Description
The bounds of the object including stroke width and controls.
Type
Array of 4 numbers, read-only.

97.1.4 [Link]

nonNativeItems[index].editable
Description
If true, this item is editable.
Type
Boolean, read-only.

97.1.5 [Link]

nonNativeItems[index].geometricBounds
Description
The bounds of the object excluding stroke width.
Type
Array of 4 numbers, read-only.

97.1.6 [Link]

nonNativeItems[index].height
Description
The height of the group item.
Type
Number (double).

480 Chapter 97. NonNativeItem


Illustrator Scripting Guide, Release 0.0.1

97.1.7 [Link]

nonNativeItems[index].hidden
Description
If true, this item is hidden.
Type
Boolean.

97.1.8 [Link]

nonNativeItems[index].isIsolated
Description
If true, this object is isolated.
Type
Boolean.

97.1.9 [Link]

nonNativeItems[index].layer
Description
The layer to which this item belongs.
Type
Layer, read-only.

97.1.10 [Link]

nonNativeItems[index].left
Description
The position of the left side of the item (in points, measured from the left side of the page).
Type
Number (double).

97.1. Properties 481


Illustrator Scripting Guide, Release 0.0.1

97.1.11 [Link]

nonNativeItems[index].locked
Description
If true, this item is locked.
Type
Boolean.

97.1.12 [Link]

nonNativeItems[index].name
Description
The name of this item.
Type
String.

97.1.13 [Link]

nonNativeItems[index].note
Description
The note assigned to this item.
Type
String.

97.1.14 [Link]

nonNativeItems[index].opacity
Description
The opacity of the object. Range: 0.0 to 100.0.
Type
Number (double).

482 Chapter 97. NonNativeItem


Illustrator Scripting Guide, Release 0.0.1

97.1.15 [Link]

nonNativeItems[index].parent
Description
The parent of this object.
Type
Document, Layer or GroupItem, read-only.

97.1.16 [Link]

nonNativeItems[index].position
Description
The position (in points) of the top left corner of the NonNativeItems[index object in the format [x, y]. Does not
include stroke weight.
Type
Array of 2 numbers.

97.1.17 [Link]

nonNativeItems[index].selected
Description
If true, this item is selected.
Type
Boolean.

97.1.18 [Link]

nonNativeItems[index].sliced
Description
If true, the item sliced. Default: false.
Type
Boolean.

97.1. Properties 483


Illustrator Scripting Guide, Release 0.0.1

97.1.19 [Link]

nonNativeItems[index].tags
Description
The tags contained in this item.
Type
Tags, read-only.

97.1.20 [Link]

nonNativeItems[index].top
Description
The position of the top of the item (in points, measured from the bottom of the page).
Type
Number (double).

97.1.21 [Link]

nonNativeItems[index].typename
Description
The class name of the referenced object.
Type
String, read-only.

97.1.22 [Link]

nonNativeItems[index].uRL
Description
The value of the Adobe URL tag assigned to this item.
Type
String.

484 Chapter 97. NonNativeItem


Illustrator Scripting Guide, Release 0.0.1

97.1.23 [Link]

nonNativeItems[index].visibilityVariable
Description
The visibility variable bound to the item.
Type
Variable

97.1.24 [Link]

nonNativeItems[index].visibleBounds
Description
The visible bounds of the item including stroke width.
Type
Array of 4 numbers, read-only.

97.1.25 [Link]

nonNativeItems[index].width
Description
The width of the item.
Type
Number (double).

97.1.26 [Link]

nonNativeItems[index].wrapInside
Description
If true, the non-native-item object should be wrapped inside this object.
Type
Boolean.

97.1. Properties 485


Illustrator Scripting Guide, Release 0.0.1

97.1.27 [Link]

nonNativeItems[index].wrapOffset
Description
The offset to use when wrapping text around this object.
Type
Number (double).

97.1.28 [Link]

nonNativeItems[index].wrapped
Description
If true, wrap non-native-item objects around this object (non-native-item object must be above the object).
Type
Boolean.

97.1.29 [Link]

nonNativeItems[index].zOrderPosition
Description
The position of this item within the stacking order of the group or layer (parent) that contains the item.
Type
Number, read-only.

97.2 Methods

97.2.1 [Link]()

nonNativeItems[index].duplicate([relativeObject] [,insertionLocation])
Description
Creates a duplicate of the selected object.
Parameters

Parameter Type Description


relativeObject Object, optional Object to duplicate to
insertionLocation ElementPlacement, optional Location to insert element

486 Chapter 97. NonNativeItem


Illustrator Scripting Guide, Release 0.0.1

Returns
NonNativeItem

97.2.2 [Link]()

nonNativeItems[index].move(relativeObject, insertionLocation)
Description
Moves the object.
Parameters

Parameter Type Description


relativeObject Object Object to move element within
insertionLocation ElementPlacement, optional Location to move element to

Returns
NonNativeItem

97.2.3 [Link]()

nonNativeItems[index].remove()
Description
Deletes this object.
Returns
Nothing.

97.2.4 [Link]()

nonNativeItems[index].removeAll()
Description
Deletes all elements in this collection.
Returns
Nothing.

97.2. Methods 487


Illustrator Scripting Guide, Release 0.0.1

97.2.5 [Link]()

[Link](scaleX, scaleY
[,changePositions] [,changeFillPatterns] [,changeFillGradients]
[,changeStrokePattern] [,changeLineWidths] [,scaleAbout]
)

Description
Scales the art item where scaleX is the horizontal scaling factor and scaleY is the vertical scaling factor. 100.0 =
100%.
Parameters

Parameter Type Description


scaleX Number (double) Horizontal scaling factor
scaleY Number (double) Vertical scaling factor
changePositions Boolean, optional Whether to effect art object positions and orientations
changeFillPatterns Boolean, optional Whether to transform fill patterns
changeFillGradients Boolean, optional Whether to transform fill gradients
changeStrokePattern Boolean, optional Whether to transform stroke patterns
changeLineWidths Number (double), optional The amount to scale line widths
scaleAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

97.2.6 [Link]()

[Link](angle
[,changePositions] [,changeFillPatterns]
[,changeFillGradients] [,changeStrokePattern] [,rotateAbout]
)

Description
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.
Parameters

Parameter Type Description


angle Number (double) The angle amount to rotate the element
changePositions Boolean, optional Whether to effect art object positions and orientations
changeFillPatterns Boolean, optional Whether to transform fill patterns
changeFillGradients Boolean, optional Whether to transform fill gradients
changeStrokePattern Boolean, optional Whether to transform stroke patterns
rotateAbout Transformation, optional The point to use as anchor, to transform about

Returns

488 Chapter 97. NonNativeItem


Illustrator Scripting Guide, Release 0.0.1

Nothing.

97.2.7 [Link]()

[Link](transformationMatrix
[,changePositions] [,changeFillPatterns] [,changeFillGradients]
[,changeStrokePattern] [,changeLineWidths] [,transformAbout]
)

Description
Transforms the art item by applying a transformation matrix.
Parameters

Parameter Type Description


transformationMatrix Matrix Transformation matrix to apply
changePositions Boolean, optional Whether to change Positions
changeFillPatterns Boolean, optional Whether to change Fill Patterns
changeFillGradients Boolean, optional Whether to change Fill Gradients
changeStrokePattern Boolean, optional Whether to change Stroke Pattern
changeLineWidths Number (double), optional The amount to scale line widths
transformAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

97.2.8 [Link]()

[Link]([deltaX] [,deltaY]
[,transformObjects] [,transformFillPatterns]
[,transformFillGradients] [,transformStrokePatterns]
)

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

Parameter Type Description


deltaX Number (double), optional Horizontal offset
deltaY Number (double), optional Vertical offset
transformObjects Boolean, optional Whether to transform Objects
transformFillPatterns Boolean, optional Whether to transform Fill Patterns
transformFillGradients Boolean, optional Whether to transform Fill Gradients
transformStrokePatterns Boolean, optional Whether to transform Stroke Patterns

97.2. Methods 489


Illustrator Scripting Guide, Release 0.0.1

Returns
Nothing.

97.2.9 [Link]()

nonNativeItems[index].zOrder(zOrderCmd)
Description
Arranges the art item’s position in the stacking order of the group or layer (parent) of this object.
Parameters

Parameter Type Description


zOrderCmd ZOrderMethod Stacking order arrangement method

Returns
Nothing.

490 Chapter 97. NonNativeItem


CHAPTER

NINETYEIGHT

NONNATIVEITEMS

nonNativeItems
Description
A collection of NonNativeItem objects.

98.1 Properties

98.1.1 [Link]

[Link]
Description
The number of objects in the collection.
Type
Number, read-only.

98.1.2 [Link]

[Link]
Description
The parent of this object.
Type
Object, read-only.

491
Illustrator Scripting Guide, Release 0.0.1

98.1.3 [Link]

[Link]
Description
The class name of the referenced object.
Type
String, read-only.

98.2 Methods

98.2.1 [Link]()

[Link](name)
Description
Gets the first element in the collection with the specified name.
Parameters

Parameter Type Description


name String Name of element to get

Returns
NonNativeItem, SymbolItem

492 Chapter 98. NonNativeItems


CHAPTER

NINETYNINE

OPENOPTIONS

openOptions
Description
Options for opening a document, used with the [Link]() method.

99.1 Properties

99.1.1 [Link]

[Link]
Description
Optional. Convert crop areas to artboards when opening a legacy document in Illustrator CS4 or later. When false,
crop areas are discarded. Default: true.
Type
Boolean.

99.1.2 [Link]

[Link]
Description
Optional. Convert print tiles to artboards when opening a legacy document in Illustrator CS4 or later. Default: false.
Type
Boolean.

493
Illustrator Scripting Guide, Release 0.0.1

99.1.3 [Link]

[Link]
Description
Optional. Create an artboard with the dimensions of the bounding box of the artwork when opening a legacy document
in Illustrator CS4 or later. Default: false.
Type
Boolean.

99.1.4 [Link]

[Link]
Description
Optional. Open the file as an Illustrator library of this type. Default: [Link].
Type
LibraryType

99.1.5 [Link]

[Link]
Description
Optional. Preserve legacy artboards when opening a legacy document in Illustrator CS4 or later. Default: true.
Type
Boolean.

99.1.6 [Link]

[Link]
Description
If true, preserves the spot colors in the gradient mesh objects for legacy documents (pre-Illustrator CS4). Default:
true.
Type
Boolean.

494 Chapter 99. OpenOptions


Illustrator Scripting Guide, Release 0.0.1

99.1.7 [Link]

[Link]
Description
Optional. If true, update all legacy text items (from previous versions of Illustrator). Default: false.
Type
Boolean.

99.2 Example

99.2.1 Automatically updating legacy text on open

// Opens a file with legacy text (AI 10 or older), using


// OpenOptions to automatically update the legacy text.

var fileRef = filePath;


if (fileRef != null) {
var openOptions = new OpenOptions();
[Link] = true;

var docRef = open(fileRef, [Link], openOptions);


}

99.2. Example 495


Illustrator Scripting Guide, Release 0.0.1

496 Chapter 99. OpenOptions


CHAPTER

OPENOPTIONSAUTOCAD

openOptionsAutoCAD
Description
Options for opening an AutoCAD drawing, used with the [Link]() method.

100.1 Properties

100.1.1 [Link]

[Link]
Description
If true, the artwork is centered on the artboard. Default: true.
Type
Boolean.

100.1.2 [Link]

[Link]
Description
How to scale the drawing on import. Default: [Link].
Type
AutoCADGlobalScaleOption

497
Illustrator Scripting Guide, Release 0.0.1

100.1.3 [Link]

[Link]
Description
The value when globalScaleOption is [Link], expressed as a percentage.
Range: 0.0 to 100.0. Default is 100.0.
Type
Number (double).

100.1.4 [Link]

[Link]
Description
If true, the layers of the artwork are merged. Default: false.
Type
Boolean.

100.1.5 [Link]

[Link]
Description
The object’s container.
Type
Object, read-only.

100.1.6 [Link]

[Link]
Description
If true, line weights are scaled by the same factor as the rest of the drawing. Default: false.
Type
Boolean.

498 Chapter 100. OpenOptionsAutoCAD


Illustrator Scripting Guide, Release 0.0.1

100.1.7 [Link]

[Link]
Description
The name of the layout in the drawing to import.
Type
String.

100.1.8 [Link]

[Link]
Description
The class name of the object.
Type
String, read-only.

100.1.9 [Link]

[Link]
Description
The unit to map to. Default: [Link].
Type
AutoCADUnit

100.1.10 [Link]

[Link]
Description
The ratio by which to scale while mapping units. Default: 1.0.
Type
Number (double).

100.1. Properties 499


Illustrator Scripting Guide, Release 0.0.1

500 Chapter 100. OpenOptionsAutoCAD


CHAPTER

ONE

OPENOPTIONSFREEHAND

openOptionsFreeHand
Description
Options for opening a FreeHand file.

101.1 Properties

101.1.1 [Link]

[Link]
Description
If true, all text is converted to vector paths; preserves the visual appearance of type. Default: false.
Type
Boolean.

101.1.2 [Link]

[Link]
Description
If true, imports only the page specified in the pageToOpen property. Default: true.
Type
Boolean.

501
Illustrator Scripting Guide, Release 0.0.1

101.1.3 [Link]

[Link]
Description
The number of the page to import when opening a multipage document. Valid only when importSinglePage is true.
Type
Number (long).

101.1.4 [Link]

[Link]
Description
The parent of this object.
Type
Object, read-only.

101.1.5 [Link]

[Link]
Description
The class name of the referenced object.
Type
String, read-only.

502 Chapter 101. OpenOptionsFreeHand


CHAPTER

TWO

OPENOPTIONSPHOTOSHOP

openOptionsPhotoshop
Description
Options for opening a Photoshop document, used with the [Link]() method.

102.1 Properties

102.1.1 [Link]

[Link]
Description
The name of the layer comp to use when the document is converted.
Type
String.

102.1.2 [Link]

[Link]
Description
If true, preserve hidden layers when the document is converted. Default: false.
Type
Boolean.

503
Illustrator Scripting Guide, Release 0.0.1

102.1.3 [Link]

[Link]
Description
If true, preserve image maps when the document is converted. Default: true.
Type
Boolean.

102.1.4 [Link]

[Link]
Description
If true, preserve layers when the document is converted. Default: true.
Type
Boolean.

102.1.5 [Link]

[Link]
Description
If true, preserve slices when the document is converted. Default: true.
Type
Boolean.

102.1.6 [Link]

[Link]
Description
The class name of the object.
Type
String, read-only.

504 Chapter 102. OpenOptionsPhotoshop


CHAPTER

THREE

PAGEITEM

[Link][index
Description
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 TextFrameItem 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.

103.1 Properties

103.1.1 [Link]

[Link][index].artworkKnockout
Description
Is this object used to create a knockout.
Type
KnockoutState

103.1.2 [Link]

[Link][index].blendingMode
Description
The mode to use when compositing this object. An object is considered composited when its opacity is set to less than
100.0 (100%).
Type
BlendModes

505
Illustrator Scripting Guide, Release 0.0.1

103.1.3 [Link]

[Link][index].controlBounds
Description
The bounds of the object including stroke width and controls.
Type
Rect, read-only.

103.1.4 [Link]

[Link][index].editable
Description
If true, this page item is editable.
Type
Boolean, read-only.

103.1.5 [Link]

[Link][index].geometricBounds
Description
The object’s bounds excluding the stroke width.
Type
Array of 4 numbers, read-only.

103.1.6 [Link]

[Link][index].height
Description
The height of the page item, calculated from the geometric bounds. Range: 0.0 to 16348.0.
Type
Number (double).

506 Chapter 103. PageItem


Illustrator Scripting Guide, Release 0.0.1

103.1.7 [Link]

[Link][index].hidden
Description
If true, this page item is hidden.
Type
Boolean.

103.1.8 [Link]

[Link][index].isIsolated
Description
If true, this object is isolated.
Type
Boolean.

103.1.9 [Link]

[Link][index].layer
Description
The layer to which this page item belongs.
Type
Layer, read-only.

103.1.10 [Link]

[Link][index].left
Description
The left position of the art item.
Type
Number (double).

103.1. Properties 507


Illustrator Scripting Guide, Release 0.0.1

103.1.11 [Link]

[Link][index].locked
Description
If true, this page item is locked.
Type
Boolean.

103.1.12 [Link]

[Link][index].name
Description
The name of this page item.
Type
String.

103.1.13 [Link]

[Link][index].note
Description
The note assigned to this item.
Type
String.

103.1.14 [Link]

[Link][index].opacity
Description
The opacity of this object, where 100.0 is completely opaque and 0.0 is completely transparent.
Type
Number (double).

508 Chapter 103. PageItem


Illustrator Scripting Guide, Release 0.0.1

103.1.15 [Link]

[Link][index].parent
Description
The parent of this object.
Type
Object, read-only.

103.1.16 [Link]

[Link][index].pixelAligned
Description
True if this item is aligned to the pixel grid.
Type
Boolean.

103.1.17 [Link]

[Link][index].position
Description
The position (in points) of the top left corner of the item in the format {x, y}. Does not include stroke weight.
Type
Array of 2 numbers.

103.1.18 [Link]

[Link][index].selected
Description
If true, this object is selected.
Type
Boolean.

103.1. Properties 509


Illustrator Scripting Guide, Release 0.0.1

103.1.19 [Link]

[Link][index].sliced
Description
If true, preserve slices.
Type
Boolean.

103.1.20 [Link]

[Link][index].tags
Description
The collection of tags associated with this page item.
Type
Tags

103.1.21 [Link]

[Link][index].top
Description
The top position of the art item.
Type
Number (double).

103.1.22 [Link]

[Link][index].typename
Description
The class name of the object.
Type
String, read-only.

510 Chapter 103. PageItem


Illustrator Scripting Guide, Release 0.0.1

103.1.23 [Link]

[Link][index].uRL
Description
The value of the Adobe URL tag assigned to this page item.
Type
String.

103.1.24 [Link]

[Link][index].uuid

Note: This functionality was added in Illustrator 24.0. (CC2020)

Description
The unique identifier for this pageItem
Type
String, read-only.

103.1.25 [Link]

[Link][index].visibilityVariable
Description
The visibility variable to which this page item path is bound.
Type
Variable

103.1.26 [Link]

[Link][index].visibleBounds
Description
The object’s visible bounds, including stroke width of any objects in the illustration.
Type
Array of 4 numbers, read-only.

103.1. Properties 511


Illustrator Scripting Guide, Release 0.0.1

103.1.27 [Link]

[Link][index].width
Description
The width of the page item, calculated from the geometric bounds. Range: 0.0 to 16348.0.
Type
Number (double).

103.1.28 [Link]

[Link][index].wrapInside
Description
If true, the text frame object should be wrapped inside this object.
Type
Boolean.

103.1.29 [Link]

[Link][index].wrapOffset
Description
The offset to use when wrapping text around this object.
Type
Number (double).

103.1.30 [Link]

[Link][index].wrapped
Description
If true, wrap text frame objects around this object (text frame must be above the object).
Type
Boolean.

512 Chapter 103. PageItem


Illustrator Scripting Guide, Release 0.0.1

103.1.31 [Link]

[Link][index].zOrderPosition
Description
The drawing order of the art within its group or layer.
Type
Number (long), read-only.

103.2 Methods

103.2.1 [Link]()

[Link][index].bringInPerspective(posX, posY, perspectiveGridPlane)


Description
Places art object(s) in a perspective grid at a specified position and grid plane.
Parameters

Parameter Type Description


posX Number X position to place art at
posY Number Y position to place art at
perspectiveGridPlane PerspectiveGridPlaneType Perspective grid plane type to use

Returns
Returns.

103.2.2 [Link]()

[Link][index].resize(
scaleX, scaleY [,changePositions] [,changeFillPatterns] [,changeFillGradients]
[,changeStrokePattern] [,changeLineWidths] [,scaleAbout]
)

Description
Scales the art item where scaleX is the horizontal scaling factor and scaleY is the vertical scaling factor. 100.0 =
100%.
Parameters

103.2. Methods 513


Illustrator Scripting Guide, Release 0.0.1

Parameter Type Description


scaleX Number (double) Horizontal scaling factor
scaleY Number (double) Vertical scaling factor
changePositions Boolean, optional Whether to effect art object positions and orientations
changeFillPatterns Boolean, optional Whether to transform fill patterns
changeFillGradients Boolean, optional Whether to transform fill gradients
changeStrokePattern Boolean, optional Whether to transform stroke patterns
changeLineWidths Number (double), optional The amount to scale line widths
scaleAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

103.2.3 [Link]()

[Link][index].rotate(
angle [,changePositions] [,changeFillPatterns]
[,changeFillGradients] [,changeStrokePattern] [,rotateAbout]
)

Description
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.
Parameters

Parameter Type Description


angle Number (double) The angle amount to rotate the element
changePositions Boolean, optional Whether to effect art object positions and orientations
changeFillPatterns Boolean, optional Whether to transform fill patterns
changeFillGradients Boolean, optional Whether to transform fill gradients
changeStrokePattern Boolean, optional Whether to transform stroke patterns
rotateAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

514 Chapter 103. PageItem


Illustrator Scripting Guide, Release 0.0.1

103.2.4 [Link]()

[Link][index].transform(
transformationMatrix [,changePositions] [,changeFillPatterns] [,changeFillGradients]
[,changeStrokePattern] [,changeLineWidths] [,transformAbout]
)

Description
Transforms the art item by applying a transformation matrix.
Parameters

Parameter Type Description


transformationMatrix Matrix Transformation matrix to apply
changePositions Boolean, optional Whether to change Positions
changeFillPatterns Boolean, optional Whether to change Fill Patterns
changeFillGradients Boolean, optional Whether to change Fill Gradients
changeStrokePattern Boolean, optional Whether to change Stroke Pattern
changeLineWidths Number (double), optional The amount to scale line widths
transformAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

103.2.5 [Link]()

[Link][index].translate(
deltaX [,deltaY] [,transformObjects] [,transformFillPatterns]
[,transformFillGradients] [,transformStrokePatterns]
)

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

Parameter Type Description


deltaX Number (double), optional Horizontal offset
deltaY Number (double), optional Vertical offset
transformObjects Boolean, optional Whether to transform Objects
transformFillPatterns Boolean, optional Whether to transform Fill Patterns
transformFillGradients Boolean, optional Whether to transform Fill Gradients
transformStrokePatterns Boolean, optional Whether to transform Stroke Patterns

Returns
Nothing.

103.2. Methods 515


Illustrator Scripting Guide, Release 0.0.1

103.2.6 [Link]()

[Link][index].zOrder(zOrderCmd)
Description
Arranges the art item’s position in the stacking order of the group or layer (parent) of this object.
Parameters

Parameter Type Description


zOrderCmd ZOrderMethod Stacking order arrangement method

Returns
Nothing.

516 Chapter 103. PageItem


CHAPTER

FOUR

PAGEITEMS

[Link]
Description
A collection of PageItem objects. Provides complete access to all the art items in an Illustrator document in the following
classes:

104.1 PathItem

[Link][index]
Description
Specifies a path item, which contains PathPoint objects that define its geometry.
The PathItem class gives you complete access to paths in Illustrator.
The setEntirePath method provides an extremely efficient way to create paths comprised of straight lines.

104.1.1 Properties

[Link]

[Link][index].area
Description
The area of this path in square points.
If the area is negative, the path is wound counterclockwise.
Self-intersecting paths can contain sub-areas that cancel each other out, which makes this value zero even though the
path has apparent area.
Type
Number (double); read-only.

517
Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].artworkKnockout
Description
Is this object used to create a knockout, and if so, what kind of knockout.
Type
KnockoutState

[Link]

[Link][index].blendingMode
Description
The blend mode used when compositing an object.
Type
BlendModes

[Link]

[Link][index].clipping
Description
If true, this path should be used as a clipping path.
Type
Boolean

[Link]

[Link][index].closed
Description
If true, this path is closed.
Type
Boolean

518 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].controlBounds
Description
The bounds of the object including stroke width and controls.
Type
Array of 4 numbers; read-only.

[Link]

[Link][index].editable
Description
If true, this item is editable.
Type
Boolean; read-only.

[Link]

[Link][index].evenodd
Description
If true, the even-odd rule should be used to determine “insideness.”
Type
Boolean

[Link]

[Link][index].fillColor
Description
The fill color of the path.
Type
Color

104.1. PathItem 519


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].filled
Description
If true, the path is filled.
Type
Boolean

[Link]

[Link][index].fillOverprint
Description
If true, the art beneath a filled object should be overprinted.
Type
Boolean

[Link]

[Link][index].geometricBounds
Description
The bounds of the object excluding stroke width.
Type
Array of 4 numbers; read-only.

[Link]

[Link][index].guides
Description
If true, this path is a guide object.
Type
Boolean

520 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].height
Description
The height of the group item.
Type
Number (double)

[Link]

[Link][index].hidden
Description
If true, this item is hidden.
Type
Boolean

[Link]

[Link][index].isIsolated
Description
If true, this object is isolated.
Type
Boolean

[Link]

[Link][index].layer
Description
The layer to which this item belongs.
Type
Layer; read-only.

104.1. PathItem 521


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].left
Description
The position of the left side of the item (in points, measured from the left side of the page).
Type
Number (double)

[Link]

[Link][index].length
Description
The length of this path in points.
Type
Number (double)

[Link]

[Link][index].locked
Description
If true, this item is locked.
Type
Boolean

[Link]

[Link][index].name
Description
The name of this item.
Type
String

522 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].note
Description
The note assigned to this item.
Type
String

[Link]

[Link][index].opacity
Description
The opacity of the object. Range: 0.0 to 100.0
Type
Number (double)

[Link]

[Link][index].parent
Description
The parent of this object.
Type
Layer or GroupItem

[Link]

[Link][index].pathPoints
Description
The path points contained in this path item.
Type
PathPoints; read-only.

104.1. PathItem 523


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].pixelAligned
Description
true if this item is aligned to the pixel grid.
Type
Boolean

[Link]

[Link][index].polarity
Description
The polarity of the path.
Type
PolarityValues

[Link]

[Link][index].position
Description
The position (in points) of the top left corner of the pluginItem object in the format [x, y]. Does not include stroke
weight.
Type
Array of 2 numbers; read-only.

[Link]

[Link][index].resolution
Description
The resolution of the path in dots per inch (dpi).
Type
Number (double)

524 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].selected
Description
If true, this item is selected.
Type
Boolean

[Link]

[Link][index].selectedPathPoints
Description
All of the selected path points in the path.
Type
PathPoints; read-only.

[Link]

[Link][index].sliced
Description
If true, the item sliced.
Default: false
Type
Boolean

[Link]

[Link][index].strokeCap
Description
The type of line capping.
Type
StrokeCap

104.1. PathItem 525


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].strokeColor
Description
The stroke color for the path.
Type
Color

[Link]

[Link][index].stroked
Description
If true, the path should be stroked.
Type
Boolean

[Link]

[Link][index].strokeDashes
Description
Dash lengths. Set to an empty object, {}, for a solid line.
Type
Object

[Link]

[Link][index].strokeDashOffset
Description
The default distance into the dash pattern at which the pattern should be started.
Type
Number (double)

526 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].strokeJoin
Description
Type of joints for the path.
Type
StrokeJoin

[Link]

[Link][index].strokeMiterLimit
Description
When a default stroke join is set to mitered, this property specifies when the join will be converted to beveled (squared-
off ) by default. The default miter limit of 4 means that when the length of the point reaches four times the stroke
weight, the join switches from a miter join to a bevel join. A value of 1 specifies a bevel join. Range: 1 to 500. Default:
4
Type
Number (double)

[Link]

[Link][index].strokeOverprint
Description
If true, the art beneath a stroked object should be overprinted.
Type
Boolean

[Link]

[Link][index].strokeWidth
Description
The width of the stroke (in points).
Type
Number (double)

104.1. PathItem 527


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].tags
Description
The tags contained in this item.
Type
Tags; read-only.

[Link]

[Link][index].top
Description
The position of the top of the item (in points, measured from the bottom of the page).
Type
Number (double)

[Link]

[Link][index].typename
Description
The class name of the referenced object.
Type
String; read-only.

[Link]

[Link][index].uRL
Description
The value of the Adobe URL tag assigned to this item.
Type
String

528 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].visibilityVariable
Description
The visibility variable bound to the item.
Type
Variable

[Link]

[Link][index].visibleBounds
Description
The visible bounds of the item including stroke width.
Type
Array of 4 numbers; read-only.

[Link]

[Link][index].width
Description
The width of the item.
Type
Number (double)

[Link]

[Link][index].wrapInside
Description
If true, the text frame object should be wrapped inside this object.
Type
Boolean

104.1. PathItem 529


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].wrapOffset
Description
The offset to use when wrapping text around this object.
Type
Number (double)

[Link]

[Link][index].wrapped
Description
If true, wrap text frame objects around this object (text frame must be above the object).
Type
Boolean

[Link]

[Link][index].zOrderPosition
Description
The position of this item within the stacking order of the group or layer (parent) that contains the item.
Type
Number; read-only.

104.1.2 Methods

[Link]()

[Link][index].duplicate([relativeObject][, insertionLocation])
Description
Creates a duplicate of the selected object.
Parameters

Parameter Type Description


relativeObject Object, optional Object to duplicate to
insertionLocation ElementPlacement, optional Location to insert element

Returns

530 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

PathItem

[Link]()

[Link][index].move(relativeObject, insertionLocation)
Description
Moves the object.
Parameters

Parameter Type Description


relativeObject Object Object to move element within
insertionLocation ElementPlacement, optional Location to move element to

Returns
PathItem

[Link]()

[Link][index].remove()
Description
Deletes this object.
Returns
Nothing.

[Link]()

[Link][index].resize(scaleX, scaleY[,changePositions][,
changeFillPatterns][,changeFillGradients][,changeStrokePattern][,changeLineWidths][,
scaleAbout])
Description
Scales the art item where scaleX is the horizontal scaling factor and scaleY is the vertical scaling factor. 100.0 =
100%.
Parameters

104.1. PathItem 531


Illustrator Scripting Guide, Release 0.0.1

Parameter Type Description


scaleX Number (double) Horizontal scaling factor
scaleY Number (double) Vertical scaling factor
changePositions Boolean, optional Whether to effect art object positions and orientations
changeFillPatterns Boolean, optional Whether to transform fill patterns
changeFillGradients Boolean, optional Whether to transform fill gradients
changeStrokePattern Boolean, optional Whether to transform stroke patterns
changeLineWidths Number (double), optional The amount to scale line widths
scaleAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

[Link]()

[Link][index].rotate(angle[,changePositions][,changeFillPatterns][,
changeFillGradients][,changeStrokePattern][,rotateAbout])
Description
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.
Parameters

Parameter Type Description


angle Number (double) The angle amount to rotate the element
changePositions Boolean, optional Whether to effect art object positions and orientations
changeFillPatterns Boolean, optional Whether to transform fill patterns
changeFillGradients Boolean, optional Whether to transform fill gradients
changeStrokePattern Boolean, optional Whether to transform stroke patterns
rotateAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

[Link]()

[Link][index].setEntirePath(pathPoints)
Description
Sets the path using an array of [x, y] coordinate pairs.
Parameters

Parameter Type Description


pathPoints Array of [x, y] coordinate pairs Array of point coordinates to set

532 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

Returns
Nothing.

[Link]()

[Link][index].transform(transformationMatrix[, changePositions][,
changeFillPatterns][, changeFillGradients][, changeStrokePattern][, changeLineWidths][,
transformAbout])
Description
Transforms the art item by applying a transformation matrix.
Parameters

Parameter Type Description


transformationMatrix Matrix Transformation matrix to apply
changePositions Boolean, optional Whether to change Positions
changeFillPatterns Boolean, optional Whether to change Fill Patterns
changeFillGradients Boolean, optional Whether to change Fill Gradients
changeStrokePattern Boolean, optional Whether to change Stroke Pattern
changeLineWidths Number (double), optional The amount to scale line widths
transformAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

[Link]()

[Link][index].translate([deltaX][, deltaY][, transformObjects][,


transformFillPatterns][, transformFillGradients][, transformStrokePatterns])
Description
Repositions the art item relative to the current position, where deltaX is the horizontal offset and deltaY is the vertical
offset.
Parameters

Parameter Type Description


deltaX Number (double), optional Horizontal offset
deltaY Number (double), optional Vertical offset
transformObjects Boolean, optional Whether to transform Objects
transformFillPatterns Boolean, optional Whether to transform Fill Patterns
transformFillGradients Boolean, optional Whether to transform Fill Gradients
transformStrokePatterns Boolean, optional Whether to transform Stroke Patterns

Returns
Nothing.

104.1. PathItem 533


Illustrator Scripting Guide, Release 0.0.1

[Link]()

[Link][index].zOrder(zOrderCmd)
Description
Arranges the art item’s position in the stacking order of the group or layer (parent) of this object.
Parameters

Parameter Type Description


zOrderCmd ZOrderMethod Stacking order arrangement method

Returns
Nothing.

104.1.3 Example

Setting colors in a path

// Sets the stroke and fill of a path item to colors of a randomly selected swatch
if ([Link] > 0 && [Link] > 0) {
var doc = [Link];

for (var i = 0; i < [Link]; i++) {


var pathRef = [Link][i];
[Link] = true;
[Link] = true;

var swatchIndex = [Link]([Link]() * ([Link] - 1));


[Link] = [Link][swatchIndex].color;
[Link] = [Link][swatchIndex].color;
}
}

Creating a path from straight lines

// This script illustrates the use of the setEntirePath method.


// Creates a new open path consisting of 10 straight lines
if ([Link] > 0) {
var lineList = [];

for (i = 0; i < [Link]; i++) {


[Link]([i * 10 + 50, ((i - 5) ^ 2) * 5 + 50];
}

[Link] = true;
(continues on next page)

534 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)


newPath = [Link]();
[Link](lineList);
}

104.2 PlacedItem

[Link][index
Description
An artwork item placed in a document as a linked file.
For example, an artwork object created using the File > Place command in Illustrator or using the add() method
of the placedItems collection object is a placed item.
For information, see PlacedItems.

104.2.1 Properties

[Link]

[Link][index].artworkKnockout
Description
Is this object used to create a knockout, and if so, what kind of knockout.
Type
KnockoutState

[Link]

[Link][index].blendingMode
Description
The blend mode used when compositing an object.
Type
BlendModes

104.2. PlacedItem 535


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].boundingBox
Description
The dimensions of the placed art item regardless of transformations.
Type
Array of 4 numbers

[Link]

[Link][index].contentVariable
Description
The content variable bound to the item.
Type
Variable

[Link]

[Link][index].controlBounds
Description
The bounds of the object including stroke width and controls.
Type
Array of 4 numbers; read-only.

[Link]

[Link][index].editable
Description
If true, this item is editable.
Type
Boolean; read-only.

536 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].file
Description
The file containing the artwork.
Type
File; read-only.

[Link]

[Link][index].geometricBounds
Description
The bounds of the object excluding stroke width.
Type
Array of 4 numbers; read-only.

[Link]

[Link][index].height
Description
The height of the group item.
Type
Number (double)

[Link]

[Link][index].hidden
Description
If true, this item is hidden.
Type
Boolean

104.2. PlacedItem 537


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].isIsolated
Description
If true, this object is isolated.
Type
Boolean

[Link]

[Link][index].layer
Description
The layer to which this item belongs.
Type
Layer; read-only.

[Link]

[Link][index].left
Description
The position of the left side of the item (in points, measured from the left side of the page).
Type
Number (double)

[Link]

[Link][index].locked
Description
If true, this item is locked.
Type
Boolean

538 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].matrix
Description
The transformation matrix of the placed artwork.
Type
Matrix

[Link]

[Link][index].name
Description
The name of this item.
Type
String

[Link]

[Link][index].note
Description
The note assigned to this item.
Type
String

[Link]

[Link][index].opacity
Description
The opacity of the object. Range: 0.0 to 100.0
Type
Number (double)

104.2. PlacedItem 539


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].parent
Description
The parent of this object.
Type
Layer or GroupItem

[Link]

[Link][index].position
Description
The position (in points) of the top left corner of the pluginItem object in the format [x, y]. Does not include stroke
weight.
Type
Array of 2 numbers; read-only.

[Link]

[Link][index].selected
Description
If true, this item is selected.
Type
Boolean

[Link]

[Link][index].sliced
Description
If true, the item sliced.
Default: false
Type
Boolean

540 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].tags
Description
The tags contained in this item.
Type
Tags; read-only.

[Link]

[Link][index].top
Description
The position of the top of the item (in points, measured from the bottom of the page).
Type
Number (double)

[Link]

[Link][index].typename
Description
The class name of the referenced object.
Type
String; read-only.

[Link]

[Link][index].uRL
Description
The value of the Adobe URL tag assigned to this item.
Type
String

104.2. PlacedItem 541


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].visibilityVariable
Description
The visibility variable bound to the item.
Type
Variable

[Link]

[Link][index].visibleBounds
Description
The visible bounds of the item including stroke width.
Type
Array of 4 numbers; read-only.

[Link]

[Link][index].width
Description
The width of the item.
Type
Number (double)

[Link]

[Link][index].wrapInside
Description
If true, the text frame object should be wrapped inside this object.
Type
Boolean

542 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].wrapOffset
Description
The offset to use when wrapping text around this object.
Type
Number (double)

[Link]

[Link][index].wrapped
Description
If true, wrap text frame objects around this object (text frame must be above the object).
Type
Boolean

[Link]

[Link][index].zOrderPosition
Description
The position of this item within the stacking order of the group or layer (parent) that contains the item.
Type
Number; read-only.

104.2.2 Methods

[Link]()

[Link][index].duplicate([relativeObject][, insertionLocation])
Description
Creates a duplicate of the selected object.
Parameters

Parameter Type Description


relativeObject Object, optional Object to duplicate to
insertionLocation ElementPlacement, optional Location to insert element

Returns

104.2. PlacedItem 543


Illustrator Scripting Guide, Release 0.0.1

PlacedItem

[Link]()

[Link][index].embed()
Description
Embeds this art in the document. Converts the art to art item objects as needed and deletes this object.
Returns
Nothing.

[Link]()

[Link][index].move(relativeObject, insertionLocation)
Description
Moves the object.
Parameters

Parameter Type Description


relativeObject Object Object to move element within
insertionLocation ElementPlacement, optional Location to move element to

Returns
PlacedItem

[Link]()

[Link][index].relink(linkFile)
Description
Relinks the art object with the file that defines its content.
Parameters

Parameter Type Description


linkFile File object File to relink

Returns
Nothing.

544 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

[Link]()

[Link][index].remove()
Description
Deletes this object.
Returns
Nothing.

[Link]()

[Link][index].resize(scaleX, scaleY[,changePositions][,
changeFillPatterns][,changeFillGradients][,changeStrokePattern][,changeLineWidths][,
scaleAbout])
Description
Scales the art item where scaleX is the horizontal scaling factor and scaleY is the vertical scaling factor. 100.0 =
100%.
Parameters

Parameter Type Description


scaleX Number (double) Horizontal scaling factor
scaleY Number (double) Vertical scaling factor
changePositions Boolean, optional Whether to effect art object positions and orientations
changeFillPatterns Boolean, optional Whether to transform fill patterns
changeFillGradients Boolean, optional Whether to transform fill gradients
changeStrokePattern Boolean, optional Whether to transform stroke patterns
changeLineWidths Number (double), optional The amount to scale line widths
scaleAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

[Link]()

[Link][index].rotate(angle[,changePositions][,
changeFillPatterns][,changeFillGradients][,changeStrokePattern][,rotateAbout])
Description
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.
Parameters

104.2. PlacedItem 545


Illustrator Scripting Guide, Release 0.0.1

Parameter Type Description


angle Number (double) The angle amount to rotate the element
changePositions Boolean, optional Whether to effect art object positions and orientations
changeFillPatterns Boolean, optional Whether to transform fill patterns
changeFillGradients Boolean, optional Whether to transform fill gradients
changeStrokePattern Boolean, optional Whether to transform stroke patterns
rotateAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

[Link]

[Link][index].trace()
Description
Converts the raster art for this object to vector art, using default options.
Reorders the raster art into the source art of a plug-in group, and converts it into a group of filled and/or stroked paths
that resemble the original image.
Creates and returns a PluginItem object that references a TracingObject object.
Returns
PluginItem

[Link]()

[Link][index].transform(transformationMatrix[, changePositions][,
changeFillPatterns][, changeFillGradients][, changeStrokePattern][, changeLineWidths][,
transformAbout])
Description
Transforms the art item by applying a transformation matrix.
Parameters

Parameter Type Description


transformationMatrix Matrix Transformation matrix to apply
changePositions Boolean, optional Whether to change Positions
changeFillPatterns Boolean, optional Whether to change Fill Patterns
changeFillGradients Boolean, optional Whether to change Fill Gradients
changeStrokePattern Boolean, optional Whether to change Stroke Pattern
changeLineWidths Number (double), optional The amount to scale line widths
transformAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

546 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

[Link]()

[Link][index].translate([deltaX][, deltaY][, transformObjects][,


transformFillPatterns][, transformFillGradients][, transformStrokePatterns])
Description
Repositions the art item relative to the current position, where deltaX is the horizontal offset and deltaY is the vertical
offset.
Parameters

Parameter Type Description


deltaX Number (double), optional Horizontal offset
deltaY Number (double), optional Vertical offset
transformObjects Boolean, optional Whether to transform Objects
transformFillPatterns Boolean, optional Whether to transform Fill Patterns
transformFillGradients Boolean, optional Whether to transform Fill Gradients
transformStrokePatterns Boolean, optional Whether to transform Stroke Patterns

Returns
Nothing.

[Link]()

[Link][index].zOrder(zOrderCmd)
Description
Arranges the art item’s position in the stacking order of the group or layer (parent) of this object.
Parameters

Parameter Type Description


zOrderCmd ZOrderMethod Stacking order arrangement method

Returns
Nothing.

104.2. PlacedItem 547


Illustrator Scripting Guide, Release 0.0.1

104.2.3 Example

Changing the selection state of placed items

// Toggles the selection state of all placed items.


if ([Link] > 0) {
for (i = 0; i < [Link]; i++) {
var placedArt = [Link][i];
[Link] = !([Link]);
}
}

104.3 PluginItem

[Link][index
Description
An art item created by an Illustrator plug-in.
Scripts can create a plug-in item using [Link] or [Link](), and can copy existing plug-in items
using the duplicate method, but cannot create PluginItem objects directly.

104.3.1 Properties

[Link]

[Link][index].artworkKnockout
Description
Is this object used to create a knockout, and if so, what kind of knockout.
Type
KnockoutState

[Link]

[Link][index].blendingMode
Description
The blend mode used when compositing an object.
Type
BlendModes

548 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].controlBounds
Description
The bounds of the object including stroke width and controls.
Type
Array of 4 numbers; read-only.

[Link]

[Link][index].editable
Description
If true, this item is editable.
Type
Boolean; read-only.

[Link]

[Link][index].geometricBounds
Description
The bounds of the object excluding stroke width.
Type
Array of 4 numbers; read-only.

[Link]

[Link][index].height
Description
The height of the group item.
Type
Number (double)

104.3. PluginItem 549


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].hidden
Description
If true, this item is hidden.
Type
Boolean

[Link]

[Link][index].isIsolated
Description
If true, this object is isolated.
Type
Boolean

[Link]

[Link][index].isTracing
Description
If true, this plug-in group represents a vector art item created by tracing a raster art item.
The tracing property contains the tracing object associated with the options used to create it.
Type
Boolean

[Link]

[Link][index].layer
Description
The layer to which this item belongs.
Type
Layer; read-only.

550 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].left
Description
The position of the left side of the item (in points, measured from the left side of the page).
Type
Number (double)

[Link]

[Link][index].locked
Description
If true, this item is locked.
Type
Boolean

[Link]

[Link][index].name
Description
The name of this item.
Type
String

[Link]

[Link][index].note
Description
The note assigned to this item.
Type
String

104.3. PluginItem 551


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].opacity
Description
The opacity of the object. Range: 0.0 to 100.0
Type
Number (double)

[Link]

[Link][index].parent
Description
The parent of this object.
Type
Layer or GroupItem

[Link]

[Link][index].position
Description
The position (in points) of the top left corner of the pluginItem object in the format [x, y]. Does not include stroke
weight.
Type
Array of 2 numbers; read-only.

[Link]

[Link][index].selected
Description
If true, this item is selected.
Type
Boolean

552 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].sliced
Description
If true, the item sliced.
Default: false
Type
Boolean

[Link]

[Link][index].tags
Description
The tags contained in this item.
Type
Tags; read-only.

[Link]

[Link][index].top
Description
The position of the top of the item (in points, measured from the bottom of the page).
Type
Number (double)

[Link]

[Link][index].tracing
Description
When this plug-in group was created by tracing (isTracing is true), the tracing object associated with the options
used to create it.
Type
TracingObject

104.3. PluginItem 553


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].typename
Description
The class name of the referenced object.
Type
String; read-only.

[Link]

[Link][index].uRL
Description
The value of the Adobe URL tag assigned to this item.
Type
String

[Link]

[Link][index].visibilityVariable
Description
The visibility variable bound to the item.
Type
Variable

[Link]

[Link][index].visibleBounds
Description
The visible bounds of the item including stroke width.
Type
Array of 4 numbers; read-only.

554 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].width
Description
The width of the item.
Type
Number (double)

[Link]

[Link][index].wrapInside
Description
If true, the text frame object should be wrapped inside this object.
Type
Boolean

[Link]

[Link][index].wrapOffset
Description
The offset to use when wrapping text around this object.
Type
Number (double)

[Link]

[Link][index].wrapped
Description
If true, wrap text frame objects around this object (text frame must be above the object).
Type
Boolean

104.3. PluginItem 555


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].zOrderPosition
Description
The position of this item within the stacking order of the group or layer (parent) that contains the item.
Type
Number; read-only.

104.3.2 Methods

[Link]()

[Link][index].duplicate([relativeObject][, insertionLocation])
Description
Creates a duplicate of the selected object.
Parameters

Parameter Type Description


relativeObject Object, optional Object to duplicate to
insertionLocation ElementPlacement, optional Location to insert element

Returns
PluginItem

[Link]()

[Link][index].move(relativeObject, insertionLocation)
Description
Moves the object.
Parameters

Parameter Type Description


relativeObject Object Object to move element within
insertionLocation ElementPlacement, optional Location to move element to

Returns
PluginItem

556 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

[Link]()

[Link][index].remove()
Description
Deletes this object.
Returns
Nothing.

[Link]()

[Link][index].resize(scaleX, scaleY[,changePositions][,
changeFillPatterns][,changeFillGradients][,changeStrokePattern][,changeLineWidths][,
scaleAbout])
Description
Scales the art item where scaleX is the horizontal scaling factor and scaleY is the vertical scaling factor. 100.0 =
100%.
Parameters

Parameter Type Description


scaleX Number (double) Horizontal scaling factor
scaleY Number (double) Vertical scaling factor
changePositions Boolean, optional Whether to effect art object positions and orientations
changeFillPatterns Boolean, optional Whether to transform fill patterns
changeFillGradients Boolean, optional Whether to transform fill gradients
changeStrokePattern Boolean, optional Whether to transform stroke patterns
changeLineWidths Number (double), optional The amount to scale line widths
scaleAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

[Link]()

[Link][index].rotate(angle[,changePositions][,
changeFillPatterns][,changeFillGradients][,changeStrokePattern][,rotateAbout])
Description
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.
Parameters

104.3. PluginItem 557


Illustrator Scripting Guide, Release 0.0.1

Parameter Type Description


angle Number (double) The angle amount to rotate the element
changePositions Boolean, optional Whether to effect art object positions and orientations
changeFillPatterns Boolean, optional Whether to transform fill patterns
changeFillGradients Boolean, optional Whether to transform fill gradients
changeStrokePattern Boolean, optional Whether to transform stroke patterns
rotateAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

[Link]()

[Link][index].transform(transformationMatrix[, changePositions][,
changeFillPatterns][, changeFillGradients][, changeStrokePattern][, changeLineWidths][,
transformAbout])
Description
Transforms the art item by applying a transformation matrix.
Parameters

Parameter Type Description


transformationMatrix Matrix Transformation matrix to apply
changePositions Boolean, optional Whether to change Positions
changeFillPatterns Boolean, optional Whether to change Fill Patterns
changeFillGradients Boolean, optional Whether to change Fill Gradients
changeStrokePattern Boolean, optional Whether to change Stroke Pattern
changeLineWidths Number (double), optional The amount to scale line widths
transformAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

[Link]()

[Link][index].translate([deltaX][, deltaY][, transformObjects][,


transformFillPatterns][, transformFillGradients][, transformStrokePatterns])
Description
Repositions the art item relative to the current position, where deltaX is the horizontal offset and deltaY is the vertical
offset.
Parameters

558 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

Parameter Type Description


deltaX Number (double), optional Horizontal offset
deltaY Number (double), optional Vertical offset
transformObjects Boolean, optional Whether to transform Objects
transformFillPatterns Boolean, optional Whether to transform Fill Patterns
transformFillGradients Boolean, optional Whether to transform Fill Gradients
transformStrokePatterns Boolean, optional Whether to transform Stroke Patterns

Returns
Nothing.

[Link]()

[Link][index].zOrder(zOrderCmd)
Description
Arranges the art item’s position in the stacking order of the group or layer (parent) of this object.
Parameters

Parameter Type Description


zOrderCmd ZOrderMethod Stacking order arrangement method

Returns
Nothing.

104.3.3 Example

Copying a plug-in item

// Creates new plug-in art by copying an existing plug-in art item


if ([Link] > 0 && [Link] > 0) {
var doc = [Link];
var pluginArt = [Link][0];
[Link]([Link], [Link]);
}

104.3. PluginItem 559


Illustrator Scripting Guide, Release 0.0.1

104.4 RasterItem

[Link][index
Description
A bitmap art item in a document. A script can create a raster item from an external file, or by copying an existing raster
item with the duplicate method.

104.4.1 Properties

[Link]

[Link][index].artworkKnockout
Description
Is this object used to create a knockout, and if so, what kind of knockout.
Type
KnockoutState

[Link]

[Link][index].bitsPerChannel
Description
The number of bits per channel.
Type
Number (long); read-only.

[Link]

[Link][index].blendingMode
Description
The blend mode used when compositing an object.
Type
BlendModes

560 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].boundingBox
Description
The dimensions of the placed art item regardless of transformations.
Type
Array of 4 numbers

[Link]

[Link][index].channels
Description
The number of channels.
Type
Number (long); read-only.

[Link]

[Link][index].colorants
Description
The colorants used in the raster art.
Type
Array of string; read-only.

[Link]

[Link][index].colorizedGrayscale
Description
If true, the raster art is a colorized grayscale image.
Type
Boolean; read-only.

104.4. RasterItem 561


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].contentVariable
Description
The content variable bound to the item.
Type
Variable

[Link]

[Link][index].controlBounds
Description
The bounds of the object including stroke width and controls.
Type
Array of 4 numbers; read-only.

[Link]

[Link][index].editable
Description
If true, this item is editable.
Type
Boolean; read-only.

[Link]

[Link][index].embedded
Description
If true, the raster art item is embedded in the illustration.
Type
Boolean

562 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].file
Description
The file containing the artwork.
Type
File; read-only.

[Link]

[Link][index].geometricBounds
Description
The bounds of the object excluding stroke width.
Type
Array of 4 numbers; read-only.

[Link]

[Link][index].height
Description
The height of the group item.
Type
Number (double)

[Link]

[Link][index].hidden
Description
If true, this item is hidden.
Type
Boolean

104.4. RasterItem 563


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].imageColorSpace
Description
The color space of the raster image.
Type
ImageColorSpace; read-only.

[Link]

[Link][index].isIsolated
Description
If true, this object is isolated.
Type
Boolean

[Link]

[Link][index].layer
Description
The layer to which this item belongs.
Type
Layer; read-only.

[Link]

[Link][index].left
Description
The position of the left side of the item (in points, measured from the left side of the page).
Type
Number (double)

564 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].locked
Description
If true, this item is locked.
Type
Boolean

[Link]

[Link][index].matrix
Description
The transformation matrix of the placed artwork.
Type
Matrix

[Link]

[Link][index].name
Description
The name of this item.
Type
String

[Link]

[Link][index].note
Description
The note assigned to this item.
Type
String

104.4. RasterItem 565


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].opacity
Description
The opacity of the object. Range: 0.0 to 100.0
Type
Number (double)

[Link]

[Link][index].overprint
Description
If true, the raster art overprints.
Type
Boolean

[Link]

[Link][index].parent
Description
The parent of this object.
Type
Layer or GroupItem

[Link]

[Link][index].position
Description
The position (in points) of the top left corner of the rasterItem object in the format [x, y]. Does not include stroke
weight.
Type
Array of 2 numbers; read-only.

566 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].selected
Description
If true, this item is selected.
Type
Boolean

[Link]

[Link][index].sliced
Description
If true, the item sliced.
Default: false
Type
Boolean

[Link]

[Link][index].status
Description
Status of the linked image.
Type
RasterLinkState

[Link]

[Link][index].tags
Description
The tags contained in this item.
Type
Tags; read-only.

104.4. RasterItem 567


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].top
Description
The position of the top of the item (in points, measured from the bottom of the page).
Type
Number (double)

[Link]

[Link][index].transparent
Description
If true, the raster art is transparent.
Type
Boolean; read-only.

[Link]

[Link][index].typename
Description
The class name of the referenced object.
Type
String; read-only.

[Link]

[Link][index].uRL
Description
The value of the Adobe URL tag assigned to this item.
Type
String

568 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].visibilityVariable
Description
The visibility variable bound to the item.
Type
Variable

[Link]

[Link][index].visibleBounds
Description
The visible bounds of the item including stroke width.
Type
Array of 4 numbers; read-only.

[Link]

[Link][index].width
Description
The width of the item.
Type
Number (double)

[Link]

[Link][index].wrapInside
Description
If true, the text frame object should be wrapped inside this object.
Type
Boolean

104.4. RasterItem 569


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].wrapOffset
Description
The offset to use when wrapping text around this object.
Type
Number (double)

[Link]

[Link][index].wrapped
Description
If true, wrap text frame objects around this object (text frame must be above the object).
Type
Boolean

[Link]

[Link][index].zOrderPosition
Description
The position of this item within the stacking order of the group or layer (parent) that contains the item.
Type
Number; read-only.

104.4.2 Methods

[Link]()

[Link][index].colorize(rasterizeColor)
Description
Colorizes the raster item with a CMYK or RGB Color.
Parameters

Parameter Type Description


rasterizeColor Color CMYK or RGB Color to rasterize with

Returns
Nothing.

570 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

[Link]()

[Link][index].duplicate([relativeObject][, insertionLocation])
Description
Creates a duplicate of the selected object.
Parameters

Parameter Type Description


relativeObject Object, optional Object to duplicate to
insertionLocation ElementPlacement, optional Location to insert element

Returns
RasterItem

[Link]()

[Link][index].move(relativeObject, insertionLocation)
Description
Moves the object.
Parameters

Parameter Type Description


relativeObject Object Object to move element within
insertionLocation ElementPlacement, optional Location to move element to

Returns
RasterItem

[Link]()

[Link][index].remove()
Description
Deletes this object.
Returns
Nothing.

104.4. RasterItem 571


Illustrator Scripting Guide, Release 0.0.1

[Link]()

[Link][index].resize(scaleX, scaleY[,changePositions][,
changeFillPatterns][,changeFillGradients][,changeStrokePattern][,changeLineWidths][,
scaleAbout])
Description
Scales the art item where scaleX is the horizontal scaling factor and scaleY is the vertical scaling factor. 100.0 =
100%.
Parameters

Parameter Type Description


scaleX Number (double) Horizontal scaling factor
scaleY Number (double) Vertical scaling factor
changePositions Boolean, optional Whether to effect art object positions and orientations
changeFillPatterns Boolean, optional Whether to transform fill patterns
changeFillGradients Boolean, optional Whether to transform fill gradients
changeStrokePattern Boolean, optional Whether to transform stroke patterns
changeLineWidths Number (double), optional The amount to scale line widths
scaleAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

[Link]()

[Link][index].rotate(angle[,changePositions][,
changeFillPatterns][,changeFillGradients][,changeStrokePattern][,rotateAbout])
Description
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.
Parameters

Parameter Type Description


angle Number (double) The angle amount to rotate the element
changePositions Boolean, optional Whether to effect art object positions and orientations
changeFillPatterns Boolean, optional Whether to transform fill patterns
changeFillGradients Boolean, optional Whether to transform fill gradients
changeStrokePattern Boolean, optional Whether to transform stroke patterns
rotateAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

572 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

[Link]()

[Link][index].trace()
Description
Converts the raster art for this object to vector art, using default options.
Reorders the raster art into the source art of a plug-in group, and converts it into a group of filled and/or stroked paths
that resemble the original image.
Creates and returns a PluginItem object that references a TracingObject object.
Returns
PluginItem

[Link]()

[Link][index].transform(transformationMatrix[, changePositions][,
changeFillPatterns][, changeFillGradients][, changeStrokePattern][, changeLineWidths][,
transformAbout])
Description
Transforms the art item by applying a transformation matrix.
Parameters

Parameter Type Description


transformationMatrix Matrix Transformation matrix to apply
changePositions Boolean, optional Whether to change Positions
changeFillPatterns Boolean, optional Whether to change Fill Patterns
changeFillGradients Boolean, optional Whether to change Fill Gradients
changeStrokePattern Boolean, optional Whether to change Stroke Pattern
changeLineWidths Number (double), optional The amount to scale line widths
transformAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

[Link]()

[Link][index].translate([deltaX][, deltaY][, transformObjects][,


transformFillPatterns][, transformFillGradients][, transformStrokePatterns])
Description
Repositions the art item relative to the current position, where deltaX is the horizontal offset and deltaY is the vertical
offset.
Parameters

104.4. RasterItem 573


Illustrator Scripting Guide, Release 0.0.1

Parameter Type Description


deltaX Number (double), optional Horizontal offset
deltaY Number (double), optional Vertical offset
transformObjects Boolean, optional Whether to transform Objects
transformFillPatterns Boolean, optional Whether to transform Fill Patterns
transformFillGradients Boolean, optional Whether to transform Fill Gradients
transformStrokePatterns Boolean, optional Whether to transform Stroke Patterns

Returns
Nothing.

[Link]()

[Link][index].zOrder(zOrderCmd)
Description
Arranges the art item’s position in the stacking order of the group or layer (parent) of this object.
Parameters

Parameter Type Description


zOrderCmd ZOrderMethod Stacking order arrangement method

Returns
Nothing.

104.5 SymbolItem

[Link][index
Description
An art item made reusable by adding it to the Symbols palette.
A SymbolItem is linked to the Symbol from which it was created and changes if you modify the associated Symbol
object.

104.5.1 Properties

[Link]

[Link][index].artworkKnockout
Description
Is this object used to create a knockout, and if so, what kind of knockout.
Type

574 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

KnockoutState

[Link]

[Link][index].blendingMode
Description
The blend mode used when compositing an object.
Type
BlendModes

[Link]

[Link][index].controlBounds
Description
The bounds of the object including stroke width and controls.
Type
Array of 4 Numbers; read-only.

[Link]

[Link][index].editable
Description
If true, this item is editable.
Type
Boolean; read-only.

[Link]

[Link][index].geometricBounds
Description
The bounds of the object excluding stroke width.
Type
Array of 4 Numbers; read-only.

104.5. SymbolItem 575


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].height
Description
The height of the group item.
Type
Number (double)

[Link]

[Link][index].hidden
Description
If true, this item is hidden.
Type
Boolean

[Link]

[Link][index].isIsolated
Description
If true, this object is isolated.
Type
Boolean

[Link]

[Link][index].layer
Description
The layer to which this item belongs.
Type
Layer; read-only.

576 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].left
Description
The position of the left side of the item (in points, measured from the left side of the page).
Type
Number (double)

[Link]

[Link][index].locked
Description
If true, this item is locked.
Type
Boolean

[Link]

[Link][index].name
Description
The name of this item.
Type
String

[Link]

[Link][index].note
Description
The note assigned to this item.
Type
String

104.5. SymbolItem 577


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].opacity
Description
The opacity of the object. Range: 0.0 to 100.0
Type
Number (double)

[Link]

[Link][index].parent
Description
The parent of this object.
Type
Layer or GroupItem; read-only.

[Link]

[Link][index].position
Description
The position (in points) of the top left corner of the symbolItem object in the format [x, y]. Does not include stroke
weight.
Type
Array of 2 Numbers

[Link]

[Link][index].selected
Description
If true, this item is selected.
Type
Boolean

578 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].sliced
Description
If true, the item sliced. Default: false
Type
Boolean

[Link]

[Link][index].symbol
Description
The symbol that was used to create this symbolItem.
Type
Symbol

[Link]

[Link][index].tags
Description
The tags contained in this item.
Type
Tags; read-only.

[Link]

[Link][index].top
Description
The position of the top of the item (in points, measured from the bottom of the page).
Type
Number (double)

104.5. SymbolItem 579


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].typename
Description
The class name of the referenced object.
Type
String; read-only.

[Link]

[Link][index].uRL
Description
The value of the Adobe URL tag assigned to this item.
Type
String

[Link]

[Link][index].visibilityVariable
Description
The visibility variable bound to the item.
Type
Variable

[Link]

[Link][index].visibleBounds
Description
The visible bounds of the item including stroke width.
Type
Array of 4 Numbers; read-only.

580 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].width
Description
The width of the item.
Type
Number (double)

[Link]

[Link][index].wrapInside
Description
If true, the text frame object should be wrapped inside this object.
Type
Boolean

[Link]

[Link][index].wrapOffset
Description
The offset to use when wrapping text around this object.
Type
Number (double)

[Link]

[Link][index].wrapped
Description
If true, wrap text frame objects around this object (text frame must be above the object).
Type
Boolean

104.5. SymbolItem 581


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].zOrderPosition
Description
The position of this item within the stacking order of the group or layer (parent) that contains the item.
Type
Number; read-only.

104.5.2 Methods

[Link]()

[Link][index].duplicate([relativeObject][, insertionLocation])
Description
Creates a duplicate of the selected object.
Parameters

Parameter Type Description


relativeObject Object, optional Object to duplicate to
insertionLocation ElementPlacement, optional Location to insert element

Returns
SymbolItem

[Link]()

[Link][index].move(relativeObject, insertionLocation)
Description
Moves the object.
Parameters

Parameter Type Description


relativeObject Object Object to move element within
insertionLocation ElementPlacement, optional Location to move element to

Returns
SymbolItem

582 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

[Link]()

[Link][index].remove()
Description
Deletes this object.
Returns
Nothing.

[Link]()

[Link][index].resize(scaleX, scaleY[,changePositions][,
changeFillPatterns][,changeFillGradients][,changeStrokePattern][,changeLineWidths][,
scaleAbout])
Description
Scales the art item where scaleX is the horizontal scaling factor and scaleY is the vertical scaling factor. 100.0 =
100%.
Parameters

Parameter Type Description


scaleX Number (double) Horizontal scaling factor
scaleY Number (double) Vertical scaling factor
changePositions Boolean, optional Whether to effect art object positions and orientations
changeFillPatterns Boolean, optional Whether to transform fill patterns
changeFillGradients Boolean, optional Whether to transform fill gradients
changeStrokePattern Boolean, optional Whether to transform stroke patterns
changeLineWidths Number (double), optional The amount to scale line widths
scaleAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

[Link]()

[Link][index].rotate(angle[,changePositions][,
changeFillPatterns][,changeFillGradients][,changeStrokePattern][,rotateAbout])
Description
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.
Parameters

104.5. SymbolItem 583


Illustrator Scripting Guide, Release 0.0.1

Parameter Type Description


angle Number (double) The angle amount to rotate the element
changePositions Boolean, optional Whether to effect art object positions and orientations
changeFillPatterns Boolean, optional Whether to transform fill patterns
changeFillGradients Boolean, optional Whether to transform fill gradients
changeStrokePattern Boolean, optional Whether to transform stroke patterns
rotateAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

[Link]()

[Link][index].transform(transformationMatrix[, changePositions][,
changeFillPatterns][, changeFillGradients][, changeStrokePattern][, changeLineWidths][,
transformAbout])
Description
Transforms the art item by applying a transformation matrix.
Parameters

Parameter Type Description


transformationMatrix Matrix Transformation matrix to apply
changePositions Boolean, optional Whether to change Positions
changeFillPatterns Boolean, optional Whether to change Fill Patterns
changeFillGradients Boolean, optional Whether to change Fill Gradients
changeStrokePattern Boolean, optional Whether to change Stroke Pattern
changeLineWidths Number (double), optional The amount to scale line widths
transformAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

[Link]()

[Link][index].translate([deltaX][, deltaY][, transformObjects][,


transformFillPatterns][, transformFillGradients][, transformStrokePatterns])
Description
Repositions the art item relative to the current position, where deltaX is the horizontal offset and deltaY is the vertical
offset.
Parameters

584 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

Parameter Type Description


deltaX Number (double), optional Horizontal offset
deltaY Number (double), optional Vertical offset
transformObjects Boolean, optional Whether to transform Objects
transformFillPatterns Boolean, optional Whether to transform Fill Patterns
transformFillGradients Boolean, optional Whether to transform Fill Gradients
transformStrokePatterns Boolean, optional Whether to transform Stroke Patterns

Returns
Nothing.

[Link]()

[Link][index].zOrder(zOrderCmd)
Description
Arranges the art item’s position in the stacking order of the group or layer (parent) of this object.
Parameters

Parameter Type Description


zOrderCmd ZOrderMethod Stacking order arrangement method

Returns
Nothing.

104.6 TextFrameItem

[Link][index
Description
The basic art item for displaying text. From the user interface, this is text created with the Text tool. There are three
types of text art in Illustrator: point text, path text, and area text. The type is indicated by the text frame’s kind property.
When you create a text frame, you also create a Story object. However, threading text frames combines the frames into
a single story object. To thread frames, use the nextFrame or previousFrame property.

104.6. TextFrameItem 585


Illustrator Scripting Guide, Release 0.0.1

104.6.1 Properties

[Link]

[Link][index].anchor
Description
The position of the anchor point, the start of the base line for point text.
Type
Array of 2 numbers

[Link]

[Link][index].antialias
Description
The type of anti-aliasing to use in the text.
Type
TextAntialias

[Link]

[Link][index].characters
Description
All the characters in this text frame.
Type
Characters, read-only.

[Link]

[Link][index].columnCount
Description
The column count in the text frame (area text only).
Type
Number (long)

586 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].columnGutter
Description
The column gutter in the text frame (area text only).
Type
Number (double)

[Link]

[Link][index].contents
Description
The text string.
Type
String

[Link]

[Link][index].contentVariable
Description
The content variable bound to this text frame item.
Type
Variable

[Link]

[Link][index].endTValue
Description
The end position of text along a path, as a value relative to the path’s segments (path text only).
Type
Number (double)

104.6. TextFrameItem 587


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].flowLinksHorizontally
Description
If true, flow text between linked frames horizontally first (area text only).
Type
Boolean

[Link]

[Link][index].insertionPoints
Description
All the insertion points in this text range.
Type
InsertionPoints, read-only.

[Link]

[Link][index].kind
Description
The type of a text frame item (area, path or point).
Type
TextType, read-only.

[Link]

[Link][index].lines
Description
All the lines in this text frame.
Type
Lines, read-only.

588 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].matrix
Description
The transformation matrix for this text frame.
Type
Matrix, read-only.

[Link]

[Link][index].nextFrame
Description
The linked text frame following this one.
Type
TextFrameItem

[Link]

[Link][index].opticalAlignment
Description
If true, the optical alignment feature is active.
Type
Boolean

[Link]

[Link][index].orientation
Description
The orientation of the text.
Type
TextOrientation

104.6. TextFrameItem 589


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].paragraphs
Description
All the paragraphs in this text frame.
Type
Paragraphs, read-only.

[Link]

[Link][index].parent
Description
The parent of this object.
Type
Layer or GroupItem, read-only.

[Link]

[Link][index].previousFrame
Description
The linked text frame preceding this one.
Type
TextFrameItem

[Link]

[Link][index].rowCount
Description
The row count in the text frame (area text only).
Type
Number (long)

590 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].rowGutter
Description
The row gutter in the text frame (area text only).
Type
Number (double)

[Link]

[Link][index].spacing
Description
The amount of spacing.
Type
Number (double)

[Link]

[Link][index].startTValue
Description
The start position of text along a path, as a value relative to the path’s segments (path text only).
Type
Number (double)

[Link]

[Link][index].story
Description
The story to which the text frame belongs.
Type
Story, read-only.

104.6. TextFrameItem 591


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].textPath
Description
The path item associated with the text frame. Note: Valid only when kind is area or path.
Type
TextPath

[Link]

[Link][index].textRange
Description
The text range of the text frame.
Type
TextRange, read-only.

[Link]

[Link][index].textRanges
Description
All the text in this text frame.
Type
TextRanges, read-only.

[Link]

[Link][index].textSelection
Description
The selected text range(s) in the text frame.
Type
Array of TextRange, read-only.

592 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

[Link]

[Link][index].typename
Description
The class name of the referenced object.
Type
String, read-only.

[Link]

[Link][index].words
Description
All the words in this text frame.
Type
Words, read-only.

104.6.2 Methods

[Link]()

[Link][index].convertAreaObjectToPointObject()
Description
Converts the area-type text frame to a point-type text frame.
Returns
TextFrameItem

[Link]()

[Link][index].convertPointObjectToAreaObject()
Description
Converts the point-type text frame to an area-type text frame.
Returns
TextFrameItem

104.6. TextFrameItem 593


Illustrator Scripting Guide, Release 0.0.1

[Link]()

[Link][index].createOutline()
Description
Converts the text in the text frame to outlines.
Returns
GroupItem

[Link]()

[Link][index].duplicate([relativeObject] [,insertionLocation])
Description
Creates a duplicate of the selected object.
Parameters

Parameter Type Description


relativeObject Object, optional Object to duplicate to
insertionLocation ElementPlacement, optional Location to insert element

Returns
TextRange

[Link]()

[Link][index].move(relativeObject, insertionLocation)
Description
Moves the object.
Parameters

Parameter Type Description


relativeObject Object Object to move element within
insertionLocation ElementPlacement, optional Location to move element to

Returns
TextRange

594 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

[Link]()

[Link][index].remove()
Description
Deletes this object.
Returns
Nothing.

[Link]()

[Link][index].resize(scaleX, scaleY[,changePositions][,
changeFillPatterns][,changeFillGradients][,changeStrokePattern][,changeLineWidths][,
scaleAbout])
Description
Scales the art item where scaleX is the horizontal scaling factor and scaleY is the vertical scaling factor. 100.0 =
100%.
Parameters

Parameter Type Description


scaleX Number (double) Horizontal scaling factor
scaleY Number (double) Vertical scaling factor
changePositions Boolean, optional Whether to effect art object positions and orientations
changeFillPatterns Boolean, optional Whether to transform fill patterns
changeFillGradients Boolean, optional Whether to transform fill gradients
changeStrokePattern Boolean, optional Whether to transform stroke patterns
changeLineWidths Number (double), optional The amount to scale line widths
scaleAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

[Link]()

[Link][index].rotate(angle[,changePositions][,
changeFillPatterns][,changeFillGradients][,changeStrokePattern][,rotateAbout])
Description
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.
Parameters

104.6. TextFrameItem 595


Illustrator Scripting Guide, Release 0.0.1

Parameter Type Description


angle Number (double) The angle amount to rotate the element
changePositions Boolean, optional Whether to effect art object positions and orientations
changeFillPatterns Boolean, optional Whether to transform fill patterns
changeFillGradients Boolean, optional Whether to transform fill gradients
changeStrokePattern Boolean, optional Whether to transform stroke patterns
rotateAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

[Link]()

[Link][index].transform(transformationMatrix[, changePositions][,
changeFillPatterns][, changeFillGradients][, changeStrokePattern][, changeLineWidths][,
transformAbout])
Description
Transforms the art item by applying a transformation matrix.
Parameters

Parameter Type Description


transformationMatrix Matrix Transformation matrix to apply
changePositions Boolean, optional Whether to change Positions
changeFillPatterns Boolean, optional Whether to change Fill Patterns
changeFillGradients Boolean, optional Whether to change Fill Gradients
changeStrokePattern Boolean, optional Whether to change Stroke Pattern
changeLineWidths Number (double), optional The amount to scale line widths
transformAbout Transformation, optional The point to use as anchor, to transform about

Returns
Nothing.

[Link]()

[Link][index].translate([deltaX][, deltaY][, transformObjects][,


transformFillPatterns][, transformFillGradients][, transformStrokePatterns])
Description
Repositions the art item relative to the current position, where deltaX is the horizontal offset and deltaY is the vertical
offset.
Parameters

596 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

Parameter Type Description


deltaX Number (double), optional Horizontal offset
deltaY Number (double), optional Vertical offset
transformObjects Boolean, optional Whether to transform Objects
transformFillPatterns Boolean, optional Whether to transform Fill Patterns
transformFillGradients Boolean, optional Whether to transform Fill Gradients
transformStrokePatterns Boolean, optional Whether to transform Stroke Patterns

Returns
Nothing.

[Link]()

[Link][index].zOrder(zOrderCmd)
Description
Arranges the art item’s position in the stacking order of the group or layer (parent) of this object.
Parameters

Parameter Type Description


zOrderCmd ZOrderMethod Stacking order arrangement method

Returns
Nothing.

104.6.3 Example

Rotate a text art item

// Duplicates and rotates the selected text art item 5 times


if ( [Link] > 0 ) {
selectedItems = [Link];

// make sure something is selected.


if ( [Link] > 0 ) {

// The selection must be a text art item


if ( selectedItems[0].typename == "TextFrame" ) {

// Get the parent of the text art so new text art items
// can be inserted in the same group or layer
dupSrc = selectedItems[0];
textContainer = [Link];

(continues on next page)

104.6. TextFrameItem 597


Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)


// Create 5 new versions of the text art each rotated a bit
for ( i = 1; i <= 5; i++ ) {
dupText = [Link]( textContainer, [Link] );
[Link](180 * i/6);
}
}
}
}

You can reference page items through the PageItems property in a Document, Layer, or GroupItem.
When you access an individual item in one of these collections, the reference is a page item of one of a particular type.
For example, if you use PageItems to reference a graph item, the typename value of that object is GraphItem.

104.7 Properties

104.7.1 [Link]

[Link]
Description
The number of objects in the collection.
Type
Number, read-only.

104.7.2 [Link]

[Link]
Description
The parent of this object.
Type
Object, read-only.

104.7.3 [Link]

[Link]
Description
The class name of the referenced object.
Type
String, read-only.

598 Chapter 104. PageItems


Illustrator Scripting Guide, Release 0.0.1

104.8 Methods

104.8.1 [Link]()

[Link](name)
Description
Gets the first element in the collection with the specified name.
Parameters

Parameter Type Description


name String Name of element to get

Returns
PageItem

104.8.2 [Link]()

[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number String or number key

Returns
PageItem

104.8.3 [Link]()

[Link]()
Description
Deletes all elements in this collection.
Returns
Nothing.

104.8. Methods 599


Illustrator Scripting Guide, Release 0.0.1

104.9 Example

104.9.1 Getting references to external files in page items

// Gets all file-references in the current document using the pageItems object,
// then displays them in a new document

if ([Link] > 0) {
var fileReferences = new Array();
var sourceDoc = [Link];

for (var i = 0; i < [Link]; i++) {


var artItem = [Link][i];
switch ([Link]) {
case "PlacedItem":
[Link]([Link]);
break;
case "RasterItem":
if (![Link]) {
[Link]([Link]);
}
break;
}
}

// Write the file references to a new document


var reportDoc = [Link]();
var areaTextPath = [Link]([Link], 0, [Link],␣
˓→[Link]);

var fileNameText = [Link](areaTextPath);


[Link] = 24;
var paragraphCount = 3;
var sourceName = [Link];
var text = "File references in \'" + sourceName + "\':\r\r";
for (i = 0; i < [Link]; i++) {
text += (fileReferences[i] + "\r");
paragraphCount++;
}
[Link] = text;
}

600 Chapter 104. PageItems


CHAPTER

FIVE

PAPER

[Link]
Description
Associates paper information with a paper name. Paper objects are used by Printer objects.

105.1 Properties

105.1.1 [Link]

[Link]
Description
The paper name.
Type
String.

105.1.2 [Link]

[Link]
Description
The paper information.
Type
PaperInfo

601
Illustrator Scripting Guide, Release 0.0.1

105.1.3 [Link]

[Link]
Description
The class name of the object.
Type
String, read-only.

602 Chapter 105. Paper


CHAPTER

SIX

PAPERINFO

printerList[printerIndex].[Link][paperSizeIndex].paperInfo
Description
Paper information for use in printing documents.

106.1 Properties

106.1.1 [Link]

printerList[printerIndex].[Link][paperSizeIndex].[Link]
Description
If true, it is a custom paper.
Type
Boolean.

106.1.2 [Link]

printerList[printerIndex].[Link][paperSizeIndex].[Link]
Description
The paper’s height in points.
Type
Number (double).

603
Illustrator Scripting Guide, Release 0.0.1

106.1.3 [Link]

printerList[printerIndex].[Link][paperSizeIndex].[Link]
Description
The imageable area.
Type
Array of 4 numbers.

106.1.4 [Link]

printerList[printerIndex].[Link][paperSizeIndex].[Link]
Description
The class name of the object.
Type
String, read-only.

106.1.5 [Link]

printerList[printerIndex].[Link][paperSizeIndex].[Link]
Description
The paper’s width in points.
Type
Number (double).

106.2 Example

106.2.1 Finding paper information

// Displays the papers and paper sizes available for the 2nd printer in a text frame

var docRef = [Link]();


var itemRef = [Link](600, 300, 200, 100);
var textRef = [Link]();
[Link] = 600;
[Link] = 50;

// get paper objects for 2nd printer


var printerRef = printerList[1];
(continues on next page)

604 Chapter 106. PaperInfo


Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)


[Link] = [Link];
[Link] += " paper list:\r";
var paragraphCount = 2;

// get details of each paper


var iCount = [Link];
for (var i = 0; i < iCount; i++) {
var paperRef = [Link][i];
var paperInfoRef = [Link];
[Link] += [Link];
[Link] += "\t";
[Link] += [Link];
[Link] += " x ";
[Link] += [Link];
[Link] += "\r";
paragraphCount++;
}
redraw();

106.2. Example 605


Illustrator Scripting Guide, Release 0.0.1

606 Chapter 106. PaperInfo


CHAPTER

SEVEN

PARAGRAPHATTRIBUTES

[Link][index].paragraphs[index].paragraphAttributes
Description
Specifies the properties and attributes of a paragraph contained in a text frame.

Note: Paragraph attributes do not have default values, and are undefined untile xplicitly set.

107.1 Properties

107.1.1 [Link]

[Link][index].paragraphs[index].paragraphAttributes.
autoLeadingAmount
Description
Auto leading amount expressed as a percentage.
Type
Number (double).

107.1.2 [Link]

[Link][index].paragraphs[index].[Link]
Description
If true, BunriKinshi is enabled.
Type
Boolean.

607
Illustrator Scripting Guide, Release 0.0.1

107.1.3 [Link]

[Link][index].paragraphs[index].[Link]
Description
The Burasagari type.
Type
BurasagariTypeEnum

107.1.4 [Link]

[Link][index].paragraphs[index].paragraphAttributes.
desiredGlyphScaling
Description
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.
Type
Number (double).

107.1.5 [Link]

[Link][index].paragraphs[index].paragraphAttributes.
desiredLetterSpacing
Description
Desired 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.
Type
Number (double).

107.1.6 [Link]

[Link][index].paragraphs[index].paragraphAttributes.
desiredWordSpacing
Description
Desired word spacing, expressed as a percentage of the default space for the font. Range: 0.0 to 1000.0; at 100.00. No
space is added between words.
Type
Number (double).

608 Chapter 107. ParagraphAttributes


Illustrator Scripting Guide, Release 0.0.1

107.1.7 [Link]

[Link][index].paragraphs[index].paragraphAttributes.
everyLineComposer
Description
If true, the Every-line Composer is enabled. If false, the Single-line Composer is enabled.
Type
Boolean.

107.1.8 [Link]

[Link][index].paragraphs[index].paragraphAttributes.
firstLineIndent
Description
First line left indent in points.
Type
Number (double).

107.1.9 [Link]

[Link][index].paragraphs[index].paragraphAttributes.
hyphenateCapitalizedWords
Description
If true, hyphenation is enabled for capitalized words.
Type
Boolean.

107.1.10 [Link]

[Link][index].paragraphs[index].[Link]
Description
If true, hyphenation is enabled for the paragraph.
Type
Boolean.

107.1. Properties 609


Illustrator Scripting Guide, Release 0.0.1

107.1.11 [Link]

[Link][index].paragraphs[index].paragraphAttributes.
hyphenationPreference
Description
Hyphenation preference scale for better spacing (0) or fewer hyphens (1). Range: 0.0 to 1.0.
Type
Number (double).

107.1.12 [Link]

[Link][index].paragraphs[index].paragraphAttributes.
hyphenationZone
Description
The 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 [Link] is false.

Type
Number (double).

107.1.13 [Link]

[Link][index].paragraphs[index].[Link]
Description
Paragraph justification.
Type
Justification

107.1.14 [Link]

[Link][index].paragraphs[index].[Link]
Description
The Kinsoku Shori name.
Type
String.

610 Chapter 107. ParagraphAttributes


Illustrator Scripting Guide, Release 0.0.1

107.1.15 [Link]

[Link][index].paragraphs[index].[Link]
Description
The preferred Kinsoku order.
Type
KinsokuOrderEnum

107.1.16 [Link]

[Link][index].paragraphs[index].paragraphAttributes.
kurikaeshiMojiShori
Description
If true, KurikaeshiMojiShori is enabled.
Type
Boolean.

107.1.17 [Link]

[Link][index].paragraphs[index].[Link]
Description
Auto leading type.
Type
AutoLeadingType

107.1.18 [Link]

[Link][index].paragraphs[index].[Link]
Description
The left indent of margin in points.
Type
Number (double).

107.1. Properties 611


Illustrator Scripting Guide, Release 0.0.1

107.1.19 [Link]

[Link][index].paragraphs[index].paragraphAttributes.
maximumConsecutiveHyphens
Description
Maximum number of consecutive hyphenated lines.
Type
Number (long).

107.1.20 [Link]

[Link][index].paragraphs[index].paragraphAttributes.
maximumGlyphScaling
Description
Maximum glyph scaling, expressed as a percentage of the default character width. Range: 50.0 to 200.0; at 100.0. The
width of characters is not changed.

Note: Valid only for justified paragraphs.

Type
Number (double).

107.1.21 [Link]

[Link][index].paragraphs[index].paragraphAttributes.
maximumLetterSpacing
Description
Maximum 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.

Type
Number (double).

612 Chapter 107. ParagraphAttributes


Illustrator Scripting Guide, Release 0.0.1

107.1.22 [Link]

[Link][index].paragraphs[index].paragraphAttributes.
maximumWordSpacing
Description
Maximum word spacing, expressed as a percentage of the default space for the font. Range: 0.0 to 1000.0; at 100.00.
No space is added between words.

Note: Valid only for justified paragraphs.

Type
Number (double).

107.1.23 [Link]

[Link][index].paragraphs[index].paragraphAttributes.
minimumAfterHyphen
Description
Minimum number of characters after a hyphen.
Type
Number (long).

107.1.24 [Link]

[Link][index].paragraphs[index].paragraphAttributes.
minimumBeforeHyphen
Description
Minimum number of characters before a hyphen.
Type
Number (long).

107.1.25 [Link]

[Link][index].paragraphs[index].paragraphAttributes.
minimumGlyphScaling
Description
Minimum glyph scaling, expressed as a percentage of the default character width. Range: 50.0 to 200.0. At 100.0, the
width of characters is not changed.

107.1. Properties 613


Illustrator Scripting Guide, Release 0.0.1

Note: Valid only for justified paragraphs.

Type
Number (double).

107.1.26 [Link]

[Link][index].paragraphs[index].paragraphAttributes.
minimumHyphenatedWordSize
Description
Minimum number of characters for a word to be hyphenated.
Type
Number (long).

107.1.27 [Link]

[Link][index].paragraphs[index].paragraphAttributes.
minimumLetterSpacing
Description
Minimum 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.

Type
Number (double).

107.1.28 [Link]

[Link][index].paragraphs[index].paragraphAttributes.
minimumWordSpacing
Description
Minimum word spacing, expressed as a percentage of the default space for the font. Range: 0.0 to 1000.0; at 100.00.
No space is added between words.

Note: Valid only for justified paragraphs.

Type

614 Chapter 107. ParagraphAttributes


Illustrator Scripting Guide, Release 0.0.1

Number (double).

107.1.29 [Link]

[Link][index].paragraphs[index].[Link]
Description
The Mojikumi name.
Type
String.

107.1.30 [Link]

[Link][index].paragraphs[index].[Link]
Description
The object’s container.
Type
Object, read-only.

107.1.31 [Link]

[Link][index].paragraphs[index].[Link]
Description
Right indent of margin in points.
Type
Number (double).

107.1.32 [Link]

[Link][index].paragraphs[index].[Link]
Description
If true, Roman hanging punctuation is enabled.
Type
Boolean.

107.1. Properties 615


Illustrator Scripting Guide, Release 0.0.1

107.1.33 [Link]

[Link][index].paragraphs[index].paragraphAttributes.
singleWordJustification
Description
Single word justification.
Type
Justification

107.1.34 [Link]

[Link][index].paragraphs[index].[Link]
Description
Spacing after paragraph in points.
Type
Number (double).

107.1.35 [Link]

[Link][index].paragraphs[index].[Link]
Description
Spacing before paragraph in points.
Type
Number (double).

107.1.36 [Link]

[Link][index].paragraphs[index].[Link]
Description
Tab stop settings.
Type
TabStopInfo

616 Chapter 107. ParagraphAttributes


Illustrator Scripting Guide, Release 0.0.1

107.1.37 [Link]

[Link][index].paragraphs[index].[Link]
Description
The class name of the object.
Type
String, read-only.

107.2 Example

107.2.1 Changing justification in paragraphs

// Creates a new document with 1 text frame and 3 paragraphs


// then gives each paragraph a different justification

var docRef = [Link]();


var pathRef = [Link](600, 200, 200, 400);
var textRef = [Link](pathRef);
[Link]("Left justified paragraph.");
[Link]("Center justified paragraph.");
[Link]("Right justified paragraph.");
[Link] = 28;

// change the justification of each paragraph


// using the paragraph attributes object
var paraAttr_0 = [Link][0].paragraphAttributes;
paraAttr_0.justification = [Link];

var paraAttr_1 = [Link][1].paragraphAttributes;


paraAttr_1.justification = [Link];

var paraAttr_2 = [Link][2].paragraphAttributes;


paraAttr_2.justification = [Link];

107.2. Example 617


Illustrator Scripting Guide, Release 0.0.1

618 Chapter 107. ParagraphAttributes


CHAPTER

EIGHT

PARAGRAPHS

[Link][index].paragraphs
Description
A collection of TextRange objects, with each TextRange representing a paragraph. The elements are not named; you
must access them by index.

108.1 Properties

108.1.1 [Link]

[Link][index].[Link]
Description
The number of objects in the collection.
Type
Number, read-only.

108.1.2 [Link]

[Link][index].[Link]
Description
The parent of this object.
Type
Object, read-only.

619
Illustrator Scripting Guide, Release 0.0.1

108.1.3 [Link]

[Link][index].[Link]
Description
The class name of the referenced object.
Type
String, read-only.

108.2 Methods

108.2.1 [Link]()

[Link][index].[Link](contents [,relativeObject] [,
insertionLocation])
Description
Adds a new paragraph with specified text contents at the specified location in the current document. If location is not
specified, adds the new paragraph to the containing text frame after the current text selection or insertion point.
Parameters

Parameter Type Description


contents String Text contents to add
relativeObject TextFrameItem, optional Object to add item to
insertionLocation ElementPlacement, optional Location to place text

Returns
TextRange

108.2.2 [Link]()

[Link][index].[Link](contents)
Description
Adds a new paragraph with specified text contents before the current text selection or insertion point.
Parameters

Parameter Type Description


contents String Text contents to add

Returns
TextRange

620 Chapter 108. Paragraphs


Illustrator Scripting Guide, Release 0.0.1

108.2.3 [Link]()

[Link][index].[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number String or number key

Returns
TextRange

108.2.4 [Link]()

[Link][index].[Link]()
Description
Deletes all elements in this collection.
Returns
Nothing.

108.3 Example

108.3.1 Counting paragraphs

// Counts all paragraphs in current doc and stores result in paragraphCount


if ([Link] > 0) {
var doc = [Link];
var paragraphCount = 0;
for (var i = 0; i < [Link]; i++) {
paragraphCount += [Link][i].[Link];
}
}

108.3. Example 621


Illustrator Scripting Guide, Release 0.0.1

622 Chapter 108. Paragraphs


CHAPTER

NINE

PARAGRAPHSTYLE

[Link][index
Description
Associates character and paragraph attributes with a style name. The style object can be used to apply those attributes
to the text in a TextFrame object. See Creating and applying a paragraph style example.

109.1 Properties

109.1.1 [Link]

[Link][[Link]
Description
The character properties for the text range.
Type
CharacterAttributes, read-only.

109.1.2 [Link]

[Link][[Link]
Description
The paragraph style’s name.
Type
String.

623
Illustrator Scripting Guide, Release 0.0.1

109.1.3 [Link]

[Link][[Link]
Description
The paragraph properties for the text range.
Type
CharacterAttributes, read-only.

109.1.4 [Link]

[Link][[Link]
Description
The object’s container.
Type
Object, read-only.

109.1.5 [Link]

[Link][[Link]
Description
The class name of the object.
Type
String, read-only.

109.2 Methods

109.2.1 [Link]()

[Link][[Link](textItem [,clearingOverrides])
Description
Applies this paragraph style to the specified text item.
Parameters

Parameter Type Description


textItem Object Paragraph item to apply style to
clearingOverrides Boolean, optional Whether to clear overrides

624 Chapter 109. ParagraphStyle


Illustrator Scripting Guide, Release 0.0.1

Returns
Nothing.

109.2.2 [Link]()

[Link][[Link]()
Description
Deletes the object.
Returns
Nothing.

109.2. Methods 625


Illustrator Scripting Guide, Release 0.0.1

626 Chapter 109. ParagraphStyle


CHAPTER

PARAGRAPHSTYLES

[Link]
Description
A collection of ParagraphStyle objects.

110.1 Properties

110.1.1 [Link]

[Link]
Description
Number of elements in the collection.
Type
Number, read-only.

110.1.2 [Link]

[Link]
Description
The object’s container.
Type
Object, read-only.

627
Illustrator Scripting Guide, Release 0.0.1

110.1.3 [Link]

[Link]
Description
The class name of the object.
Type
String, read-only.

110.2 Methods

110.2.1 [Link]()

[Link](name)
Description
Creates a named paragraph style.
Parameters

Parameter Type Description


name String Name of element to get

Returns
CharacterAttributes

110.2.2 [Link]()

[Link](name)
Description
Get the first element in the collection with the provided name.
Parameters

Parameter Type Description


name String Name of element to get

Returns
CharacterAttributes

628 Chapter 110. ParagraphStyles


Illustrator Scripting Guide, Release 0.0.1

110.2.3 [Link]()

[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number String or number key

Returns
CharacterAttributes

110.2.4 [Link]()

[Link]()
Description
Deletes all elements in the collection.
Returns
Nothing.

110.3 Example

110.3.1 Creating and applying a paragraph style

// Creates a new document with 1 text frame and 3 paragraphs


// gives each paragraph a different justification, then creates
// a paragraph style and applies it to all paragraphs

var docRef = [Link]();


var pathRef = [Link](600, 200, 200, 400);
var textRef = [Link](pathRef);
[Link]("Left justified paragraph.");
[Link]("Center justified paragraph.");
[Link]("Right justified paragraph.");
[Link] = 28;

// change the justification of each paragraph


// using the paragraph attributes object
var paraAttr_0 = [Link][0].paragraphAttributes;
paraAttr_0.justification = [Link];

(continues on next page)

110.3. Example 629


Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)


var paraAttr_1 = [Link][1].paragraphAttributes;
paraAttr_1.justification = [Link];

var paraAttr_2 = [Link][2].paragraphAttributes;


paraAttr_2.justification = [Link];

// create a new paragraph style


var paraStyle = [Link]("LeftIndent");

// add some paragraph attributes


var paraAttr = [Link];
[Link] = [Link];
[Link] = 10;

// apply the style to each item in the document


var iCount = [Link];
for (var i = 0; i < iCount; i++) {
[Link]([Link][i], true);
}
redraw();

630 Chapter 110. ParagraphStyles


CHAPTER

ONE

PATHITEMS

[Link]
Description
A collection of PathItem objects.
The methods ellipse, polygon, rectangle, roundedRectangle, and star allow you to create complex path items
using straightforward parameters.
If you do not provide any parameters when calling these methods, default values are used.

111.1 Properties

111.1.1 [Link]

[Link]
Description
Number of elements in the collection.
Type
Number, read-only.

111.1.2 [Link]

[Link]
Description
The object’s container.
Type
Object, read-only.

631
Illustrator Scripting Guide, Release 0.0.1

111.1.3 [Link]

[Link]
Description
The class name of the object.
Type
String, read-only.

111.2 Methods

111.2.1 [Link]()

[Link]()
Description
Creates a new object.
Returns
PathItem

111.2.2 [Link]()

[Link]([top][, left][, width][, height][, reversed][,


inscribed])
Description
Creates a new pathItem in the shape of an ellipse using the supplied parameters.
Defaults

Parameter Value
top 100 pt.
left 100 pt.
width 50 pt.
height 100 pt.
reversed false

Parameters

Parameter Type Description


top Number (double), optional Top of path
left Number (double), optional Left of path
width Number (double), optional Width of path
height Number (double), optional Height of path
reversed Boolean, optional Whether path is reversed
inscribed Boolean, optional Whether path is inscribed

632 Chapter 111. PathItems


Illustrator Scripting Guide, Release 0.0.1

Returns
PathItem

111.2.3 [Link]()

[Link](name)
Description
Gets the first element in the collection with the specified name.
Parameters

Parameter Type Description


name String Name of element to get

Returns
PathItem

111.2.4 [Link]()

[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number String or number key

Returns
PathItem

111.2.5 [Link]()

[Link]([centerX][, centerY][, radius][, sides][, reversed])


Description
Creates a new pathItem in the shape of an polygon using the supplied parameters.
Defaults

111.2. Methods 633


Illustrator Scripting Guide, Release 0.0.1

Parameter Value
centerX 200 pt.
centerY 300 pt.
radius 50 pt.
sides 8
reversed false

Parameters

Parameter Type Description


centerX Number (double), optional CenterX of path
centerY Number (double), optional CenterY of path
radius Number (double), optional Radius of path
sides Number (long), optional Number of sides
reversed Boolean, optional Whether path is reversed

Returns
PathItem

111.2.6 [Link]()

[Link](top, left, width, height[,reversed])


Description
Creates a new pathItem in the shape of an polygon using the supplied parameters.
Parameters

Parameter Type Description


top Number (double) Top of path
left Number (double) Left of path
width Number (double) Width of path
height Number (double) Height of path
reversed Boolean, optional Whether path is reversed

Returns
PathItem

634 Chapter 111. PathItems


Illustrator Scripting Guide, Release 0.0.1

111.2.7 [Link]()

[Link]()
Description
Deletes all elements in this collection.
Returns
Nothing

111.2.8 [Link]()

[Link](top, left, width, height[,


horizontalRadius][, verticalRadius][, reversed])
Description
Creates a new pathItem in the shape of a rectangle with rounded corners using the supplied parameters.
Defaults

Parameter Value
horizontalRadius 15 pt.
verticalRadius 20 pt.
reversed false

Parameters

Parameter Type Description


top Number (double) Top of path
left Number (double) Left of path
width Number (double) Width of path
height Number (double) Height of path
horizontalRadius Number (double), optional Horizontal radius of rounded corner
verticalRadius Number (double), optional Vertical radius of rounded corner
reversed Boolean, optional Whether path is reversed

Returns
PathItem

111.2. Methods 635


Illustrator Scripting Guide, Release 0.0.1

111.2.9 [Link]()

[Link]([centerX][, centerY][, radius][, innerRadius][,


points][, reversed])
Description
Creates a new path item in the shape of a star using the supplied parameters.
Defaults

Parameter Value
centerX 200 pt.
centerY 300 pt.
radius 50 pt.
innerRadius 20 pt.
points 5
reversed false

Parameters

Parameter Type Description


centerX Number (double), optional CenterX of path
centerY Number (double), optional CenterY of path
radius Number (double), optional Radius of path
innerRadius Number (double), optional Inner radius of path
points Number (long), optional Number of points
reversed Boolean, optional Whether path is reversed

Returns
PathItem

111.3 Example

111.3.1 Creating shapes

// Creates 5 shapes in layer 1 of document 1


// and applies a random graphic style to each
var doc = [Link]();
var artLayer = [Link][0];
[Link] = true;
[Link] = true;

var rect = [Link](762.5, 87.5, 425.0, 75.0);


var rndRect = [Link](637.5, 87.5, 425.0, 75.0, 20.0, 10.0);

// Create ellipse, 'reversed' is false, 'inscribed' is true


var ellipse = [Link](512.5, 87.5, 425.0, 75.0, false, true);

(continues on next page)

636 Chapter 111. PathItems


Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)


// Create octagon, and 8-sided polygon
var octagon = [Link](300.0, 325.0, 75.0, 8);

// Create a 4 pointed star


var star = [Link](300.0, 125.0, 100.0, 20.0, 4);

for (i = 0; i < [Link]; i++) {


var styleIndex = [Link]([Link]() * ([Link] - 1));
[Link][styleIndex].applyTo([Link][i]);
}

111.3. Example 637


Illustrator Scripting Guide, Release 0.0.1

638 Chapter 111. PathItems


CHAPTER

TWO

PATHPOINT

[Link][index].pathPoints[index
Description
A point on a specific path.
Each path point is made up of an anchor point (anchor) and a pair of handles (leftDirection and rightDirection).

112.1 Properties

112.1.1 [Link]

[Link][index].pathPoints[index].anchor
Description
The position of this point’s anchor point.
Type
Array of 2 numbers

112.1.2 [Link]

[Link][index].pathPoints[index].leftDirection
Description
The position of this path point’s in control point.
Type
Array of 2 numbers

639
Illustrator Scripting Guide, Release 0.0.1

112.1.3 [Link]

[Link][index].pathPoints[index].parent
Description
The path item that contains this path point.
Type
PathItem; read-only.

112.1.4 [Link]

[Link][index].pathPoints[index].pointType
Description
The type of path point, either a curve or a corner. Any point can considered a corner point.
Setting the type to a corner forces the left and right direction points to be on a straight line when the user attempts to
modify them in the user interface.
Type
PointType

112.1.5 [Link]

[Link][index].pathPoints[index].rightDirection
Description
The position of this path point’s out control point.
Type
Array of 2 numbers

112.1.6 [Link]

[Link][index].pathPoints[index].selected
Description
Are points of this path point selected, and if so, which ones.
Type
PathPointSelection

640 Chapter 112. PathPoint


Illustrator Scripting Guide, Release 0.0.1

112.1.7 [Link]

[Link][index].pathPoints[index].typename
Description
The class name of the referenced object.
Type
String; read-only.

112.2 Methods

112.2.1 [Link]()

[Link][index].pathPoints[index].remove()
Description
Removes the referenced point from the path.
Returns
Nothing.

112.2. Methods 641


Illustrator Scripting Guide, Release 0.0.1

642 Chapter 112. PathPoint


CHAPTER

THREE

PATHPOINTS

[Link][index].pathPoints
Description
A collection of PathPoint objects in a specific path.
The elements are not named; you must access them by index.

113.1 Properties

113.1.1 [Link]

[Link][index].[Link]
Description
Number of elements in the collection.
Type
Number, read-only.

113.1.2 [Link]

[Link][index].[Link]
Description
The object’s container.
Type
Object, read-only.

643
Illustrator Scripting Guide, Release 0.0.1

113.1.3 [Link]

[Link][index].[Link]
Description
The class name of the object.
Type
String, read-only.

113.2 Methods

113.2.1 [Link]()

[Link][index].[Link]()
Description
Creates a new object.
Returns
PathPoint

113.2.2 [Link]()

[Link][index].[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number String or number key

Returns
PathPoint

644 Chapter 113. PathPoints


Illustrator Scripting Guide, Release 0.0.1

113.2.3 [Link]()

[Link][index].[Link]()
Description
Deletes all elements in the collection.
Returns
Nothing.

113.3 Example

113.3.1 Adding a path point to a path

// Appends a new PathPoint to an existing path


// and initializes its anchor and handle points.
if ([Link] > 0) {
var doc = [Link];

var line = [Link]();


[Link] = true;
[Link](Array(Array(220, 475), Array(375, 300)));

// Append another point to the line


var newPoint = [Link][0].[Link]();
[Link] = Array(220, 300);
[Link] = [Link];
[Link] = [Link];
[Link] = [Link];
}

113.3. Example 645


Illustrator Scripting Guide, Release 0.0.1

646 Chapter 113. PathPoints


CHAPTER

FOUR

PATTERN

[Link][index
Description
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.

114.1 Properties

114.1.1 [Link]

[Link][index].name
Description
The pattern name.
Type
String

114.1.2 [Link]

[Link][index].parent
Description
The document that contains this pattern.
Type
Document, read-only.

647
Illustrator Scripting Guide, Release 0.0.1

114.1.3 [Link]

[Link][index].typename
Description
The class name of the object.
Type
String, read-only.

114.2 Methods

114.2.1 [Link]()

[Link][index].remove()
Description
Removes the referenced pattern from the document.
Returns
Nothing.

114.2.2 [Link]()

[Link][index].toString()
Description
Returns the object type of a referenced object. If the object has a name, also returns the name.
Returns
String

648 Chapter 114. Pattern


CHAPTER

FIVE

PATTERNS

[Link]
Description
A collection of Pattern objects in a document.

115.1 Properties

115.1.1 [Link]

[Link]
Description
Number of elements in the collection.
Type
Number, read-only.

115.1.2 [Link]

[Link]
Description
The object’s container.
Type
Object, read-only.

649
Illustrator Scripting Guide, Release 0.0.1

115.1.3 [Link]

[Link]
Description
The class name of the object.
Type
String, read-only.

115.2 Methods

115.2.1 [Link]()

[Link]()
Description
Creates a new object.
Returns
Pattern

115.2.2 [Link]()

[Link](name)
Description
Get the first element in the collection with the provided name.
Parameters

Parameter Type Description


name String Name of element to get

Returns
Pattern

650 Chapter 115. Patterns


Illustrator Scripting Guide, Release 0.0.1

115.2.3 [Link]()

[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number String or number key

Returns
Pattern

115.2.4 [Link]()

[Link]()
Description
Deletes all elements in the collection.
Returns
Nothing.

115.3 Example

115.3.1 Removing a pattern

// Deletes the last pattern from the current document.


if ([Link] > 0) {
var lastIndex = [Link] - 1;

var patternToRemove = [Link][lastIndex];


var patternName = [Link];
[Link]();

// Note after removing Illustrator objects, set the variable that


// referenced the removed object to null, since it is now invalid.
patternToRemove = null;
}

115.3. Example 651


Illustrator Scripting Guide, Release 0.0.1

652 Chapter 115. Patterns


CHAPTER

SIX

PDFFILEOPTIONS

[Link]
Description
Options for opening a PDF file, used with the [Link]() method.
All properties are optional.

116.1 Properties

116.1.1 [Link]

[Link]
Description
What page should be used when opening a multipage document.
Default: 1
Type
Number (long)

116.1.2 [Link]

[Link]
Description
The object’s container.
Type
Object; read-only.

653
Illustrator Scripting Guide, Release 0.0.1

116.1.3 [Link]

[Link]
Description
Which box should be used when placing a multipage document.
Default: [Link]
Type
PDFBoxType

116.1.4 [Link]

[Link]
Description
The class name of the object.
Type
String; read-only.

116.2 Example

116.2.1 Opening a PDF with options

// Opens a PDF file with specified options


var pdfOptions = [Link];
[Link] = [Link];
[Link] = 2;

// Open a file using these preferences


var fileRef = filePath;

if (fileRef != null) {
var docRef = open(fileRef, [Link]);
}

654 Chapter 116. PDFFileOptions


CHAPTER

SEVEN

PDFSAVEOPTIONS

new PDFSaveOptions()
Description
Options for saving a document as an Adobe PDF file, used with the [Link]() method.
All properties are optional.

117.1 Properties

117.1.1 [Link]

[Link]
Description
Optional. Create Acrobat® layers from top-level layers. Acrobat 6 only.
Default: false
Type
Boolean

117.1.2 [Link]

[Link]
Description
Optional. This is considered for multi-asset extraction, which specifies the artboard range. An empty string extracts all
the artboards.
Default: empty string
Type
String

655
Illustrator Scripting Guide, Release 0.0.1

117.1.3 [Link]

[Link]
Description
Optional. Link 4 bleed values.
Default: true
Type
Boolean

117.1.4 [Link]

[Link]
Description
The bleed offset rectangle.
Type
Array of 4 numbers

117.1.5 [Link]

[Link]
Description
Optional. Draw color bars.
Default: false
Type
Boolean

117.1.6 [Link]

[Link]
Description
Optional. The type of color bitmap compression used.
Default: [Link]
Type
CompressionQuality

656 Chapter 117. PDFSaveOptions


Illustrator Scripting Guide, Release 0.0.1

117.1.7 [Link]

[Link]
Description
Optional. The PDF color conversion policy.
Default: [Link]
Type
ColorConversion

117.1.8 [Link]

[Link]
Description
Optional. The conversion target for color conversion.
Default: [Link]
Type
ColorDestination

117.1.9 [Link]

[Link]
Description
Optional. The color downsampling resolution in dots per inch (dpi). If 0, no downsampling is performed.
Default: 150.0
Type
Number (double)

117.1.10 [Link]

[Link]
Description
Optional. Downsample if the image’s resolution is above this value.
Default: 225.0
Type
Number (double)

117.1. Properties 657


Illustrator Scripting Guide, Release 0.0.1

117.1.11 [Link]

[Link]
Description
Optional. How color bitmap images should be resampled.
Default: [Link]
Type
DownsampleMethod

117.1.12 [Link]

[Link]
Description
Optional. The color profile to include.
Default: [Link]
Type
ColorProfile

117.1.13 [Link]

[Link]
Description
Optional. Tile size when compressing with JPEG2000.
Default: 256
Type
Number (long)

117.1.14 [Link]

[Link]
Description
Optional. The version of the Acrobat file format to create.
Default: PDFCompatibility.Acrobat5
Type
PDFCompatibility

658 Chapter 117. PDFSaveOptions


Illustrator Scripting Guide, Release 0.0.1

117.1.15 [Link]

[Link]
Description
Optional. If true, the line art and text should be compressed.
Default: true
Type
Boolean

117.1.16 [Link]

[Link]
Description
Optional. A password string to open the document.
Default: no string
Type
String

117.1.17 [Link]

[Link]
Description
Optional. If true, enable accessing 128-bit.
Default: true
Type
Boolean

117.1.18 [Link]

[Link]
Description
Optional. If true, enable copying of text 128-bit.
Default: true
Type
Boolean

117.1. Properties 659


Illustrator Scripting Guide, Release 0.0.1

117.1.19 [Link]

[Link]
Description
Optional. If true, enable copying and accessing 40-bit.
Default: true
Type
Boolean

117.1.20 [Link]

[Link]
Description
Optional. If true, enable plaintext metadata 128-bit. Available only for Acrobat 6.
Default: false
Type
Boolean

117.1.21 [Link]

[Link]
Description
Optional. The printing flattener options.
Type
PrintFlattenerOptions

117.1.22 [Link]

[Link]
Description
Optional. The transparency flattener preset name.
Type
String.

660 Chapter 117. PDFSaveOptions


Illustrator Scripting Guide, Release 0.0.1

117.1.23 [Link]

[Link]
Description
Optional. Include a subset of fonts when less than this percentage of characters is used in the document. Valid for
Illustrator 9 file format. Range: 0.0 to 100.0.
Default: 100.0
Type
Number (double)

117.1.24 [Link]

[Link]
Description
Optional. If true, thumbnail images are generated with the saved file.
Default: true
Type
Boolean

117.1.25 [Link]

[Link]
Description
Optional. Quality of grayscale bitmap compression.
Default: [Link]
Type
CompressionQuality

117.1.26 [Link]

[Link]
Description
Optional. Downsampling resolution in dots per inch (dpi). If 0, no downsampling is performed.
Default: 150.0
Type
Number (double)

117.1. Properties 661


Illustrator Scripting Guide, Release 0.0.1

117.1.27 [Link]

[Link]
Description
Optional. Downsample if the image’s resolution is above this value.
Default: 225.0
Type
Number (double)

117.1.28 [Link]

[Link]
Description
Optional. How grayscale bitmap images should be resampled
Default: [Link]
Type
DownsampleMethod

117.1.29 [Link]

[Link]
Description
Optional. Tile size when compressing with JPEG2000.
Default: 256
Type
Number (long)

117.1.30 [Link]

[Link]
Description
Optional. Type of monochrome bitmap compression used.
Default: [Link]
Type
MonochromeCompression

662 Chapter 117. PDFSaveOptions


Illustrator Scripting Guide, Release 0.0.1

117.1.31 [Link]

[Link]
Description
Optional. Downsampling resolution in dots per inch (dpi). If 0, no downsampling is performed.
Default: 300
Type
Number (double)

117.1.32 [Link]

[Link]
Description
Optional. Downsample if the image’s resolution is above this value.
Default: 450.0
Type
Number (double)

117.1.33 [Link]

[Link]
Description
Optional. How monochrome bitmap images should be resampled.
Default: [Link]
Type
DownsampleMethod

117.1.34 [Link]

[Link]
Description
Optional. Custom offset in points for using the custom paper.
Default: 0.0
Type
Number (double)

117.1. Properties 663


Illustrator Scripting Guide, Release 0.0.1

117.1.35 [Link]

[Link]
Description
Optional. If true, the PDF document should be optimized for fast web viewing.
Default: false
Type
Boolean

117.1.36 [Link]

[Link]
Description
Optional. An optional comment to add to the PDF file, describing the intended printing condition.
Default: not included
Type
String

117.1.37 [Link]

[Link]
Description
Optional. The name of a registered printing condition.
Default: not included
Type
String

117.1.38 [Link]

[Link]
Description
Optional. If true, raw page information.
Default: false
Type
Boolean

664 Chapter 117. PDFSaveOptions


Illustrator Scripting Guide, Release 0.0.1

117.1.39 [Link]

[Link]
Description
Optional. The page marks style.
Default: [Link]
Type
PageMarksTypes

117.1.40 [Link]

[Link]
Description
Optional. PDF security printing permission.
Default: PDFPrintAllowedEnum.PRINT128HIGHRESOLUTION
Type
PDFPrintAllowedEnum

117.1.41 [Link]

[Link]
Description
Optional. Security changes allowed.
Default: PDFChangeAllowedEnum.CHANGE128ANYCHANGES
Type
PDFChangesAllowedEnum

117.1.42 [Link]

[Link]
Description
Optional. Name of PDF preset to use.
Type
String

117.1. Properties 665


Illustrator Scripting Guide, Release 0.0.1

117.1.43 [Link]

[Link]
Description
Optional. The PDF standard with which this document complies.
Default: [Link]
Type
PDFXStandard

117.1.44 [Link]

[Link]
Description
Optional. A description of the PDF standard from the selected preset.
Type
String

117.1.45 [Link]

[Link]
Description
Optional. A password string to restrict editing security settings.
Default: no string
Type
String

117.1.46 [Link]

[Link]
Description
Optional. If true, Illustrator editing capabilities should be preserved when saving the document.
Default: true
Type
Boolean

666 Chapter 117. PDFSaveOptions


Illustrator Scripting Guide, Release 0.0.1

117.1.47 [Link]

[Link]
Description
Optional. Flattening printer resolution.
Default: 800.0
Type
Number (double)

117.1.48 [Link]

[Link]
Description
Optional. If true, draw registration marks.
Default: false
Type
Boolean

117.1.49 [Link]

[Link]
Description
Optional. Require a password to open the document.
Default: false
Type
Boolean

117.1.50 [Link]

[Link]
Description
Optional. Use a password to restrict editing security settings.
Default: false
Type
Boolean

117.1. Properties 667


Illustrator Scripting Guide, Release 0.0.1

117.1.51 [Link]

[Link]
Description
Optional. If true, manual trapping has been prepared for the document.
Default: false
Type
Boolean

117.1.52 [Link]

[Link]
Description
Optional. Draw trim marks.
Default: false
Type
Boolean

117.1.53 [Link]

[Link]
Description
Optional. The trim mark weight.
Default: PDFTrimMarkWeight.TRIMMARKWEIGHT0125
Type
PDFTrimMarkWeight

117.1.54 [Link]

[Link]
Description
Optional. Read-only. The class name of the referenced object.
Type
String

668 Chapter 117. PDFSaveOptions


Illustrator Scripting Guide, Release 0.0.1

117.1.55 [Link]

[Link]
Description
Optional. View PDF after saving.
Default: false
Type
Boolean

117.2 Example

117.2.1 Saving to PDF format

// Saves the current document as PDF to dest with specified options


// dest contains the full path and file name to save to
function saveFileToPDF(dest) {
var doc = [Link];

if ([Link] > 0) {
var saveName = new File(dest);
saveOpts = new PDFSaveOptions();

[Link] = PDFCompatibility.ACROBAT5;
[Link] = true;
[Link] = true;

[Link](saveName, saveOpts);
}
}

117.2. Example 669


Illustrator Scripting Guide, Release 0.0.1

670 Chapter 117. PDFSaveOptions


CHAPTER

EIGHT

PHOTOSHOPFILEOPTIONS

[Link]
Description
Options for opening a Photoshop file, used with the [Link]() method. All properties are optional.

118.1 Properties

118.1.1 [Link]

[Link]
Description
The parent of this object.
Type
Object; read-only.

118.1.2 [Link]

[Link]
Description
If true, imported images that have a non-square pixel aspect ratio should be adjusted.
Type
Boolean

671
Illustrator Scripting Guide, Release 0.0.1

118.1.3 [Link]

[Link]
Description
If true, image maps should be preserved when document is converted.
Default: true
Type
Boolean

118.1.4 [Link]

[Link]
Description
If true, layers should be preserved when document is converted.
Default: true
Type
Boolean

118.1.5 [Link]

[Link]
Description
If true, slices should be preserved when document is converted.
Default: true
Type
Boolean

118.1.6 [Link]

[Link]
Description
The class name of the referenced object.
Type
String; read-only.

672 Chapter 118. PhotoshopFileOptions


Illustrator Scripting Guide, Release 0.0.1

118.2 Example

118.2.1 Opening a Photoshop file

// Opens a Photoshop file containing layers with


// preferences set to preserve layers
var psdOptions = [Link];
[Link] = true;
[Link] = false;

// open a file using these prefs


var fileRef = File(psdFilePath);
if (fileRef != null) {
var docRef = open(fileRef, [Link]);
}

118.2. Example 673


Illustrator Scripting Guide, Release 0.0.1

674 Chapter 118. PhotoshopFileOptions


CHAPTER

NINE

PLACEDITEMS

[Link]
Description
A collection of PlacedItem objects in a document.

119.1 Properties

119.1.1 [Link]

[Link]
Description
Number of elements in the collection.
Type
Number, read-only.

119.1.2 [Link]

[Link]
Description
The object’s container.
Type
Object, read-only.

675
Illustrator Scripting Guide, Release 0.0.1

119.1.3 [Link]

[Link]
Description
The class name of the object.
Type
String, read-only.

119.2 Methods

119.2.1 [Link]()

[Link]()
Description
Creates a new object.
Use to place new art in a document. Use the file property of the resulting placedItem object to link the file containing
the artwork. See PlacedItem.
Returns
PlacedItem

119.2.2 [Link]()

[Link](name)
Description
Get the first element in the collection with the provided name.
Parameters

Parameter Type Description


name String Name of element to get

Returns
PlacedItem

676 Chapter 119. PlacedItems


Illustrator Scripting Guide, Release 0.0.1

119.2.3 [Link]()

[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number String or number key

Returns
PlacedItem

119.2.4 [Link]()

[Link]()
Description
Deletes all elements in the collection.
Returns
Nothing.

119.2. Methods 677


Illustrator Scripting Guide, Release 0.0.1

678 Chapter 119. PlacedItems


CHAPTER

PLUGINITEMS

[Link]
Description
A collection of PluginItem objects in a document.
See Copying a plug-in item.

120.1 Properties

120.1.1 [Link]

[Link]
Description
Number of elements in the collection.
Type
Number, read-only.

120.1.2 [Link]

[Link]
Description
The object’s container.
Type
Object, read-only.

679
Illustrator Scripting Guide, Release 0.0.1

120.1.3 [Link]

[Link]
Description
The class name of the object.
Type
String, read-only.

120.2 Methods

120.2.1 [Link]()

[Link](name)
Description
Get the first element in the collection with the provided name.
Parameters

Parameter Type Description


name String Name of element to get

Returns
PluginItem

120.2.2 [Link]()

[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number String or number key

Returns
PluginItem

680 Chapter 120. PluginItems


Illustrator Scripting Guide, Release 0.0.1

120.2.3 [Link]()

[Link]()
Description
Deletes all elements in the collection.
Returns
Nothing.

120.2. Methods 681


Illustrator Scripting Guide, Release 0.0.1

682 Chapter 120. PluginItems


CHAPTER

ONE

PPDFILE

[Link][index
Description
Associates file information with a PostScript Printer Description (PPD) file.

121.1 Properties

121.1.1 [Link]

[Link][index].name
Description
The PPD model name.
Type
String

121.1.2 [Link]

[Link][index].PPDInfo
Description
The PPD file information.
Type
PPDFileInfo

683
Illustrator Scripting Guide, Release 0.0.1

121.1.3 [Link]

[Link][index].typename
Description
The class name of the object.
Type
String; read-only.

684 Chapter 121. PPDFile


CHAPTER

TWO

PPDFILEINFO

[Link][index].PPDInfo
Description
Information about a PostScript Printer Description (PPD) file.

122.1 Properties

122.1.1 [Link]

[Link][index].[Link]
Description
The PostScript language level.
Type
String

122.1.2 [Link]

[Link][index].[Link]
Description
Path specification for the PPD file.
Type
File

685
Illustrator Scripting Guide, Release 0.0.1

122.1.3 [Link]

[Link][index].[Link]
Description
List of color separation screens.
Type
Array of Screen

122.1.4 [Link]

[Link][index].[Link]
Description
List of color separation screen spot functions.
Type
Array of ScreenSpotFunction

122.2 Example

122.2.1 Displaying PPD file properties

// Displays postscript level and path for each PPD file found in a new text frame
var sPPD = "";
var docRef = [Link]();

var x = 30;
var y = ([Link] - 30);

var iLength = [Link];


if (iLength > 20)
iLength = 20;

for (var i = 0; i < iLength; i++) {


var ppdRef = PPDFileList[i];
sPPD = [Link];
sPPD += "\r\tPS Level ";

var ppdInfoRef = [Link];


sPPD += [Link];
sPPD += "\r\tPath: ";
sPPD += [Link];

var textRef = [Link]();


(continues on next page)

686 Chapter 122. PPDFileInfo


Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)


[Link] = 8;
[Link] = sPPD;
[Link] = (y);
[Link] = x;

redraw();

if ((y -= ([Link])) <= 30) {


y = ([Link] - 30);
x += 150;
}
}

122.2.2 PPDFileInfo and related screen information

// Displays in a new text frame, the postscript level, file paths, screens, and
// screen spot information for first 10 PPD files found

var sPPD = "";


var docRef = [Link]();

var x = 30;
var y = ([Link] - 30);

var iLength = [Link];

if (iLength > 10)


iLength = 10;

for (var i = 0; i < iLength; i++) {


var ppdRef = PPDFileList[i];
sPPD = [Link];
sPPD += "\r\tPS Level ";

var ppdInfoRef = [Link];


sPPD += [Link];
sPPD += "\r\tPath: ";
sPPD += [Link];
sPPD += "\r\tScreens:\r";

var iScreens = [Link];


for (var c = 0; c < iScreens; c++) {

var screenRef = [Link][c];


sPPD += "\t\t";
sPPD += [Link];

var screenInfoRef = [Link];


sPPD += ", Angle = ";
(continues on next page)

122.2. Example 687


Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)


sPPD += [Link];
sPPD += ", Frequency = ";
sPPD += [Link];
sPPD += "\r";
}

sPPD += "\r\tScreenSpots:\r";

var iScreenSpots = [Link];


for (var n = 0; n < iScreenSpots; n++) {
var screenSpotRef = [Link][n];
sPPD += "\t\t";
sPPD += [Link];
sPPD += ", spotFunction: ";
sPPD += [Link];
sPPD += "\r";
}

var textRef = [Link]();


[Link] = 8;
[Link] = sPPD;
[Link] = (y);
[Link] = x;

redraw();

y -= ([Link]);
}

688 Chapter 122. PPDFileInfo


CHAPTER

THREE

PREFERENCES

[Link]
Description
Specifies the preferred options for AutoCAD, FreeHand, PDF, and Photoshop files.

123.1 Properties

123.1.1 [Link]

[Link]
Description
Options to use when opening or placing an AutoCAD file.
Type
OpenOptionsAutoCAD; read-only.

123.1.2 [Link]

[Link]
Description
Options to use when opening or placing a FreeHand file.
Type
OpenOptionsFreeHand; read-only.

689
Illustrator Scripting Guide, Release 0.0.1

123.1.3 [Link]

[Link]
Description
The parent of this object.
Type
object; read-only.

123.1.4 [Link]

[Link]
Description
Options to use when opening or placing a PDF file.
Type
PDFFileOptions; read-only.

123.1.5 [Link]

[Link]
Description
Options to use when opening or placing a Photoshop file.
Type
PhotoshopFileOptions; read-only.

123.1.6 [Link]

[Link]
Description
The class name of the referenced object.
Type
string; read-only.

690 Chapter 123. Preferences


Illustrator Scripting Guide, Release 0.0.1

123.2 Methods

123.2.1 [Link]

[Link](key)
Description
Gets the boolean value of a given application preference.
Parameters

Parameter Type Description


key String Pref key of value to get

Returns
Boolean

123.2.2 [Link]

[Link](key)
Description
Gets the integer value of a given application preference.
Parameters

Parameter Type Description


key String Pref key of value to get

Returns
Integer

123.2.3 [Link]

[Link](key)
Description
Gets the real-number value of a given application preference.
Parameters

Parameter Type Description


key String Pref key of value to get

Returns
Real

123.2. Methods 691


Illustrator Scripting Guide, Release 0.0.1

123.2.4 [Link]

[Link](key)
Description
Gets the string value of a given application preference.
Parameters

Parameter Type Description


key String Pref key of value to get

Returns
String

123.2.5 [Link]

[Link](key)
Description
Deletes a given application preference.
Parameters

Parameter Type Description


key String Pref key of value to get

Returns
Nothing.

123.2.6 [Link]

[Link](key, value)
Description
Sets the boolean value of a given application preference.
Parameters

Parameter Type Description


key String Pref key of value to get
value Boolean Value to set

Returns
Nothing.

692 Chapter 123. Preferences


Illustrator Scripting Guide, Release 0.0.1

123.2.7 [Link]

[Link](key, value)
Description
Sets the integer value of a given application preference.
Parameters

Parameter Type Description


key String Pref key of value to get
value Integer Value to set

Returns
Nothing.

123.2.8 [Link]

[Link](key, value)
Description
Sets the real-number value of a given application preference.
Parameters

Parameter Type Description


key String Pref key of value to get
value Double Value to set

Returns
Nothing.

123.2.9 [Link]

[Link](key, value)
Description
Sets the string value of a given application preference.
Parameters

Parameter Type Description


key String Pref key of value to get
value String Value to set

Returns
Nothing.

123.2. Methods 693


Illustrator Scripting Guide, Release 0.0.1

694 Chapter 123. Preferences


CHAPTER

FOUR

PRINTCOLORMANAGEMENTOPTIONS

new PrintColorManagementOptions()
Description
Information used for color management of the document.

124.1 Properties

124.1.1 [Link]

[Link]
Description
The color management profile mode. Default: [Link]
Type
PrintColorProfile

124.1.2 [Link]

[Link]
Description
The color management intent type. Default: [Link]
Type
PrintColorIntent

695
Illustrator Scripting Guide, Release 0.0.1

124.1.3 [Link]

[Link]
Description
The color management profile name.
Type
String

124.1.4 [Link]

[Link]
Description
The class name of the object.
Type
String; read-only.

124.2 Example

124.2.1 Managing colors for printing

// Creates a new document, adds symbols, then creates a


// PrintColorManagementOptions object and assigns it
// to a PrintOptions object, then prints with each color intent

// Add some symbol items to a new document


var docRef = [Link]();
var y = [Link] - 30;

for (var i = 0; i < ([Link]); i++) {


symbolRef = [Link][i];

symbolItemRef1 = [Link](symbolRef);
[Link] = y;
[Link] = 100;

y -= ([Link] + 10);
}

redraw();

var colorOptions = new PrintColorManagementOptions();


var options = new PrintOptions();
(continues on next page)

696 Chapter 124. PrintColorManagementOptions


Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)


[Link] = colorOptions;
[Link] = "ColorMatch RGB";

// Print the current document once for each color intent.


[Link] = [Link];
[Link](options);

[Link] = [Link];
[Link](options);

[Link] = [Link];
[Link](options);

[Link] = [Link];
[Link](options);

124.2. Example 697


Illustrator Scripting Guide, Release 0.0.1

698 Chapter 124. PrintColorManagementOptions


CHAPTER

FIVE

PRINTCOLORSEPARATIONOPTIONS

new PrintColorSeparationOptions()
Description
Information about the color separations to be used in printing the document.

125.1 Properties

125.1.1 [Link]

[Link]
Description
The color separation type.
Default: [Link]
Type
PrintColorSeparationMode

125.1.2 [Link]

[Link]
Description
If true, all spot colors should be converted to process colors.
Default: false
Type
Boolean

699
Illustrator Scripting Guide, Release 0.0.1

125.1.3 [Link]

[Link]
Description
The list of inks for color separation.
Type
Array of Ink

125.1.4 [Link]

[Link]
Description
If true, overprint in black.
Default: false
Type
Boolean

125.1.5 [Link]

[Link]
Description
Read-only. The class name of the object.
Type
String

125.2 Example

125.2.1 Managing color separations for printing

// Creates a new document with symbol items


// and prints document with each separation option

// Add some symbol items to a new document


var docRef = [Link]();
var y = [Link] - 30;

for (var i = 0; i < ([Link]); i++) {


symbolRef = [Link][i];
(continues on next page)

700 Chapter 125. PrintColorSeparationOptions


Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)

symbolItemRef1 = [Link](symbolRef);
[Link] = y;
[Link] = 100;

y -= ([Link] + 10);
}

// Print with various separation options


var sepOptions = new PrintColorSeparationOptions();
var options = new PrintOptions();
[Link] = sepOptions;

[Link] = true;
[Link] = true;
[Link] = [Link];
[Link](options);

[Link] = [Link];
[Link](options);

[Link] = false;
[Link] = false;
[Link] = [Link];
[Link](options);

125.2. Example 701


Illustrator Scripting Guide, Release 0.0.1

702 Chapter 125. PrintColorSeparationOptions


CHAPTER

SIX

PRINTCOORDINATEOPTIONS

new PrintCoordinateOptions()
Description
Information about the media and associated printing parameters.

126.1 Properties

126.1.1 [Link]

[Link]
Description
If true, flip artwork horizontally.
Default: false
Type
Boolean

126.1.2 [Link]

[Link]
Description
If true, proportionally scale the artwork to fit on media.
Default: false
Type
Boolean

703
Illustrator Scripting Guide, Release 0.0.1

126.1.3 [Link]

[Link]
Description
The horizontal scaling factor expressed as a percentage (100 = 100%).
Range: 1.0 to 10000.0.
Default: 100.0
Type
Number (double)

126.1.4 [Link]

[Link]
Description
The artwork orientation.
Default: [Link]
Type
PrintOrientation

126.1.5 [Link]

[Link]
Description
The artwork position on media.
Default: [Link]
Type
PrintPosition

126.1.6 [Link]

[Link]
Description
The page tiling mode.
Default: [Link]
Type
PrintTiling

704 Chapter 126. PrintCoordinateOptions


Illustrator Scripting Guide, Release 0.0.1

126.1.7 [Link]

[Link]
Description
The class name of the object.
Type
String; read-only.

126.1.8 [Link]

[Link]
Description
The vertical scaling factor expressed as a percentage (100 = 100%)
Range: 1.0 to 10000.0.
Default: 100.0
Type
Number (double)

126.2 Example

126.2.1 Managing print coordinates

// Creates a new document with symbol items that extend


// off the page then print with each print orientation
var docRef = [Link]();
var y = 500;
var x = -70;

if ([Link] > 0) {

for (var i = 0; i < 5; i++) {


symbolRef = [Link][0];

symbolItemRef1 = [Link](symbolRef);
[Link] = y;
[Link] = x;

x += 30;
}

redraw();
(continues on next page)

126.2. Example 705


Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)

// Print it with various Coordinate Options


var coordinateOptions = new PrintCoordinateOptions();
var options = new PrintOptions();
[Link] = coordinateOptions;

[Link] = true; // reverse from right to left


[Link] = true; // fit artwork to page size
[Link] = [Link];
[Link](options);

[Link] = false;
[Link] = false;
[Link] = [Link];
[Link] = 50;
[Link] = 50;
[Link](options);
}

706 Chapter 126. PrintCoordinateOptions


CHAPTER

SEVEN

PRINTER

[Link][index
Description
Associates an available printer with printer information.
To request a list of printers, you must first have a document open or an error is returned.

127.1 Properties

127.1.1 [Link]

[Link][index].name
Description
The printer name.
Type
String

127.1.2 [Link]

[Link][index].printerInfo
Description
The printer information.
Type
PrinterInfo

707
Illustrator Scripting Guide, Release 0.0.1

127.1.3 [Link]

[Link][index].typename
Description
The class name of the object.
Type
String; read-only.

708 Chapter 127. Printer


CHAPTER

EIGHT

PRINTERINFO

printerInfo
Description
Configuration information about a printer.

128.1 Properties

128.1.1 [Link]

[Link]
Description
If true, the printer supports binary printing.
Type
Boolean

128.1.2 [Link]

[Link]
Description
The printer color capability.
Type
PrinterColorMode

709
Illustrator Scripting Guide, Release 0.0.1

128.1.3 [Link]

[Link]
Description
If true, the printer supports custom paper size.
Type
Boolean

128.1.4 [Link]

[Link]
Description
If true, the printer supports custom paper transverse.
Type
Boolean

128.1.5 [Link]

[Link]
Description
The printer default resolution.
Type
Number (double)

128.1.6 [Link]

[Link]
Description
If true, the printer supports InRIP color separation.
Type
Boolean

710 Chapter 128. PrinterInfo


Illustrator Scripting Guide, Release 0.0.1

128.1.7 [Link]

[Link]
Description
The printer maximum device resolution.
Type
Number (double)

128.1.8 [Link]

[Link]
Description
Custom paper’s maximum height.
Type
Number (double)

128.1.9 [Link]

[Link]
Description
Custom paper’s maximum height offset.
Type
Number (double)

128.1.10 [Link]

[Link]
Description
Custom paper’s maximum width.
Type
Number (double)

128.1. Properties 711


Illustrator Scripting Guide, Release 0.0.1

128.1.11 [Link]

[Link]
Description
Custom paper’s maximum width offset.
Type
Number (double)

128.1.12 [Link]

[Link]
Description
Custom paper’s minimum height.
Type
Number (double)

128.1.13 [Link]

[Link]
Description
Custom paper’s minimum height offset.
Type
Number (double)

128.1.14 [Link]

[Link]
Description
Custom paper’s minimum width.
Type
Number (double)

712 Chapter 128. PrinterInfo


Illustrator Scripting Guide, Release 0.0.1

128.1.15 [Link]

[Link]
Description
Custom paper’s minimum width offset.
Type
Number (double)

128.1.16 [Link]

[Link]
Description
The list of supported paper sizes.
Type
Array of Paper

128.1.17 [Link]

[Link]
Description
The PostScript Language level.
Type
PrinterPostScriptLevelEnum

128.1.18 [Link]

[Link]
Description
The printer type.
Type
PrinterTypeEnum

128.1. Properties 713


Illustrator Scripting Guide, Release 0.0.1

128.1.19 [Link]

[Link]
Description
The class name of the object.
Type
String; read-only.

128.2 Example

128.2.1 Finding available printers

// Displays a list of available printers in a new text frame


var docRef = [Link]();
var iCount = [Link];

var textRef = [Link]();


[Link] += "Printers...\r";

for (var i = 0; i < iCount; i++) {


[Link] += printerList[i].name;
[Link] += "\r\t";
}

[Link] = 600;
[Link] = 200;

redraw();

714 Chapter 128. PrinterInfo


CHAPTER

NINE

PRINTFLATTENEROPTIONS

new PrintFlattenerOptions()
Description
Contains flattening options for use when Illustrator outputs artwork that contains transparency into a non-native format.

129.1 Properties

129.1.1 [Link]

[Link]
Description
If true, complex regions should be clipped.
Default: false
Type
Boolean

129.1.2 [Link]

[Link]
Description
If true, convert all strokes to outlines.
Default: false
Type
Boolean

715
Illustrator Scripting Guide, Release 0.0.1

129.1.3 [Link]

[Link]
Description
If true, all text is converted to vector paths; preserves the visual appearance of type.
Default: false
Type
Boolean

129.1.4 [Link]

[Link]
Description
The flattening balance.
Range: 0.0 to 100.0.
Default: 100.0
Type
Number (long)

129.1.5 [Link]

[Link]
Description
The gradient resolution in dots per inch (dpi).
Range: 1.0 to 9600.0.
Default: 300.0
Type
Number (double)

129.1.6 [Link]

[Link]
Description
Whether to preserve, discard, or simulate overprinting.
Default: [Link]
Type

716 Chapter 129. PrintFlattenerOptions


Illustrator Scripting Guide, Release 0.0.1

PDFOverprint

129.1.7 [Link]

[Link]
Description
The rasterization resolution in dots per inch (dpi). Range: 1.0 to 9600.0.
Default: 300.0
Type
Number (double)

129.1.8 [Link]

[Link]
Description
The class name of the object.
Type
String; read-only.

129.2 Example

129.2.1 Setting print flattening

// Creates a new document, adds symbols to the document


// then prints with a range of flattener balance settings
var docRef = [Link]();
var y = [Link] - 30;

for (var i = 0; i < ([Link]); i++) {


symbolRef = [Link][i];

symbolItemRef1 = [Link](symbolRef);
[Link] = y;
[Link] = 100;

y -= ([Link] + 10);
}

redraw();
(continues on next page)

129.2. Example 717


Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)

// Create PrintFlattenerOptions object and assign to a PrintOptions object


var flatOpts = new PrintFlattenerOptions();
var printOpts = new PrintOptions();
[Link] = flatOpts;

// Set other print options


[Link] = true;
[Link] = 360;
[Link] = 360;

// Print the current document with flattening balance increments of 20


for (var i = 0; i <= 100; i += 20) {
[Link] = i;
[Link](printOpts);
}

718 Chapter 129. PrintFlattenerOptions


CHAPTER

PRINTFONTOPTIONS

new PrintFontOptions()
Description
Contains information about font downloading and substitution for the fonts used for printing the document.

130.1 Properties

130.1.1 [Link]

[Link]
Description
The font download mode.
Default: [Link]
Type
PrintFontDownloadMode

130.1.2 [Link]

[Link]
Description
The font substitution policy.
Default: [Link]
Type
FontSubstitutionPolicy

719
Illustrator Scripting Guide, Release 0.0.1

130.1.3 [Link]

[Link]
Description
The class name of the object.
Type
String, read-only.

130.2 Example

130.2.1 Printing with font options

// Creates a new document, adds text then prints with specified font options.
var docRef = [Link]();

var pathRef = [Link](500, 300, 400, 400);


var textRef = [Link](pathRef);
[Link] = "Text example";

//Create PrintFontOptions object and assign to a PrintOptions object


var fontOpts = new PrintFontOptions();
var printOpts = new PrintOptions();
[Link] = fontOpts;

// Set some font options


[Link] = [Link];
[Link] = [Link];

// print it
[Link](printOpts);

720 Chapter 130. PrintFontOptions


CHAPTER

ONE

PRINTJOBOPTIONS

new PrintJobOptions()
Description
Contains information about how the job is to be printed.

131.1 Properties

131.1.1 [Link]

[Link]
Description
The artboard range to be printed if printAllArtboards is false.
Default: 1-
Type
String

131.1.2 [Link]

[Link]
Description
The bitmap resolution. Minimum: 0.0.
Default: 0.0
Type
Number (double)

721
Illustrator Scripting Guide, Release 0.0.1

131.1.3 [Link]

[Link]
Description
If true, collate print pages.
Default: false
Type
Boolean

131.1.4 [Link]

[Link]
Description
The number of copies to print. Minimum: 1.
Default: 1
Type
Number (long)

131.1.5 [Link]

[Link]
Description
The layers/objects to be printed.
Default: [Link]
Type
PrintArtworkDesignation

131.1.6 [Link]

[Link]
Description
The file to which to print.
Type
File

722 Chapter 131. PrintJobOptions


Illustrator Scripting Guide, Release 0.0.1

131.1.7 [Link]

[Link]
Description
The print job name.
Type
String

131.1.8 [Link]

[Link]
Description
Indicates whether to print all artboards.
Default: true
Type
Boolean

131.1.9 [Link]

[Link]
Description
The printing bounds.
Default: [Link]
Type
PrintingBounds

131.1.10 [Link]

[Link]
Description
If true, print as bitmap.
Default: false
Type
Boolean

131.1. Properties 723


Illustrator Scripting Guide, Release 0.0.1

131.1.11 [Link]

[Link]
Description
If true, print pages in reverse order.
Default: false
Type
Boolean

131.1.12 [Link]

[Link]
Description
Read-only. The class name of the object.
Type
String

131.2 Example

131.2.1 Printing with job options

// Creates a new document with layers containing visible, printable,


// non visible and non printable items then prints with each designation
// to view effects of using different job options

var docRef = [Link]();


var textRef_0 = [Link][0].[Link]();
textRef_0.contents = "Visible and Printable";
textRef_0.top = 600;
textRef_0.left = 200;

var layerRef_1 = [Link]();


var textRef_1 = layerRef_1.[Link]();
textRef_1.contents = "Visible and Non-Printable";
textRef_1.top = 500;
textRef_1.left = 250;
layerRef_1.printable = false;

var layerRef_2 = [Link]();


var textRef_2 = layerRef_2.[Link]();
textRef_2.contents = "Non-Visible";
textRef_2.top = 400;
(continues on next page)

724 Chapter 131. PrintJobOptions


Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)


textRef_2.left = 300;
layerRef_2.visible = false;
redraw();

// Print with various job options


var printJobOptions = new PrintJobOptions();
var options = new PrintOptions();
[Link] = printJobOptions;

[Link] = [Link];
[Link] = true;
[Link](options);

[Link] = false;
[Link] = [Link];
[Link] = false;
[Link](options);

[Link] = [Link];
var docPath = new File("~/[Link]");
[Link] = docPath;
[Link](options);

131.2. Example 725


Illustrator Scripting Guide, Release 0.0.1

726 Chapter 131. PrintJobOptions


CHAPTER

TWO

PRINTOPTIONS

new PrintOptions()
Description
Contains information about all printing options including flattening, color management, coordinates, fonts, and paper.

132.1 Properties

132.1.1 [Link]

[Link]
Description
The printing color management options.
Type
PrintColorManagementOptions

132.1.2 [Link]

[Link]
Description
The printing color separation options.
Type
PrintColorSeparationOptions

727
Illustrator Scripting Guide, Release 0.0.1

132.1.3 [Link]

[Link]
Description
The printing coordinate options.
Type
PrintCoordinateOptions

132.1.4 [Link]

[Link]
Description
The printing flattener options.
Type
PrintFlattenerOptions

132.1.5 [Link]

[Link]
Description
The transparency flattener preset name.
Type
String

132.1.6 [Link]

[Link]
Description
The printing font options.
Type
PrintFontOptions

728 Chapter 132. PrintOptions


Illustrator Scripting Guide, Release 0.0.1

132.1.7 [Link]

[Link]
Description
The printing job options.
Type
PrintJobOptions

132.1.8 [Link]

[Link]
Description
The printing page marks options.
Type
PrintPageMarksOptions

132.1.9 [Link]

[Link]
Description
The paper options.
Type
PrintPaperOptions

132.1.10 [Link]

[Link]
Description
The printing PostScript options.
Type
PrintPostScriptOptions

132.1. Properties 729


Illustrator Scripting Guide, Release 0.0.1

132.1.11 [Link]

[Link]
Description
The PPD name.
Type
String

132.1.12 [Link]

[Link]
Description
The printer name.
Type
String

132.1.13 [Link]

[Link]
Description
The print style.
Type
String

132.2 Example

132.2.1 Setting print options

// Creates a new document, adds symbols, specifies a variety of print options,


// assigns each print option to a PrintOptions object,
// then prints with those options
// Create a new document and add some symbol items
var docRef = [Link]();
var y = [Link] - 30;

for (var i = 0; i < ([Link]); i++) {


symbolRef = [Link][i];

(continues on next page)

730 Chapter 132. PrintOptions


Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)


symbolItemRef1 = [Link](symbolRef);
[Link] = y;

[Link] = 100;

y -= ([Link] + 10);
}

redraw();

// Create multiple options and assign to PrintOptions


var options = new PrintOptions();

var colorOptions = new PrintColorManagementOptions();


[Link] = "ColorMatch RGB";
[Link] = [Link];
[Link] = colorOptions;

var printJobOptions = new PrintJobOptions();


[Link] = [Link];
[Link] = true;

[Link] = printJobOptions;

var coordinateOptions = new PrintCoordinateOptions();


[Link] = true;
[Link] = coordinateOptions;

var flatOpts = new PrintFlattenerOptions();


[Link] = true;
[Link] = 60;

[Link] = 60;
[Link] = flatOpts;

// Print with options


[Link](options);

132.2. Example 731


Illustrator Scripting Guide, Release 0.0.1

732 Chapter 132. PrintOptions


CHAPTER

THREE

PRINTPAGEMARKSOPTIONS

new PrintPageMarksOptions()
Description
The options for printing page marks.

133.1 Properties

133.1.1 [Link]

[Link]
Description
The bleed offset rectangle.
Type
Array of 4 numbers

133.1.2 [Link]

[Link]
Description
If true, enable printing of color bars.
Default: false
Type
Boolean

733
Illustrator Scripting Guide, Release 0.0.1

133.1.3 [Link]

[Link]
Description
The page marks offset rectangle.
Type
Array of 4 numbers

133.1.4 [Link]

[Link]
Description
If true, page info marks printing is enabled.
Default: false
Type
Boolean

133.1.5 [Link]

[Link]
Description
The page marks style.
Default: [Link]
Type
PageMarksTypes

133.1.6 [Link]

[Link]
Description
If true, registration marks should be printed.
Default: false
Type
Boolean

734 Chapter 133. PrintPageMarksOptions


Illustrator Scripting Guide, Release 0.0.1

133.1.7 [Link]

[Link]
Description
If true, trim marks should be printed.
Default: false
Type
Boolean

133.1.8 [Link]

[Link]
Description
Stroke weight of trim marks. Minimum: 0.0.
Default: 0.125
Type
Number (double)

133.1.9 [Link]

[Link]
Description
The class name of the object.
Type
String; read-only.

133.2 Example

133.2.1 Setting page mark printing options

// Creates a PrintPageMarksOptions object, assigns it


// to a PrintOptions object, then prints the current document.
var docRef = activeDocument;
var pageMarkOptions= new PrintPageMarksOptions();

var options = new PrintOptions();


[Link] = pageMarkOptions;
(continues on next page)

133.2. Example 735


Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)

[Link] = true;
[Link] = true;
[Link] = true;
[Link] = true;

[Link](options);

736 Chapter 133. PrintPageMarksOptions


CHAPTER

FOUR

PRINTPAPEROPTIONS

new PrintPaperOptions()
Description
Information about the paper to be used in the print job.

134.1 Properties

134.1.1 [Link]

[Link]
Description
The custom height (in points) for using the custom paper.
Default: 0.0
Type
Number (double)

134.1.2 [Link]

[Link]
Description
The paper’s name.
Type
String

737
Illustrator Scripting Guide, Release 0.0.1

134.1.3 [Link]

[Link]
Description
Custom offset (in points) for using the custom paper.
Default: 0.0
Type
Number (double)

134.1.4 [Link]

[Link]
Description
If true, transverse the artwork (rotate 90 degrees) on the custom paper.
Default: false
Type
Boolean

134.1.5 [Link]

[Link]
Description
The class name of the object.
Type
String; read-only.

134.1.6 [Link]

[Link]
Description
The custom width (in points) for using the custom paper.
Default: 0.0
Type
Number (double)

738 Chapter 134. PrintPaperOptions


Illustrator Scripting Guide, Release 0.0.1

134.2 Example

134.2.1 Setting print paper options

// Creates a new document, adds a path item, applies a graphic style


// then prints with specified paper options
var docRef = [Link]();
var pathRef = [Link](600, 200, 200, 200);
[Link][1].applyTo(pathRef);

var paperOpts = new PrintPaperOptions;


var printOpts = new PrintOptions;
[Link] = paperOpts;

var printerCount = [Link];


if (printerCount > 0) {

// Print with the 1st paper from the 1st printer


for (var i = 0; i < [Link]; i++) {

if (printerList[i].[Link] > 0) {
var printerRef = printerList[i];
}

var paperRef = [Link][0];


if ([Link] > 0){
[Link] = [Link];
[Link] = [Link];
[Link](printOpts);
}
}
}

134.2. Example 739


Illustrator Scripting Guide, Release 0.0.1

740 Chapter 134. PrintPaperOptions


CHAPTER

FIVE

PRINTPOSTSCRIPTOPTIONS

new PrintPostScriptOptions()
Description
Options for printing to a PostScript printer.

135.1 Properties

135.1.1 [Link]

[Link]
Description
If true, printing should be in binary mode.
Default: false
Type
Boolean

135.1.2 [Link]

[Link]
Description
If true, use PostScript Level 1-compatible gradient and gradient mesh printing.
Default: false
Type
Boolean

741
Illustrator Scripting Guide, Release 0.0.1

135.1.3 [Link]

[Link]
Description
If true, force continuous tone.
Default: false
Type
Boolean

135.1.4 [Link]

[Link]
Description
The image compression type.
Default: [Link]
Type
PostScriptImageCompressionType

135.1.5 [Link]

[Link]
Description
If true, print in negative mode.
Default: false
Type
Boolean

135.1.6 [Link]

[Link]
Description
The PostScript language level.
Default: PrinterPostScriptLevelEnum.LEVEL2
Type
PrinterPostScriptLevelEnum

742 Chapter 135. PrintPostScriptOptions


Illustrator Scripting Guide, Release 0.0.1

135.1.7 [Link]

[Link]
Description
The shading resolution. Range: 1.0 to 9600.0
Default: 300.0
Type
Number (double)

135.1.8 [Link]

[Link]
Description
Read-only. The class name of the object.
Type
String

135.2 Example

135.2.1 Setting PostScript printing options

// Prints current document with various postscript levels


// Create new postscript options object, assign to print options
var psOpts = new PrintPostScriptOptions();

var printOpts = new PrintOptions();


[Link] = psOpts;

// Assign PS level, print


[Link] = PrinterPostScriptLevelEnum.PSLEVEL2;
[Link](printOpts);

[Link] = PrinterPostScriptLevelEnum.PSLEVEL3;
[Link](printOpts);

135.2. Example 743


Illustrator Scripting Guide, Release 0.0.1

744 Chapter 135. PrintPostScriptOptions


CHAPTER

SIX

RASTEREFFECTOPTIONS

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

136.1 Properties

136.1.1 [Link]

[Link]
Description
If true, the image should be antialiased.
Default: false
Type
Boolean

136.1.2 [Link]

[Link]
Description
If true, a clipping mask is created for the image.
Default: false
Type
Boolean

745
Illustrator Scripting Guide, Release 0.0.1

136.1.3 [Link]

[Link]
Description
The color model for the rasterization.
Default: [Link]
Type
RasterizationColorModel

136.1.4 [Link]

[Link]
Description
If true, all spot colors are converted to process colors for the image.
Default: false
Type
Boolean

136.1.5 [Link]

[Link]
Description
The amount of white space (in points) to be added around the object during rasterization.
Default: .0
Type
Number (double)

136.1.6 [Link]

[Link]
Description
The rasterization resolution in dots per inch (dpi). Range: 72.0 to 2400.0.
Default: 300.0
Type
Number (double)

746 Chapter 136. RasterEffectOptions


Illustrator Scripting Guide, Release 0.0.1

136.1.7 [Link]

[Link]
Description
If true, the image should use transparency.
Default: false
Type
Boolean

136.1. Properties 747


Illustrator Scripting Guide, Release 0.0.1

748 Chapter 136. RasterEffectOptions


CHAPTER

SEVEN

RASTERITEMS

[Link]
Description
A collection of RasterItem objects.

137.1 Properties

137.1.1 [Link]

[Link]
Description
Number of elements in the collection.
Type
Number, read-only.

137.1.2 [Link]

[Link]
Description
The object’s container.
Type
Object, read-only.

749
Illustrator Scripting Guide, Release 0.0.1

137.1.3 [Link]

[Link]
Description
The class name of the object.
Type
String, read-only.

137.2 Methods

137.2.1 [Link]()

[Link](name)
Description
Get the first element in the collection with the provided name.
Parameters

Parameter Type Description


name String Name of element to get

Returns
SymbolItem

137.2.2 [Link]()

[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number String or number key

Returns
SymbolItem

750 Chapter 137. RasterItems


Illustrator Scripting Guide, Release 0.0.1

137.2.3 [Link]()

[Link]()
Description
Deletes all elements in the collection.
Returns
Nothing.

137.3 Example

137.3.1 Creating a raster item

// Creates a new raster item in a new document from a raster file


// jpgFilePath contains the full path and file name of a jpg file
function createRasterItem(jpgFilePath) {
var rasterFile = File(jpgFilePath);
var myDoc = [Link]();

var myPlacedItem = [Link]();


[Link] = rasterFile;
[Link] = Array(0, [Link]);
[Link]();
}

137.3.2 Finding and examining a raster item

// Examines the color space of the first raster item in the document and displays
// result in ESTK console
if ([Link] > 0 && [Link] > 0) {
var rasterArt = [Link][0];

switch ([Link]) {
case [Link]:
$.writeln("The color space of the first raster item is CMYK");
break;

case [Link]:
$.writeln("The color space of the first raster item is RGB");
break;

case [Link]:
$.writeln("The color space of the first raster item is GRAYSCALE");
break;
}
}

137.3. Example 751


Illustrator Scripting Guide, Release 0.0.1

752 Chapter 137. RasterItems


CHAPTER

EIGHT

RASTERIZEOPTIONS

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

138.1 Properties

138.1.1 [Link]

[Link]
Description
The type of antialiasing method.
Default: [Link]
Type
AntiAliasingMethod

138.1.2 [Link]

[Link]
Description
If true, the rasterization is done against a black background (instead of white).
Default: false
Type
Boolean

753
Illustrator Scripting Guide, Release 0.0.1

138.1.3 [Link]

[Link]
Description
If true, a clipping mask should be created for the image.
Default: false
Type
Boolean

138.1.4 [Link]

[Link]
Description
The color model for the rasterization.
Default: [Link]
Type
RasterizationColorModel

138.1.5 [Link]

[Link]
Description
If true, spot colors should be converted to process colors for the image.
Default: false
Type
Boolean

138.1.6 [Link]

[Link]
Description
If true, all text is converted to outlines before rasterization.
Default: false
Type
Boolean

754 Chapter 138. RasterizeOptions


Illustrator Scripting Guide, Release 0.0.1

138.1.7 [Link]

[Link]
Description
If true, the resulting image incorporates layer attributes (like opacity and blend mode).
Default: false
Type
Boolean

138.1.8 [Link]

[Link]
Description
The amount of white space (in points) to be added around the object during rasterization.
Default: .0
Type
Number (double)

138.1.9 [Link]

[Link]
Description
The rasterization resolution in dots per inch (dpi). Range: 72.0 to 2400.0.
Default: 300.0
Type
Number (double)

138.1.10 [Link]

[Link]
Description
If true, the image should use transparency.
Default: false
Type
Boolean

138.1. Properties 755


Illustrator Scripting Guide, Release 0.0.1

756 Chapter 138. RasterizeOptions


CHAPTER

NINE

SCREEN

PPDFileList[index].[Link][index
Description
Associates a color separation screen with information to be used for printing.

139.1 Properties

139.1.1 [Link]

PPDFileList[index].[Link][index].name
Description
The color separation screen name.
Type
String

139.1.2 [Link]

PPDFileList[index].[Link][index].screenInfo
Description
The color separation screen information.
Type
ScreenInfo

757
Illustrator Scripting Guide, Release 0.0.1

139.1.3 [Link]

PPDFileList[index].[Link][index].typename
Description
The class name of the referenced object.
Type
String; read-only.

758 Chapter 139. Screen


CHAPTER

SCREENINFO

PPDFileList[index].[Link][index].screenInfo
Description
Contains information about the angle and frequency of the color separation screen to be used for printing.

140.1 Properties

140.1.1 [Link]

PPDFileList[index].[Link][index].[Link]
Description
The screen’s angle in degrees.
Type
Number (double).

140.1.2 [Link]

PPDFileList[index].[Link][index].[Link]
Description
If true, it is the default screen.
Type
Boolean.

759
Illustrator Scripting Guide, Release 0.0.1

140.1.3 [Link]

PPDFileList[index].[Link][index].[Link]
Description
The screen’s frequency.
Type
Number (double).

140.1.4 [Link]

PPDFileList[index].[Link][index].[Link]
Description
The class name of the referenced object.
Type
String; read-only.

140.2 Example

140.2.1 Getting screen information

// Displays in a new text frame, the name, angle and frequency


// of each screen list item
var sInfo = "";
var docRef = [Link]();
if ([Link] == 0) {
sInfo = "\r\t\tEmpty PPDFileList";
} else {
var ppdRef = PPDFileList[0];
var ppdInfoRef = [Link];
sInfo += "\r\t\tScreen Objects for 1st PPD File:\r";
sInfo += "\t\t" + [Link];

var iScreens = [Link];


if (iScreens > 0) {
for (var c = 0; c < iScreens; c++) {

var screenRef = [Link][c];


sInfo += "\r\t\t";
sInfo += [Link];

var screenInfoRef = [Link];

(continues on next page)

760 Chapter 140. ScreenInfo


Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)


sInfo += ", Angle = ";
sInfo += [Link];

sInfo += ", Frequency = ";


sInfo += [Link];
sInfo += "\r";
}
} else {
sInfo += "\r\t\tEmpty ScreenList";
}
}

var textRef = [Link]();


[Link] = 12;
[Link] = sInfo;
[Link] = 600;
[Link] = 30;

redraw();

140.2. Example 761


Illustrator Scripting Guide, Release 0.0.1

762 Chapter 140. ScreenInfo


CHAPTER

ONE

SCREENSPOTFUNCTION

PPDFileList[index].[Link][index
Description
Contains information about a color separation screen spot function, including its definition in PostScript language code.

141.1 Properties

141.1.1 [Link]

PPDFileList[index].[Link][index].name
Description
The color separation screen spot function name.
Type
String

141.1.2 [Link]

PPDFileList[index].[Link][index].spotFunction
Description
The spot function expressed in PostScript commands.
Type
String

763
Illustrator Scripting Guide, Release 0.0.1

141.1.3 [Link]

PPDFileList[index].[Link][index].typename
Description
The class name of the referenced object.
Type
String; read-only.

141.2 Example

141.2.1 Finding screen spot functions

// Displays in a new text frame, the screen spot functions for the 1st PPD file.
var docRef = [Link]();
var sInfo = "";
if ([Link] == 0) {
sInfo = "\r\t\tEmpty PPDFileList"
} else {
var ppdRef = PPDFileList[0];
var ppdInfoRef = [Link];

var sInfo = "\r\t\tScreenSpotFunctions for 1st PPD File:\r";


sInfo += "\t\t" + [Link] + "\r";

var iScreenSpots = [Link];


if (iScreenSpots > 0) {
for (var n = 0; n < iScreenSpots; n++) {
var screenSpotRef = [Link][n];
sInfo += "\t\t";

sInfo += [Link];
sInfo += ", spotFunction: ";

sInfo += [Link];
sInfo += "\r";
}
} else {
sInfo += "\t\tEmpty ScreenSpotFunctionList";
}
}

var textRef = [Link]();


[Link] = 12;
[Link] = sInfo;
[Link] = 600;
[Link] = 30;

redraw();

764 Chapter 141. ScreenSpotFunction


CHAPTER

TWO

SPOT

[Link][index
Description
A custom color definition contained in a SpotColor object.
If no properties are specified when creating a spot, default values are provided.
However, if specifying the color, you must use the same color space as the document, either CMYK or RGB. Otherwise,
an error results.
The new spot is added to the end of the swatches list in the Swatches palette.

142.1 Properties

142.1.1 [Link]

[Link][index].color
Description
The color information for this spot color.
Type
Color

142.1.2 [Link]

[Link][index].colorType
Description
The color model for this custom color.
Type
ColorModel

765
Illustrator Scripting Guide, Release 0.0.1

142.1.3 [Link]

[Link][index].name
Description
The spot color’s name.
Type
String

142.1.4 [Link]

[Link][index].parent
Description
The document that contains this spot color.
Type
Document; read-only.

142.1.5 [Link]

[Link][index].spotKind
Description
The kind of spot color (RGB, CMYK or LAB). This is the name of the color kind contained in the spot object.
Type
SpotColorKind; read-only.

142.1.6 [Link]

[Link][index].typename
Description
The class name of the referenced object.
Type
String; read-only.

766 Chapter 142. Spot


Illustrator Scripting Guide, Release 0.0.1

142.2 Methods

142.2.1 [Link]()

[Link][index].getInternalColor()
Description
Gets the internal color of a spot.
Returns
Color components.

142.2.2 [Link]()

[Link][index].remove()
Description
Deletes this object.
Returns
Nothing.

142.3 Example

142.3.1 Creating a new spot color

// Creates a new spot color in the current document, then applies an 80% tint to the␣
˓→color

if ( [Link] > 0 ) {
var doc = [Link];

// Create the new spot


var newSpot = [Link]();

// Define the new color value


var newColor = new CMYKColor();
[Link] = 35;
[Link] = 0;
[Link] = 50;
[Link] = 0;

// Define a new SpotColor with an 80% tint


// of the new Spot's color. The spot color can then
// be applied to an art item like any other color.
[Link] = "Pea-Green";
[Link] = [Link];
(continues on next page)

142.2. Methods 767


Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)


[Link] = newColor;

var newSpotColor = new SpotColor();


[Link] = newSpot;
[Link] = 80;
}

768 Chapter 142. Spot


CHAPTER

THREE

SPOTS

[Link]
Description
A collection of SpotColor objects in a document.

143.1 Properties

143.1.1 [Link]

[Link]
Description
Number of elements in the collection.
Type
Number, read-only.

143.1.2 [Link]

[Link]
Description
The object’s container.
Type
Object, read-only.

769
Illustrator Scripting Guide, Release 0.0.1

143.1.3 [Link]

[Link]
Description
The class name of the object.
Type
String, read-only.

143.2 Methods

143.2.1 [Link]()

[Link]()
Description
Creates a new object.
Returns
Spot

143.2.2 [Link]()

[Link](name)
Description
Get the first element in the collection with the provided name.
Parameters

Parameter Type Description


name String Name of element to get

Returns
Spot

770 Chapter 143. Spots


Illustrator Scripting Guide, Release 0.0.1

143.2.3 [Link]()

[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number Key of element to get

Returns
Spot

143.2.4 [Link]()

[Link]()
Description
Deletes all elements in the collection.
Returns
Nothing.

143.3 Example

143.3.1 Removing spot colors

// Deletes all spots colors from the current document


if ( [Link] > 0 ) {
var spotCount = [Link];

if (spotCount > 0) {
[Link]();
}
}

143.3. Example 771


Illustrator Scripting Guide, Release 0.0.1

143.3.2 Creating and applying spot colors

// Defines and applies a new spot color in the current document,


// then applies the color to the first path item
if ([Link] > 0 && [Link] > 0) {
// Define the new color value
var newRGBColor = new RGBColor();
[Link] = 255;
[Link] = 0;
[Link] = 0;

// Create the new spot


var newSpot = [Link]();

// Define the new SpotColor as 80% of the RGB color


[Link] = "Scripted Red spot";
[Link] = 80;
[Link] = newRGBColor;

// Apply a 50% tint of the new spot color to the frontmost path item.
// Create a spotcolor object, set the tint value,
var newSpotColor = new SpotColor();
[Link] = newSpot;
[Link] = 50;

// Use the spot color to set the fill color


var frontPath = [Link][0];
[Link] = true;
[Link] = newSpotColor;
}

772 Chapter 143. Spots


CHAPTER

FOUR

STORY

story
Description
A contiguous block of text as specified by a text range. A story can contain one or more text frames; if there is more
than one, the multiple text frames are linked together to form a single story.

144.1 Properties

144.1.1 [Link]

[Link]
Description
All the characters in this story.
Type
Characters; read-only.

144.1.2 [Link]

[Link]
Description
All the insertion points in this story.
Type
InsertionPoints; read-only.

773
Illustrator Scripting Guide, Release 0.0.1

144.1.3 [Link]

[Link]
Description
The number of characters in the story.
Type
Number (long); read-only.

144.1.4 [Link]

[Link]
Description
All the lines in this story.
Type
Lines; read-only.

144.1.5 [Link]

[Link]
Description
All the paragraphs in this story.
Type
Paragraphs; read-only.

144.1.6 [Link]

[Link]
Description
The object’s container.
Type
Object; read-only.

774 Chapter 144. Story


Illustrator Scripting Guide, Release 0.0.1

144.1.7 [Link]

[Link]
Description
The text frame items in this story.
Type
TextFrameItems; read-only.

144.1.8 [Link]

[Link]
Description
The text range of the story.
Type
TextRange; read-only.

144.1.9 [Link]

[Link]
Description
All the text ranges in the story.
Type
TextRanges; read-only.

144.1.10 [Link]

[Link]
Description
The selected text ranges in the story.
Type
Array of TextRange; read-only.

144.1. Properties 775


Illustrator Scripting Guide, Release 0.0.1

144.1.11 [Link]

[Link]
Description
The class name of the object.
Type
String; read-only.

144.1.12 [Link]

[Link]
Description
All the words in the story.
Type
Words; read-only.

144.2 Example

144.2.1 Threading text frames into stories

// Creates 1 story that flows through 2 text frames and another story that
// is displayed in a 3rd text frame
// Create a new document and add 2 area TextFrames
var docRef = [Link]();
var itemRef1 = [Link](600, 200, 50, 30);
var textRef1 = [Link](itemRef1);
[Link] = true;

// create 2nd text frame and link it the first


var itemRef2 = [Link](550, 300, 50, 200);
var textRef2 = [Link](itemRef2, [Link],␣
˓→textRef1);

[Link] = true;

// Add enough text to the 1st TextFrame to


// cause it to flow to the 2nd TextFrame.
[Link] = "This is two text frames linked together as one story";
redraw();

// Create a 3rd text frame and count the stories


var textRef3 = [Link]();
[Link] = "Each unlinked textFrame adds a new story."
(continues on next page)

776 Chapter 144. Story


Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)


[Link] = 650;
[Link] = 200;

redraw();

144.2. Example 777


Illustrator Scripting Guide, Release 0.0.1

778 Chapter 144. Story


CHAPTER

FIVE

STORIES

stories
Description
A collection of Story objects in a document.

145.1 Properties

145.1.1 [Link]

[Link]
Description
The number of elements in the collection.
Type
Number; read-only.

145.1.2 [Link]

[Link]
Description
The object’s container.
Type
Object; read-only.

779
Illustrator Scripting Guide, Release 0.0.1

145.1.3 [Link]

[Link]
Description
The class name of the referenced object.
Type
String; read-only.

145.2 Methods

145.2.1 [Link]()

[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number String or number key

Returns
Story

780 Chapter 145. Stories


CHAPTER

SIX

SWATCH

[Link][index
Description
A color swatch definition contained in a document. The swatches correspond to the swatch palette in the Illustrator
user interface.
A script can create a new swatch.
The swatch can hold all types of color data, such as pattern, gradient, CMYK, RGB, gray, and spot.

146.1 Properties

146.1.1 [Link]

[Link][index].color
Description
The color information for this swatch.
Type
Color

146.1.2 [Link]

[Link][index].name
Description
The swatch’s name.
Type
String.

781
Illustrator Scripting Guide, Release 0.0.1

146.1.3 [Link]

[Link][index].parent
Description
The object that contains this swatch.
Type
Document, read-only.

146.1.4 [Link]

[Link][index].typename
Description
The class name of the object.
Type
String, read-only.

146.2 Methods

146.2.1 [Link]()

[Link][index].remove()
Description
Deletes this object.
Returns
Nothing.

146.3 Example

146.3.1 Modifying a swatch

// Changes the name of the last swatch


if ( [Link] > 0 && [Link] > 0 ) {
var lastIndex = [Link] - 1;
var lastSwatch = [Link][lastIndex];
[Link] = "TheLastSwatch";
}

782 Chapter 146. Swatch


CHAPTER

SEVEN

SWATCHES

[Link]
Description
The collection of Swatch objects in the document.

147.1 Properties

147.1.1 [Link]

[Link]
Description
Number of elements in the collection.
Type
Number, read-only.

147.1.2 [Link]

[Link]
Description
The object’s container.
Type
Object, read-only.

783
Illustrator Scripting Guide, Release 0.0.1

147.1.3 [Link]

[Link]
Description
The class name of the object.
Type
String, read-only.

147.2 Methods

147.2.1 [Link]()

[Link]()
Description
Creates a new Swatch object.
Returns
Swatch

147.2.2 [Link]()

[Link](name)
Description
Get the first element in the collection with the provided name.
Parameters

Parameter Type Description


name String Name of element to get

Returns
Swatch

784 Chapter 147. Swatches


Illustrator Scripting Guide, Release 0.0.1

147.2.3 [Link]()

[Link]()
Description
Gets selected swatches in the document.
Returns
List of Swatch

147.2.4 [Link]()

[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number Key of element to get

Returns
Swatch

147.2.5 [Link]()

[Link]()
Description
Deletes all elements in the collection.
Returns
Nothing.

147.3 Example

147.3.1 Finding and deleting a swatch

// Deletes swatch 4 from the current document


if ( [Link] > 0 ) {
if ([Link] > 4) {
var swatchToDelete = [Link][3];
[Link]();
}
}

147.3. Example 785


Illustrator Scripting Guide, Release 0.0.1

786 Chapter 147. Swatches


CHAPTER

EIGHT

SWATCHGROUP

swatchGroup
Description
A group of Swatch objects.

148.1 Properties

148.1.1 [Link]

[Link]
Description
The name of the swatch group.
Type
string

148.1.2 [Link]

[Link]
Description
The object that contains the swatch group.
Type
Object, read-only.

787
Illustrator Scripting Guide, Release 0.0.1

148.1.3 [Link]

[Link]
Description
The class name of the referenced object.
Type
String, read-only

148.2 Methods

148.2.1 [Link]()

[Link](spot)
Description
Adds a spot swatch to the swatch group.
Parameters

Parameter Type Description


spot Spot Spot to add

Returns
Nothing.

148.2.2 [Link]()

[Link](swatch)
Description
Adds a swatch to the swatch group.
Parameters

Parameter Type Description


swatch Swatch Swatch to add

Returns
Nothing.

788 Chapter 148. SwatchGroup


Illustrator Scripting Guide, Release 0.0.1

148.2.3 [Link]()

[Link]()
Description
Gets a list of all swatches in the swatch group.
Returns
List of Swatch

148.2.4 [Link]()

[Link]()
Description
Deletes this object.
Returns
Nothing.

148.2.5 [Link]()

[Link]()
Description
Deletes all elements in the collection.
Returns
Nothing.

148.2. Methods 789


Illustrator Scripting Guide, Release 0.0.1

790 Chapter 148. SwatchGroup


CHAPTER

NINE

SWATCHGROUPS

swatchGroups
Description
A collection of SwatchGroup objects.

149.1 Properties

149.1.1 [Link]

[Link]
Description
The number of objects in the collection.
Type
Number, read-only.

149.1.2 [Link]

[Link]
Description
The object’s container.
Type
Object, read-only.

791
Illustrator Scripting Guide, Release 0.0.1

149.1.3 [Link]

[Link]
Description
The class name of the object.
Type
String, read-only.

149.2 Methods

149.2.1 [Link]()

[Link]()
Description
Creates a swatch group.
Returns
SwatchGroup

149.2.2 [Link]()

[Link](name)
Description
Get the first element in the collection with the provided name.
Parameters

Parameter Type Description


name String Name of element to get

Returns
SwatchGroup

792 Chapter 149. SwatchGroups


Illustrator Scripting Guide, Release 0.0.1

149.2.3 [Link]()

[Link]()
Description
Deletes all elements in the collection.
Returns
Nothing.

149.2. Methods 793


Illustrator Scripting Guide, Release 0.0.1

794 Chapter 149. SwatchGroups


CHAPTER

SYMBOLITEMS

[Link]
Description
The collection of SymbolItem objects in the document.

150.1 Properties

150.1.1 [Link]

[Link]
Description
Number of elements in the collection.
Type
Number, read-only.

150.1.2 [Link]

[Link]
Description
The object’s container.
Type
Object, read-only.

795
Illustrator Scripting Guide, Release 0.0.1

150.1.3 [Link]

[Link]
Description
The class name of the object.
Type
String, read-only.

150.2 Methods

150.2.1 [Link]()

[Link](symbol)
Description
Creates an instance of the specified symbol.
Parameters

Parameter Type Description


symbol Symbol Symbol to instance

Returns
SymbolItem

150.2.2 [Link]()

[Link](name)
Description
Get the first element in the collection with the provided name.
Parameters

Parameter Type Description


name String Name of element to get

Returns
SymbolItem

796 Chapter 150. SymbolItems


Illustrator Scripting Guide, Release 0.0.1

150.2.3 [Link]()

[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number String or number key

Returns
SymbolItem

150.2.4 [Link]()

[Link]()
Description
Deletes all elements in the collection.
Returns
Nothing.

150.3 Example

150.3.1 Creating a symbol

// Creates a path item from each graphic style


// then adds each item as a new symbol

var docRef = [Link]();


var y = 750;
var x = 25;

var iCount = [Link];

for (var i=0; i<iCount; i++) {

var pathRef = [Link]( y, x, 20, 20 );


[Link][i].applyTo(pathRef);

// are we at bottom?
if ( (y-=60) <= 60 ) {
y = 750; // go back to the top.
(continues on next page)

150.3. Example 797


Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)


x+= 200
}

redraw();
[Link](pathRef);
}

798 Chapter 150. SymbolItems


CHAPTER

ONE

SYMBOL

[Link][index
Description
An art item that is stored in the Symbols palette, and can be reused one or more times in the document without dupli-
cating the art data. Symbols are contained in documents.
Instances of Symbol in a document are associated with SymbolItem objects, which store the art object properties.

151.1 Properties

151.1.1 [Link]

[Link][index].name
Description
The symbol’s name
Type
String.

151.1.2 [Link]

[Link][index].parent
Description
The object that contains the symbol object.
Type
Object, read-only.

799
Illustrator Scripting Guide, Release 0.0.1

151.1.3 [Link]

[Link][index].typename
Description
The class name of the object.
Type
String, read-only.

151.2 Methods

151.2.1 [Link]()

[Link][index].duplicate()
Description
Creates a duplicate of this object.
Returns
Symbol

151.2.2 [Link]()

[Link][index].remove()
Description
Deletes this object.
Returns
Nothing.

800 Chapter 151. Symbol


CHAPTER

TWO

SYMBOLS

[Link]
Description
The collection of Symbol objects in the document.

152.1 Properties

152.1.1 [Link]

[Link]
Description
Number of elements in the collection.
Type
Number, read-only.

152.1.2 [Link]

[Link]
Description
The object’s container.
Type
Object, read-only.

801
Illustrator Scripting Guide, Release 0.0.1

152.1.3 [Link]

[Link]
Description
The class name of the object.
Type
String, read-only.

152.2 Methods

152.2.1 [Link]()

[Link](sourceArt[, registrationPoint])
Description
Returns a symbol object created from the source art item, any of the following:
• CompoundPathItems
• GroupItems
• MeshItems
• NonNativeItems
• PageItems
• PathItems
• RasterItems
• SymbolItems
• TextFrameItems
The default registration point is [Link].
Parameters

Parameter Type Description


sourceArt PageItem SymbolRegistration- Source art to create symbol from Registration
registrationPoint Point, optional point to use

Returns
Symbol

802 Chapter 152. Symbols


Illustrator Scripting Guide, Release 0.0.1

152.2.2 [Link]()

[Link](name)
Description
Get the first element in the collection with the provided name.
Parameters

Parameter Type Description


name String Name of element to get

Returns
Symbol

152.2.3 [Link]()

[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number String or number key

Returns
Symbol

152.2.4 [Link]()

[Link]()
Description
Deletes all elements in the collection.
Returns
Nothing.

152.2. Methods 803


Illustrator Scripting Guide, Release 0.0.1

152.3 Example

152.3.1 Creating a symbol

// Creates a path item from each graphic style


// then adds each item as a new symbol

var docRef = [Link]();


var y = 750;
var x = 25;

var iCount = [Link];

for (var i=0; i<iCount; i++) {

var pathRef = [Link]( y, x, 20, 20 );


[Link][i].applyTo(pathRef);

// are we at bottom?
if ( (y-=60) <= 60 ) {
y = 750; // go back to the top.
x+= 200
}

redraw();
[Link](pathRef);
}

804 Chapter 152. Symbols


CHAPTER

THREE

TABSTOPINFO

[Link][index].paragraphs[index].[Link]
Description
Information about the alignment, position, and other details for a tab stop in a ParagraphAttributes object.

153.1 Properties

153.1.1 [Link]

[Link][index].paragraphs[index].[Link].
alignment
Description
The alignment of the tab stop.
Default: Left
Type
TabStopAlignment

153.1.2 [Link]

[Link][index].paragraphs[index].[Link].
decimalCharacter
Description
The character used for decimal tab stops.
Default: .
Type
String

805
Illustrator Scripting Guide, Release 0.0.1

153.1.3 [Link]

[Link][index].paragraphs[index].[Link].
leader
Description
The leader dot character.
Type
String

153.1.4 [Link]

[Link][index].paragraphs[index].[Link].
position
Description
The position of the tab stop expressed in points.
Default: 0.0
Type
Number (double)

153.1.5 [Link]

[Link][index].paragraphs[index].[Link].
typename
Description
The class name of the object.
Type
String, read-only.

153.2 Example

153.2.1 Displaying tab stop information

// Displays tab stop information found in each text frame


// of current document, if any.

var docRef = [Link];


var sData = "Tab Stops Found \\rTabStop Leader\t\tTabStop Position\r";
(continues on next page)

806 Chapter 153. TabStopInfo


Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)


var textRef = [Link];

for( var i=0 ; i < [Link]; i++ ) {


// Get all paragraphs in the textFrames
var paraRef = textRef[i].paragraphs;

for ( p=0 ; p < [Link] ; p++ ) {


// Get para attributes for all textRanges in paragraph
var attrRef = paraRef[p].paragraphAttributes;
var tabRef = [Link];

if ( [Link] > 0 ) {
for(var t=0; t<[Link]; t++){
sData += "\t" + tabRef[t].leader + "\t\t";
sData += "\t\t" + tabRef[t].position + "\r";
} // end for
} // end if
} // end for
} // end for

var newTF = [Link]();


[Link] = sData;
[Link] = 400;
[Link] = 100; redraw();

153.2. Example 807


Illustrator Scripting Guide, Release 0.0.1

808 Chapter 153. TabStopInfo


CHAPTER

FOUR

TAG

[Link][index].tags[index
Description
A label associated with a specific piece of artwork.
Tags allows you to assign an unlimited number of key-value pairs to any page item in a document.

154.1 Properties

154.1.1 [Link]

[Link][index].tags[index].name
Description
The tag’s name.
Type
String, read-only.

154.1.2 [Link]

[Link][index].tags[index].parent
Description
The object that contains this tag.
Type
Object, read-only.

809
Illustrator Scripting Guide, Release 0.0.1

154.1.3 [Link]

[Link][index].tags[index].typename
Description
The class name of the object.
Type
String, read-only.

154.1.4 [Link]

[Link][index].tags[index].value
Description
The data stored in this tag.
Type
String, read-only.

154.2 Methods

154.2.1 [Link]()

[Link][index].tags[index].remove()
Description
Deletes this object.
Returns
Nothing.

154.3 Example

154.3.1 Using tags

// Finds the tags associated with the selected art item,


// show names and values in a separate document

if ( [Link] > 0 ) {
doc = [Link];

if ( [Link] > 0 ) {
for ( i = 0; i < [Link]; i++ ) {
selectedArt = selection[0];
(continues on next page)

810 Chapter 154. Tag


Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)


tagList = [Link];

if ([Link] == 0) {
var tempTag = [Link]();
[Link] = "OneWord";
[Link] = "anything you want";
}

// Create a document and add a line of text per tag


reportDocument = [Link]();
top_offset = 400;

for ( i = 0; i < [Link]; i++ ) {


tagText = tagList[i].value;
newItem = [Link]();
[Link] = "Tag: (" + tagList[i].name + " , " + tagText + ")";
[Link] = Array(100, top_offset);
[Link] = 24;
top_offset = top_offset - 20;
}
}
}
}

154.3. Example 811


Illustrator Scripting Guide, Release 0.0.1

812 Chapter 154. Tag


CHAPTER

FIVE

TAGS

[Link][index].tags
Description
A collection of Tag objects.

155.1 Properties

155.1.1 [Link]

[Link][index].[Link]
Description
The number of elements in the collection.
Type
Number; read-only.

155.1.2 [Link]

[Link][index].[Link]
Description
The object’s container.
Type
Object; read-only.

813
Illustrator Scripting Guide, Release 0.0.1

155.1.3 [Link]

[Link][index].[Link]
Description
The class name of the referenced object.
Type
String; read-only.

155.2 Methods

155.2.1 [Link]()

[Link][index].[Link]()
Description
Creates a new Tag object.
Returns
Tag

155.2.2 [Link]()

[Link][index].[Link](name)
Description
Get the first element in the collection with the provided name.
Parameters

Parameter Type Description


name String Name of element to get

Returns
Tag

814 Chapter 155. Tags


Illustrator Scripting Guide, Release 0.0.1

155.2.3 [Link]()

[Link][index].[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number String or number key

Returns
Tag

155.2.4 [Link]()

[Link][index].[Link]()
Description
Deletes all elements in this collection.
Returns
Nothing.

155.3 Example

155.3.1 Setting tag values

// Adds tags to all RasterItems and PlacedItems in the current document


if ( [Link] > 0 ) {
var doc = [Link];

if ( [Link] + [Link] > 0 ) {


for ( i = 0; i < [Link]; i++ ) {
var imageArt = [Link][i];

if ( [Link] == "PlacedItem" || [Link] == "RasterItem") {


// Create a new Tag with the name AdobeURL and the
// value of the www link

var urlTAG = [Link]();


[Link] = "AdobeWebSite";
[Link] = "[Link]
}
}
(continues on next page)

155.3. Example 815


Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)


} else {
alert( "No placed or raster items in the document" );
}
}

816 Chapter 155. Tags


CHAPTER

SIX

TEXTFONT

[Link][index
Description
Information about a font in the document, found in a CharacterAttributes object.

156.1 Properties

156.1.1 [Link]

[Link][index].family
Description
The font’s family name.
Type
String, read-only.

156.1.2 [Link]

[Link][index].name
Description
The font’s full name.
Type
String, read-only.

817
Illustrator Scripting Guide, Release 0.0.1

156.1.3 [Link]

[Link][index].parent
Description
The object’s container.
Type
Object, read-only.

156.1.4 [Link]

[Link][index].style
Description
The font’s style name.
Type
String, read-only.

156.1.5 [Link]

[Link][index].typename
Description
The class name of the object.
Type
String, read-only.

156.2 Example

156.2.1 Setting the font of text

// Sets the font of all the text in the document to the first font
if ( [Link] > 0 ) {

// Iterate through all text art and apply font 0


for ( i = 0; i< [Link]; i++) {
textArtRange = [Link][i].textRange;
[Link] = [Link][0];
}
}

818 Chapter 156. TextFont


CHAPTER

SEVEN

TEXTFONTS

[Link]
Description
A collection of TextFont objects.

157.1 Properties

157.1.1 [Link]

[Link]
Description
The number of elements in the collection.
Type
Number; read-only.

157.1.2 [Link]

[Link]
Description
The object’s container.
Type
Object; read-only.

819
Illustrator Scripting Guide, Release 0.0.1

157.1.3 [Link]

[Link]
Description
The class name of the referenced object.
Type
String; read-only.

157.2 Methods

157.2.1 [Link]()

[Link](name)
Description
Get the first element in the collection with the provided name.
Parameters

Parameter Type Description


name String Name of element to get

Returns
TextFont

157.2.2 [Link]()

[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number String or number key

Returns
TextFont

820 Chapter 157. TextFonts


Illustrator Scripting Guide, Release 0.0.1

157.3 Example

157.3.1 Finding fonts

// Creates a new A3 sized document and display a list of available fonts until the␣
document is full.
˓→

var edgeSpacing = 10;


var columnSpacing = 230;
var docPreset = new DocumentPreset;
[Link] = 1191.0;
[Link] = 842.0

var docRef = [Link]([Link], docPreset);


var sFontNames = "";
var x = edgeSpacing;
var y = ([Link] - edgeSpacing);

var iCount = [Link];

for (var i=0; i<iCount; i++) {


sFontName = textFonts[i].name;
sFontName += " ";
sFontNames = sFontName + textFonts[i].style;

var textRef = [Link]();


[Link] = 10;
[Link] = sFontNames;
[Link] = y;
[Link] = x;

// check wether the text frame will go off the edge of the document
if ((x + [Link])> [Link]) {
[Link]();
iCount = i;
break;
} else {
// display text frame
[Link] = [Link](textFonts[i].
˓→name);

redraw();

if ((y-=([Link])) <= 20) {


y = ([Link] - edgeSpacing);
x += columnSpacing;
}
}
}

157.3. Example 821


Illustrator Scripting Guide, Release 0.0.1

822 Chapter 157. TextFonts


CHAPTER

EIGHT

TEXTFRAMEITEMS

[Link]
Description
The collection of TextFrameItem objects in the document.

158.1 Properties

158.1.1 [Link]

[Link]
Description
The number of elements in the collection.
Type
Number; read-only.

158.1.2 [Link]

[Link]
Description
The object’s container.
Type
Object; read-only.

823
Illustrator Scripting Guide, Release 0.0.1

158.1.3 [Link]

[Link]
Description
The class name of the referenced object.
Type
String; read-only.

158.2 Methods

158.2.1 [Link]()

[Link]()
Description
Creates a point text frame item.
Returns
TextFrameItem

158.2.2 [Link]()

[Link](textPath[, orientation][, baseFrame][, postFix])


Description
Creates an area text frame item.
Parameters

Parameter Type Description


textPath PathItem Path item to use
orientation TextOrientation, optional Orientation of text
baseFrame TextFrameItem, optional Text frame to use
postFix Boolean, optional Whether to prefix or postfix the text frame

Returns
TextFrameItem

824 Chapter 158. TextFrameItems


Illustrator Scripting Guide, Release 0.0.1

158.2.3 [Link]()

[Link](name)
Description
Get the first element in the collection with the provided name.
Parameters

Parameter Type Description


name String Name of element to get

Returns
TextFrameItem

158.2.4 [Link]()

[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number String or number key

Returns
TextFrameItem

158.2.5 [Link]()

[Link](textPath[,startTValue][,endTValue][,
orientation][, baseFrame][, postFix])
Description
Creates an on-path text frame item.
Parameters

Parameter Type Description


textPath PathItem Path item to use
startTValue Number (double) Start position of text along the path
endTValue Number (double) End position of text along the path
orientation TextOrientation, optional Orientation of text
baseFrame TextFrameItem, optional Text frame to use
postFix Boolean, optional Whether to prefix or postfix the text frame

158.2. Methods 825


Illustrator Scripting Guide, Release 0.0.1

Returns
TextFrameItem

158.2.6 [Link]()

[Link](anchor[, orientation])
Description
Creates a point text frame item.
Parameters

Parameter Type Description


anchor Array of 2 numbers Point text anchor
orientation TextOrientation, optional Orientation of text

Returns
TextFrameItem

158.2.7 [Link]()

[Link]()
Description
Deletes all elements in this collection.
Returns
Nothing.

158.3 Example

158.3.1 Creating and modifying text frames

// Creates a document with text frames displaying path, area and point
// text, changes the content of each frame then deletes the 2nd frame

// create a new document


var docRef = [Link]();

// create 3 new textFrames (area, line, point)


// Area Text
var rectRef = [Link](700, 50, 100, 100); var areaTextRef = docRef.
˓→[Link](rectRef); [Link] = "TextFrame #1";

(continues on next page)

826 Chapter 158. TextFrameItems


Illustrator Scripting Guide, Release 0.0.1

(continued from previous page)


[Link] = true;

// Line Text
var lineRef = [Link]();
[Link]( Array(Array(200, 700), Array(300, 550) ) ); var pathTextRef =␣
˓→[Link](lineRef); [Link] = "TextFrame #2";

[Link] = true;

// Point Text
var pointTextRef = [Link](); [Link] = "TextFrame #3";␣
˓→[Link] = 700;

[Link] = 400; [Link] = true; redraw();

// count the TextFrames


var iCount = [Link];
var sText = "There are " + iCount + " TextFrames.\r" sText += "Changing contents of each␣
˓→TextFrame.";

// change the content of each [Link][0].contents = "Area TextFrame."; docRef.


˓→textFrames[1].contents = "Path TextFrame."; [Link][2].contents = "Point␣

˓→TextFrame."; redraw();

[Link][1].remove(); redraw();

// count again

var iCount = [Link];

158.3. Example 827


Illustrator Scripting Guide, Release 0.0.1

828 Chapter 158. TextFrameItems


CHAPTER

NINE

TEXTPATH

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

159.1 Properties

159.1.1 [Link]

[Link]
Description
The area of this path in square points. If the area is negative, the path is wound counterclockwise.
Self-intersecting paths can contain sub-areas that cancel each other out, which makes this value zero even though the
path has apparent area.
Type
Number (double), read-only.

159.1.2 [Link]

[Link]
Description
The blend mode used when compositing an object.
Type
BlendModes

829
Illustrator Scripting Guide, Release 0.0.1

159.1.3 [Link]

[Link]
Description
If true, this path should be used as a clipping path.
Type
Boolean

159.1.4 [Link]

[Link]
Description
If true, this path is closed.
Type
Boolean

159.1.5 [Link]

[Link]
Description
Read-only. If true, this item is editable.
Type
Boolean

159.1.6 [Link]

[Link]
Description
If true, the even-odd rule should be used to determine insideness.
Type
Boolean

830 Chapter 159. TextPath


Illustrator Scripting Guide, Release 0.0.1

159.1.7 [Link]

[Link]
Description
The fill color of the path.
Type
Color

159.1.8 [Link]

[Link]
Description
If true, the path be filled.
Type
Boolean

159.1.9 [Link]

[Link]
Description
If true, the art beneath a filled object should be overprinted.
Type
Boolean

159.1.10 [Link]

[Link]
Description
If true, this path is a guide object.
Type
Boolean

159.1. Properties 831


Illustrator Scripting Guide, Release 0.0.1

159.1.11 [Link]

[Link]
Description
The height of the group item.
Type
Number (double)

159.1.12 [Link]

[Link]
Description
The position of the left side of the item (in points, measured from the left side of the page).
Type
Number (double)

159.1.13 [Link]

[Link]
Description
The note text assigned to the path.
Type
String

159.1.14 [Link]

[Link]
Description
The opacity of the object. Range: 0.0 to 100.0
Type
Number (double)

832 Chapter 159. TextPath


Illustrator Scripting Guide, Release 0.0.1

159.1.15 [Link]

[Link]
Description
Read-only. The parent of this object.
Type
Layer or GroupItem

159.1.16 [Link]

[Link]
Description
Read-only. The path points contained in this path item.
Type
PathPoints

159.1.17 [Link]

[Link]
Description
The polarity of the path.
Type
PolarityValues

159.1.18 [Link]

[Link]
Description
The position (in points) of the top left corner of the textPathItem object in the format [x, y]. Does not include stroke
weight.
Type
Array of 2 numbers

159.1. Properties 833


Illustrator Scripting Guide, Release 0.0.1

159.1.19 [Link]

[Link]
Description
The resolution of the path in dots per inch (dpi).
Type
Number (double)

159.1.20 [Link]

[Link]
Description
Read-only. All of the selected path points in the path.
Type
PathPoints

159.1.21 [Link]

[Link]
Description
The type of line capping.
Type
StrokeCap

159.1.22 [Link]

[Link]
Description
The stroke color for the path.
Type
Color

834 Chapter 159. TextPath


Illustrator Scripting Guide, Release 0.0.1

159.1.23 [Link]

[Link]
Description
If true, the path should be stroked.
Type
Boolean

159.1.24 [Link]

[Link]
Description
Dash lengths. Set to an empty object, {}, for a solid line.
Type
Object

159.1.25 [Link]

[Link]
Description
The default distance into the dash pattern at which the pattern should be started.
Type
Number (double)

159.1.26 [Link]

[Link]
Description
Type of joints for the path.
Type
StrokeJoin

159.1. Properties 835


Illustrator Scripting Guide, Release 0.0.1

159.1.27 [Link]

[Link]
Description
When a default stroke join is set to mitered, this property specifies when the join will be converted to beveled (squared-
off) by default. The default miter limit of 4 means that when the length of the point reaches four times the stroke weight,
the join switches from a miter join to a bevel join. A value of 1 specifies a bevel join. Range: 1 to 500. Default: 4
Type
Number (double)

159.1.28 [Link]

[Link]
Description
If true, the art beneath a stroked object should be overprinted.
Type
Boolean

159.1.29 [Link]

[Link]
Description
Width of the stroke.
Type
Number (double)

159.1.30 [Link]

[Link]
Description
The position of the top of the item (in points, measured from the bottom of the page).
Type
Number (double)

836 Chapter 159. TextPath


Illustrator Scripting Guide, Release 0.0.1

159.1.31 [Link]

[Link]
Description
Read-only. The class name of the referenced object.
Type
String

159.1.32 [Link]

[Link]
Description
The width of the item.
Type
Number (double)

159.2 Methods

159.2.1 [Link]()

[Link](pathPoints)
Description
Sets the path using the array of points specified as [x, y] coordinate pairs.
Parameters

Parameter Type Description


pathPoints Array of [x, y] coordinate pairs Path points to set path as

Returns
Nothing.

159.2. Methods 837


Illustrator Scripting Guide, Release 0.0.1

159.3 Example

838 Chapter 159. TextPath


CHAPTER

TEXTRANGE

[Link][index].textRange
Description
A range of text in a specific text art item. TextRange gives you access to the text contained in text art items.

160.1 Properties

160.1.1 [Link]

[Link][index].[Link]
Description
The character properties for the text range.
Type
CharacterAttributes, read-only.

160.1.2 [Link]

[Link][index].[Link]
Description
Offset of the first character.
Type
Number (long)

839
Illustrator Scripting Guide, Release 0.0.1

160.1.3 [Link]

[Link][index].[Link]
Description
All the characters in this text range.
Type
Characters, read-only.

160.1.4 [Link]

[Link][index].[Link]
Description
All referenced character styles in the text range.
Type
CharacterStyles, read-only.

160.1.5 [Link]

[Link][index].[Link]
Description
The text string.
Type
String

160.1.6 [Link]

[Link][index].[Link]
Description
End index of the text range.
Type
Int32

840 Chapter 160. TextRange


Illustrator Scripting Guide, Release 0.0.1

160.1.7 [Link]

[Link][index].[Link]
Description
All the insertion points in this text range.
Type
InsertionPoints, read-only.

160.1.8 [Link]

[Link][index].[Link]
Description
Controls the spacing between two characters, in thousandths of an em. An integer.
Type
Number (long)

160.1.9 [Link]

[Link][index].[Link]
Description
The length (in characters). Minimum: 0
Type
Number (long)

160.1.10 [Link]

[Link][index].[Link]
Description
All the lines in this text range.
Type
Lines, read-only.

160.1. Properties 841


Illustrator Scripting Guide, Release 0.0.1

160.1.11 [Link]

[Link][index].[Link]
Description
The paragraph properties for the text range.
Type
ParagraphAttributes, read-only.

160.1.12 [Link]

[Link][index].[Link]
Description
All the paragraphs in this text range.
Type
Paragraphs, read-only.

160.1.13 [Link]

[Link][index].[Link]
Description
All referenced paragraph styles in the text range.
Type
ParagraphStyles, read-only.

160.1.14 [Link]

[Link][index].[Link]
Description
The object’s container.
Type
TextRange, read-only.

842 Chapter 160. TextRange


Illustrator Scripting Guide, Release 0.0.1

160.1.15 [Link]

[Link][index].[Link]
Description
Start index of the text range.
Type
Int32

160.1.16 [Link]

[Link][index].[Link]
Description
The story to which the text range belongs.
Type
Story, read-only.

160.1.17 [Link]

[Link][index].[Link]
Description
All of the text in this text range.
Type
TextRanges, read-only.

160.1.18 [Link]

[Link][index].[Link]
Description
The selected text ranges in the text range.
Type
Array of TextRange, read-only.

160.1. Properties 843


Illustrator Scripting Guide, Release 0.0.1

160.1.19 [Link]

[Link][index].[Link]
Description
The class name of the object.
Type
String, read-only.

160.1.20 [Link]

[Link][index].[Link]
Description
All the words contained in this text range.
Type
Words, read-only.

160.2 Methods

160.2.1 [Link]()

[Link][index].[Link](type)
Description
Changes the capitalization of text
Parameters

Parameter Type Description


type CaseChangeType Capitalization case to change to

Returns
Nothing

844 Chapter 160. TextRange


Illustrator Scripting Guide, Release 0.0.1

160.2.2 [Link]()

[Link][index].[Link]()
Description
Deselects the text range.
Returns
Nothing.

160.2.3 [Link]()

[Link][index].[Link]([relativeObject][,
insertionLocation])
Description
Creates a duplicate of this object.
Parameters

Parameter Type Description


relativeObject Object, optional Object to duplicate to
insertionLocation ElementPlacement, optional Location to insert element

Returns
TextRange

160.2.4 [Link]()

[Link][index].[Link]()
Description
Gets json representation of character overrides.
Returns
String

160.2.5 [Link]()

[Link][index].[Link]()
Description
Gets json representation of paragraph overrides.
Returns
String

160.2. Methods 845


Illustrator Scripting Guide, Release 0.0.1

160.2.6 [Link]()

[Link][index].[Link]()
Description
Gets the length of the first paragraph of the text range.
Returns
Int32

160.2.7 [Link]()

[Link][index].[Link]()
Description
Gets the length of the first text run of the text range.
Returns
Int32

160.2.8 [Link]()

[Link][index].[Link](relativeObject, insertionLocation)
Description
Moves the object.
Parameters

Parameter Type Description


relativeObject Object Object to move element within
insertionLocation ElementPlacement, optional Location to move element to

Returns
TextRange

160.2.9 [Link]()

[Link][index].[Link]()
Description
Deletes the object.
Returns
Nothing

846 Chapter 160. TextRange


Illustrator Scripting Guide, Release 0.0.1

160.2.10 [Link]()

[Link][index].[Link]([addToDocument])
Description
Selects the text range.
Parameters

Parameter Type Description


addToDocument Boolean, optional Whether to add or replace current selection

Returns
Nothing

160.3 Example

160.3.1 Manipulating Text

// Changes size of the first character of each word in the


// current document by changing the size attribute of each character

if ( [Link] > 0 ) {
for ( i = 0; i < [Link]; i++ ) {
var text = [Link][i].textRange;
for ( j = 0 ; j < [Link]; j++ ) {
//each word is a textRange object
var textWord = [Link][j];

// Characters are textRanges too.


// Get the first character of each word and increase it's size.

var firstChars = [Link][0];


[Link] = [Link] * 1.5;
}
}
}

160.3. Example 847


Illustrator Scripting Guide, Release 0.0.1

848 Chapter 160. TextRange


CHAPTER

ONE

TEXTRANGES

textRanges
Description
A collection of TextRange objects.

161.1 Properties

161.1.1 [Link]

[Link]
Description
The number of elements in the collection.
Type
Number; read-only.

161.1.2 [Link]

[Link]
Description
The object’s container.
Type
Object; read-only.

849
Illustrator Scripting Guide, Release 0.0.1

161.1.3 [Link]

[Link]
Description
The class name of the referenced object.
Type
String; read-only.

161.2 Methods

161.2.1 [Link]()

[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number String or number key

Returns
Variable

161.2.2 [Link]()

[Link]()
Description
Deletes all elements in this collection.
Returns
Nothing.

850 Chapter 161. TextRanges


CHAPTER

TWO

TRACINGOBJECT

TracingObject
Description
A tracing object, which associates source raster art item with a vector-art plug-in group created by tracing. Scripts can
initiate tracing using [Link] or [Link]().
The resulting PluginItem object represents the vector art group, and has this object in its tracing property.
A script can force the tracing operation by calling [Link](). The operation is asynchronous, so a script
should call redraw after creating the tracing object, but before accessing its properties or expanding the tracing to
convert it to an art item group.
The read-only properties that describe the tracing result have valid values only after the first tracing operation completes.
A value of 0 indicates that the operation has not yet been completed.

162.1 Properties

162.1.1 [Link]

[Link]
Description
The number of anchors in the tracing result.
Type
Number (long); read-only.

162.1.2 [Link]

[Link]
Description
The number of areas in the tracing result.
Type
Number (long); read-only.

851
Illustrator Scripting Guide, Release 0.0.1

162.1.3 [Link]

[Link]
Description
The resolution of the source image in pixels per inch.
Type
Number (real); read-only.

162.1.4 [Link]

[Link]
Description
The object’s container.
Type
Object; read-only.

162.1.5 [Link]

[Link]
Description
The number of paths in the tracing result.
Type
Number (long); read-only.

162.1.6 [Link]

[Link]
Description
The raster art used to create the associated vector art plug-in group.
Type
PlacedItem or RasterItem

852 Chapter 162. TracingObject


Illustrator Scripting Guide, Release 0.0.1

162.1.7 [Link]

[Link]
Description
The options used to convert the raster artwork to vector art.
Type
TracingOptions

162.1.8 [Link]

[Link]
Description
The class name of the object.
Type
String; read-only.

162.1.9 [Link]

[Link]
Description
The number of colors used in the tracing result.
Type
Number (long); read-only.

162.2 Methods

162.2.1 [Link]()

[Link]([viewed])
Description
Converts the vector art into a new group item. The new GroupItem object replaces the PluginItem object in the docu-
ment.
By default, viewed is false, and the new group contains only the tracing result (the filled or stroked paths).
If viewed is true, the new group retains additional information that was specified for the viewing mode, such as
outlines and overlays.
Deletes this object and its associated PluginItem object. Any group-level attributes that were applied to the plug-in
item are applied to the top level of the new group item.

162.2. Methods 853


Illustrator Scripting Guide, Release 0.0.1

Parameters

Parameter Type Description


viewed Boolean, optional todo

Returns
GroupItem

162.2.2 [Link]()

[Link]()
Description
Reverts the artwork in the document to the original source raster art and removes the traced vector art. Returns the
original object used to create the tracing, and deletes this object and its associated PluginItem object.
Parameters
Returns
PlacedItem or RasterItem

854 Chapter 162. TracingObject


CHAPTER

THREE

TRACINGOPTIONS

[Link]
Description
A set of options used in converting raster art to vector art by tracing.

163.1 Properties

163.1.1 [Link]

[Link]
Description
The sharpness, in degrees of a turn in the original image that is considered a corner in the tracing result path.
Range: 0 to 180
Type
Number (double)

163.1.2 [Link]

[Link]
Description
If true, trace with fills. At least one of fills or strokes must be true.
Type
Boolean

855
Illustrator Scripting Guide, Release 0.0.1

163.1.3 [Link]

[Link]
Description
If true, ignores white fill color.
Type
Boolean

163.1.4 [Link]

[Link]
Description
If true, result is LivePaint art. If false, it is classic art.

Note: A script should only set this value in preparation for a subsequent expand operation. Leaving a tracing on the
artboard when this property is true can lead to unexpected application behavior.

Type
Boolean

163.1.5 [Link]

[Link]
Description
The maximum number of colors allowed for automatic palette generation.
Used only if tracingMode is [Link] or [Link].
Range: 2 to 256
Type
Number (long)

163.1.6 [Link]

[Link]
Description
The maximum stroke weight, when strokes is true.
Range: 0.01 to 100.0
Type

856 Chapter 163. TracingOptions


Illustrator Scripting Guide, Release 0.0.1

Number (double)

163.1.7 [Link]

[Link]
Description
The smallest feature, in square pixels, that is traced.
For example, if it is 4, a feature of 2 pixels wide by 2 pixels high is traced.
Type
Number (long)

163.1.8 [Link]

[Link]
Description
The minimum length in pixels of features in the original image that can be stroked, when strokes is true.
Smaller features are omitted. Range: 0.0 to 200.0. Default: 20.0
Type
Number (double)

163.1.9 [Link]

[Link]
Description
If true, named colors (swatches) are generated for each new color created by the tracing result.
Used only if tracingMode is [Link] or [Link].
Type
Boolean

163.1. Properties 857


Illustrator Scripting Guide, Release 0.0.1

163.1.10 [Link]

[Link]
Description
The name of a color palette to use for tracing. If the empty string, use the automatic palette.
Used only if tracingMode is [Link] or [Link].
Type
String

163.1.11 [Link]

[Link]
Description
The object’s container.
Type
Object, read-only.

163.1.12 [Link]

[Link]
Description
The distance between the traced shape and the original pixel shape. Lower values create a tighter path fitting.
Higher values create a looser path fitting. Range: 0.0 to 10.0
Type
Number (double)

163.1.13 [Link]

[Link]
Description
The amount of blur used during preprocessing, in pixels. Blurring helps reduce small artifacts and smooth jagged edges
in the tracing result. Range: 0.0 to 2.0
Type
Number (double)

858 Chapter 163. TracingOptions


Illustrator Scripting Guide, Release 0.0.1

163.1.14 [Link]

[Link]
Description
The name of a preset file containing these options.
Type
String, read-only.

163.1.15 [Link]

[Link]
Description
If true, resample when tracing. (This setting is not captured in a preset file.)
Always true when the raster source art is placed or linked.
Type
Boolean

163.1.16 [Link]

[Link]
Description
The resolution to use when resampling in pixels per inch (ppi).
Lower resolution increases the speed of the tracing operation. (This setting is not captured in a preset file.)
Type
Number (double)

163.1.17 [Link]

[Link]
Description
If true, trace with strokes. At least one of fills or strokes must be true.
Used only if tracingMode is [Link].
Type
Boolean

163.1. Properties 859


Illustrator Scripting Guide, Release 0.0.1

163.1.18 [Link]

[Link]
Description
The threshold value of black-and-white tracing. All pixels with a grayscale value greater than this are converted to
black.
Used only if tracingMode is [Link].
Range: 0 to 255
Type
Number (long)

163.1.19 [Link]

[Link]
Description
The color mode for tracing.
Type
TracingModeType

163.1.20 [Link]

[Link]
Description
Read-only. The class name of the object.
Type
String

163.1.21 [Link]

[Link]
Description
The view for previews of the raster image. (This setting is not captured in a preset file.)
Type
ViewRasterType

860 Chapter 163. TracingOptions


Illustrator Scripting Guide, Release 0.0.1

163.1.22 [Link]

[Link]
Description
The view for previews of the vector result. (This setting is not captured in a preset file.)
Type
ViewVectorType

163.2 Methods

163.2.1 [Link]()

[Link](parameter)
Description
Loads a set of options from the specified preset, as found in the [Link] array.
Parameters

Parameter Type Description


presetName String Preset name to load

Returns
Boolean

163.2.2 [Link]()

[Link](parameter)
Description
Saves this set of options in the specified preset.
Use a name found in the [Link] array, or a new name to create a new preset.
For an existing preset, overwrites an unlocked preset and returns true.
Returns false if the preset is locked.
Parameters

Parameter Type Description


presetName String Preset name to save as

Returns
Boolean

163.2. Methods 861


Illustrator Scripting Guide, Release 0.0.1

862 Chapter 163. TracingOptions


CHAPTER

FOUR

VARIABLE

[Link][index
Description
A document-level variable that can be imported or exported.
A variable is a dynamic object used to create data-driven graphics.
For an example, see Dataset.
Variables are accessed in Illustrator through the Variables palette.

164.1 Properties

164.1.1 [Link]

[Link][index].kind
Description
The variable’s type.
Type
VariableKind

164.1.2 [Link]

[Link][index].name
Description
The name of the variable.
Type
string

863
Illustrator Scripting Guide, Release 0.0.1

164.1.3 [Link]

[Link][index].pageItems
Description
All of the artwork in the variable.
Type
PageItems, read-only

164.1.4 [Link]

[Link][index].parent
Description
Read-only. The object that contains the variable.
Type
Object

164.1.5 [Link]

[Link][index].typename
Description
The class name of the referenced object.
Type
String, read-only

164.2 Methods

164.2.1 [Link]()

[Link][index].remove()
Description
Removes the variable from the collection of variables.
Returns
Nothing.

864 Chapter 164. Variable


CHAPTER

FIVE

VARIABLES

[Link]
Description
The collection of Variable objects in the document.
For an example of how to create variables, see Using variables and datasets.

165.1 Properties

165.1.1 [Link]

[Link]
Description
The number of variables in the document
Type
Number; read-only.

165.1.2 [Link]

[Link]
Description
The object that contains the collection of variables
Type
Object; read-only.

865
Illustrator Scripting Guide, Release 0.0.1

165.1.3 [Link]

[Link]
Description
The class name of the referenced object.
Type
String; read-only.

165.2 Methods

165.2.1 [Link]()

[Link]()
Description
Adds a new variable to the collection.
Returns
Variable

165.2.2 [Link]()

[Link](name)
Description
Get the first element in the collection with the provided name.
Parameters

Parameter Type Description


name String Name of element to get

Returns
Variable

866 Chapter 165. Variables


Illustrator Scripting Guide, Release 0.0.1

165.2.3 [Link]()

[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number String or number key

Returns
Variable

165.2.4 [Link]()

[Link]()
Description
Deletes all elements in this collection.
Returns
Nothing.

165.2. Methods 867


Illustrator Scripting Guide, Release 0.0.1

868 Chapter 165. Variables


CHAPTER

SIX

VIEW

[Link][index
Description
A document view in an Illustrator document, which represents a window view onto a document.
Scripts cannot create new views, but can modify some properties of existing views, including the center point, screen
mode, and zoom.

166.1 Properties

166.1.1 [Link]

[Link][index].bounds
Description
Read-only. The bounding rectangle of this view relative to the current document’s bounds.
Type
Array of 4 Numbers

166.1.2 [Link]

[Link][index].centerPoint
Description
The center point of this view relative to the current document’s bounds.
Type
Array of 2 Numbers

869
Illustrator Scripting Guide, Release 0.0.1

166.1.3 [Link]

[Link][index].parent
Description
Read-only. The document that contains this view.
Type
Document

166.1.4 [Link]

[Link][index].screenMode
Description
The mode of display for this view.
Type
ScreenMode

166.1.5 [Link]

[Link][index].typename
Description
Read-only. The class name of the referenced object.
Type
String

166.1.6 [Link]

[Link][index].zoom
Description
The zoom factor of this view, where 100.0 is 100%.
Type
Number (double)

870 Chapter 166. View


CHAPTER

SEVEN

VIEWS

[Link]
Description
A collection of View objects in a document.

167.1 Properties

167.1.1 [Link]

[Link]
Description
The number of objects in the collection
Type
Number; read-only.

167.1.2 [Link]

[Link]
Description
The parent of this object.
Type
Object; read-only.

871
Illustrator Scripting Guide, Release 0.0.1

167.1.3 [Link]

[Link]
Description
The class name of the referenced object.
Type
String; read-only.

167.2 Methods

167.2.1 [Link]()

[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number String or number key

Returns
View

872 Chapter 167. Views


CHAPTER

EIGHT

WORDS

[Link][index].words
Description
A collection of words in a text item, where each word is a TextRange object.
The elements are not named; you must access them by index.

168.1 Properties

168.1.1 [Link]

[Link][index].[Link]
Description
The number of objects in the collection
Type
Number; read-only.

168.1.2 [Link]

[Link][index].[Link]
Description
The parent of this object.
Type
Object; read-only.

873
Illustrator Scripting Guide, Release 0.0.1

168.1.3 [Link]

[Link][index].[Link]
Description
The class name of the referenced object.
Type
String; read-only.

168.2 Methods

168.2.1 [Link]()

[Link][index].[Link](contents[, relativeObject][,
inseertLocation])
Description
Adds a word to the current document at the specified location.
If no location is specified, adds it to the containing text frame after the current word selection or insertion point.
Parameters

Parameter Type Description


contents String Word to add
relativeObject TextFrameItem, optional Object to add item to
insertionLocation ElementPlacement, optional Location to insert text

Returns
TextRange

168.2.2 [Link]()

[Link][index].[Link](contents)
Description
Adds a word before the current word selection or insertion point.
Parameters

Parameter Type Description


contents String Word to add

Returns
TextRange

874 Chapter 168. Words


Illustrator Scripting Guide, Release 0.0.1

168.2.3 [Link]()

[Link][index].[Link](itemKey)
Description
Gets an element from the collection.
Parameters

Parameter Type Description


itemKey String, Number String or number key

Returns
TextRange

168.2.4 [Link]()

[Link][index].[Link]()
Description
Deletes all elements in this collection.
Returns
Nothing.

168.3 Example

168.3.1 Counting words

// Counts all words in current document and stores total in numWords


if ( [Link] > 0 ) {
var numWords = 0;

for ( i = 0; i < [Link]; i++) {


numWords += [Link][i].[Link];
}
}

168.3. Example 875


Illustrator Scripting Guide, Release 0.0.1

168.3.2 Applying attributes to words

// Creates a new magenta color and applies the color to all words meeting a specific␣
˓→criteria

if ([Link] > 0 && [Link] > 0) {


// Create the color to apply to the words
var wordColor = new RGBColor();
[Link] = 255;
[Link] = 0;
[Link] = 255;

// Set the value of the word to look for searchWord1 = "the";


var searchWord2 = "The";
var searchWord3 = "THE";

// Iterate through all words in the document


// and color the words that match searchWord

for (var i = 0; i < [Link]; i++) {


var textArt = [Link][i];

for (var j = 0; j < [Link]; j++) {


var word = [Link][j];

if ([Link] == searchWord1 || [Link] == searchWord2 || [Link]␣


˓→ == searchWord3) {
[Link] = true;
[Link] = wordColor;
}
}
}
}

876 Chapter 168. Words

You might also like