2016 Adobe Systems Incorporated. All rights reserved.
Adobe Illustrator CC 2017 Scripting Reference: AppleScript
If this guide is distributed with software that includes an end user agreement, this guide, as well as the software
described in it, is furnished under license and may be used or copied only in accordance with the terms of such license.
Except as permitted by any such license, no part of this guide may be reproduced, stored in a retrieval system, or
transmitted, in any form or by any means, electronic, mechanical, recording, or otherwise, without the prior written
permission of Adobe Systems Incorporated. Please note that the content in this guide is protected under copyright law
even if it is not distributed with software that includes an end user license agreement.
The content of this guide is furnished for informational use only, is subject to change without notice, and should not be
construed as a commitment by Adobe Systems Incorporated. Adobe Systems Incorporated assumes no responsibility or
liability for any errors or inaccuracies that may appear in the informational content contained in this guide.
Please remember that existing artwork or images that you may want to include in your project may be protected under
copyright law. The unauthorized incorporation of such material into your new work could be a violation of the rights of
the copyright owner. Please be sure to obtain any permission required from the copyright owner.
Any references to company names in sample templates are for demonstration purposes only and are not intended to
refer to any actual organization.
Adobe, the Adobe logo, Acrobat, Illustrator, and Photoshop are either registered trademarks or trademarks of Adobe
Systems Incorporated in the United States and/or other countries.
Microsoft and Windows are either registered trademarks or trademarks of Microsoft Corporation in the United States
and/or other countries. Apple, Mac, Macintosh, and Mac OS are trademarks of Apple Computer, Incorporated, registered
in the United States and other countries. JavaScript and all Java-related marks are trademarks or registered trademarks of
Sun Microsystems, Inc. in the United States and other countries. UNIX is a registered trademark of The Open Group.
All other trademarks are the property of their respective owners.
Adobe Systems Incorporated, 345 Park Avenue, San Jose, California 95110, USA. Notice to U.S. Government End Users.
The Software and Documentation are “Commercial Items,” as that term is defined at 48 C.F.R. §2.101, consisting of
“Commercial Computer Software” and “Commercial Computer Software Documentation,” as such terms are used in 48
C.F.R. §12.212 or 48 C.F.R. §227.7202, as applicable. Consistent with 48 C.F.R. §12.212 or 48 C.F.R. §§227.7202-1 through
227.7202-4, as applicable, the Commercial Computer Software and Commercial Computer Software Documentation are
being licensed to U.S. Government end users (a) only as Commercial Items and (b) with only those rights as are granted
to all other end users pursuant to the terms and conditions herein. Unpublished-rights reserved under the copyright
laws of the United States. Adobe Systems Incorporated, 345 Park Avenue, San Jose, CA 95110-2704, USA. For U.S.
Government End Users, Adobe agrees to comply with all applicable equal opportunity laws including, if appropriate, the
provisions of Executive Order 11246, as amended, Section 402 of the Vietnam Era Veterans Readjustment Assistance Act
of 1974 (38 USC 4212), and Section 503 of the Rehabilitation Act of 1973, as amended, and the regulations at 41 CFR
Parts 60-1 through 60-60, 60-250, and 60-741. The affirmative action clause and regulations contained in the preceding
sentence shall be incorporated by reference.
This chapter provides a complete, alphaetical reference for the objects and commands in the Adobe®
Illustrator® AppleScript dictionary. For each object, the following information is provided:
Elements that can be contained within the object.
Properties of the object, with read-only status, value type, and a description.
Valid commands, with links to sections in Chapter 2, “AppleScript Commands, which describes all
commands in the Illustrator dictionary.
Notes to explain special issues.
Script examples. These example are intended to illustrate concepts; they do not necessarily represent
the best or most efficient way to construct an AppleScript script. Little error checking was done on
them. They assume that the proper context exists for the scripts to execute in; for instance, that there
is a document open or items selected.
For an overview of the Illustrator object model, see Adobe Illustrator CC 2017 Scripting Guide.
9
CHAPTER 1: AppleScript Objectsapplication 10
application
The Adobe Illustrator application object, which contains all other Illustrator objects.
application elements
ElementsRefer to by
document
text fonts
name, numeric index, range of elements, before/after another element, satisfying a test
numeric index, range of elements, before/after another element, satisfying a test
application object properties
PropertyValue typeWhat it is
best type
browser availableboolean
build numberstring
class
color settings
type classRead-only. The best type for the
type classRead-only. The object’s class, which is
list of Unicode textRead-only. The list of color-settings files
application object’s value. Always
returns
reference.
Read-only. If true, a web browser is
available.
Read-only. The application’s build
number.
application.
currently available for use.
coordinate system
current documentdocument
default color
settings
default type
flattener presets
free memoryinteger
Valid values:
document coordinate system
artboard coordinate system
file specification
type classRead-only. The default type for the
list of Unicode textRead-only. The list of flattener style
Coordinate system currently in use.
The active (frontmost) document in
Illustrator.
Read-only. The default color-settings file
for the current application locale.
application object’s value. Always
returns
reference.
names currently available for use.
Read-only. The amount of unused
memory (in bytes) within the Illustrator
partition.
CHAPTER 1: AppleScript Objectsapplication 11
PropertyValue typeWhat it is
frontmostboolean
localestring
name
paste remembers
layers
PDF presets
PPDs
print presets
printers
Unicode textRead-only. The application’s name (not
boolean
list of Unicode textRead-only. The list of preset PDF-options
list of PPD filesRead-only. The list of PPD files currently
list of Unicode textRead-only. The list of preset
list of printersRead-only. The list of installed printers
Read-only. If true, this is the frontmost
(active) application.
Read-only. The application’s locale.
related to the filename of the
application file). Always returns
Illustrator CC 2017"
.
"Adobe
When true, paste operations maintain
layer structure.
names available for use.
available for use. (A document must be
open or an error is returned).
printing-options names available for
use.
currently available for use. (A document
must be open or an error is returned).
propertiesrecord
scripting version
Unicode textRead-only. The version of the Scripting
All the application’s properties returned
in a single record. Properties that are
individually read-only remain so in this
record.
plug-in.
CHAPTER 1: AppleScript Objectsapplication 12
PropertyValue typeWhat it is
selection
settingsIllustrator preferences
anythingAll currently selected objects in the
active (frontmost) document.
Illustrator does not support the
select
command to change the application’s
current selection. Use
selection to in place of select. See
set the
the examples below.
The application’s selection can be
accessed and modified. When there are
no selected objects,
an empty list,
in the current document, set
selection contains
{}. To deselect all objects
selection
to an empty list.
When there is an active insertion point
in the contents of a text frame,
selection returns a reference to the
insertion point. When characters are
selected in the contents of a text frame,
selection returns a reference to the
range of text.
Read-only. Preferences for the Illustrator
application.
startup presets
tracing presets
user interaction
level
version
list of Unicode textRead-only. The list of preset
list of Unicode textRead-only. The list of preset
Valid values:
Unicode textRead-only. The version of the Adobe
application commands
activate
convert sample color
copy
cut
do script
delete workspace
get preset file of
get scriptable help group
launch
interact with all
interact with local
interact with self
never interact
printing-options names available for
use.
tracing-options names available for use.
The level of interaction with the user
that is allowed when handling script
commands. Default:
interact with all
Illustrator application.
CHAPTER 1: AppleScript Objectsapplication 13
paste
quit
redraw
reset workspace
save workspace
switch workspace
Select an object
-- Select the first object in the document
tell application "Adobe Illustrator"
-- Make sure there is a page item to select
if (document 1 exists) and (page item 1 of document 1 exists) then
set the selection to page item 1 of document 1
end if
end tell
Copy and paste a selection
You do not need to make objects part of the selection to act on them. Selection is useful for moving
objects to and from the clipboard using the
selection.
cut, copy and paste commands, which act on the current
Note that Illustrator must be the front-most application when executing commands that involve the
clipboard. This example brings Illustrator to the front using AppleScript’s
-- Copy current selection to clipboard then paste into a new doc
tell application "Adobe Illustrator"
-- If Illustrator is not the frontmost application, activate it.
if not frontmost then activate
-- Make sure there is a document to copy from
if (count documents) > 0 then
set selectedItems to selection of current document
if selectedItems is not {} then
copy
set colorSpace to color space of current document
make new document with properties {color space:colorSpace}
paste
An artboard object or list of artboard objects. An artboard object represents a single artboard in a
document. There can be between 1 to 100 artboards in one document. You cannot delete the last artboard
in a document.
artboard object properties
PropertyValue typeWhat it is
artboard rectanglerect
best type
class
container
default type
indexinteger
nametext
propertiesrecord
ruler originpoint
ruler PARnumber (double)
show centerboolean
show cross hairsboolean
type classRead-only. The best type for the artboard object’s
type classRead-only. The object’s class, which is artboard.
object referenceRead-only. A reference to the document that contains
type classRead-only. The default type for the artboard object’s
Size and position of the artboard.
value. Always returns
reference.
this artboard.
value. Always returns
reference.
Read-only. The index of this artboard.
The unique identifying name of this artboard.
The properties of this object, returned as a record.
Ruler origin of the artboard, relative to the top left
corner of the artboard.
Pixel aspect ratio, used in ruler visualization if the units
are pixels. Range: 0.1 to 10.0
If true, center the artwork that is created on the
artboard. Default:
true
contains this object.
How to scale the drawing on import. Default: fit
artboard
The value when global scale option is scale by
value, expressed as a percentage. Range: 0.0 to
100.0 Default: 100.0
If true, the layers of the artwork are merged.
Default:
false
If true, scale line weights by the same factor as the
rest of the drawing. Default:
false
The ratio by which to scale while mapping units.
Default: 1.0
The unit to map to. Default: autocad millimeters
selected layout
name
Unicode textName of the layout in the drawing to import.
CHAPTER 1: AppleScript Objectsbrush, brushes 17
brush, brushes
A brush or list of brushes. Brushes are contained in document objects. Scripts cannot create new brushes.
brush object properties
PropertyValue typeWhat it is
best type
class
container
default type
indexinteger
name
propertiesrecord
type classRead-only. The best type for the brush object’s value. Always
type classRead-only. The object’s class, which is brush.
object referenceRead-only. A reference to the document that contains this brush.
type classRead-only. The default type for the brush object, which is
Unicode textThe name of this brush.
brush object commands
apply
count
exists
Apply brushes
-- Duplicate the current selection (if it is a single item)
-- and apply each available brush to the new object
tell application "Adobe Illustrator" to ¬
set selectedItems to selection
returns
reference.
reference.
Read-only. The index of this brush.
All properties of this object returned as a record.
-- Check for selection of single non-text object
if class of selectedItems is text or (count items of selectedItems) is not 1 then
display dialog "Select a single path item before running this script"
else
tell application "Adobe Illustrator"
set pathItem to item 1 of selectedItems
-- Get the item's position and use it to tile the new items below
set {itemX, itemY} to position of pathItem
-- Get a list of all brushes and apply each brush to the selectec item
set brushList to every brush of current document
-- Get coordinates of upper-left of document
set docLeft to 0
set docTop to height of current document
set brushCount to count items of brushList
repeat with i from 1 to brushCount
set aBrush to item i of brushList
set itemOffset to i * 20 -- use to tile the duplicated items
-- Duplicate the selected path item, tiling them from the
CHAPTER 1: AppleScript Objectsbrush, brushes 18
-- upper-left of the document
set pathRef to duplicate pathItem to beginning of current document ¬
with properties {position:{docLeft + itemOffset, docTop - itemOffset}}
-- Must clear the document's selection before applying a brush
-- since the duplicate above seems to add to it each time through
set selection of current document to {}
apply aBrush to pathRef
end repeat
end tell
end if
CHAPTER 1: AppleScript Objectscharacter 19
character
Specifies the properties of a character. The text contained within text frames in Illustrator can be accessed
using the
valid commands for all these classes are similar, but not identical. For example, while
kerning property, the other text classes do not.
character object elements
ElementsRefer to by
character, insertion point, word, line, paragraph, and text classes. The properties and
character has a
character style
name, numeric index, range of elements, before/after another element, satisfying
a test
character
insertion point
line
paragraph style
numeric index, range of elements, before/after another element, satisfying a test
numeric index, range of elements, before/after another element, satisfying a test
numeric index, range of elements, before/after another element, satisfying a test
name, numeric index, range of elements, before/after another element, satisfying
a test
paragraph
text
word
numeric index, range of elements, before/after another element, satisfying a test
numeric index, range of elements, before/after another element, satisfying a test
numeric index, range of elements, before/after another element, satisfying a test
character object properties
PropertyValue typeWhat it is
aki leftreal
The amount of inter-glyph space added
to the left side of the glyph in Japanese
text (in thousandths of an em).
aki rightreal
alignment
Valid values:
bottom
center
icf bottom
icf top
roman baseline
top
The amount of inter-glyph spacing
added to the right side of the glyph in
Japanese text (in thousandths of an
em).
The character alignment type.
CHAPTER 1: AppleScript Objectscharacter 20
PropertyValue typeWhat it is
alternate glyphs
auto leadingboolean
baseline direction
baseline positionValid values:
baseline shiftreal
Valid values:
default
expert
full width
half width
jis78
jis83
proportional width
quarter width
third width
traditional
jis90
jis04
Valid values:
standard
Tate Chu Yoko
vertical rotated
normal
subscript
superscript
Specifies which kind of alternate glyphs
to use.
If true, use automatic leading.
The Japanese text baseline direction.
The baseline position of text.
The amount of shift (in points) of the
text baseline.
best type
capitalization
character offsetinteger
class
connection formsboolean
containerreference
contents
contextual
ligature
default type
discretionary
ligature
type classRead-only. The best type for the
Valid values:
all caps
all small caps
normal
small caps
type classRead-only. The object’s class.
Unicode textThe text content.
boolean
type classRead-only. The default type for the
boolean
object’s value.
Specifies whether the text is normal, all
uppercase, all small caps, or a mix of
small caps and lowercase.
Specifies the figure style to use in an
OpenType font.
The color of the text fill.
If true, use OpenType fractions.
The horizontal scaling factor for the
character.
Read-only. The index of this instance of
the object.
If true, the Japanese OpenType
supports italics.
Controls the spacing between two
characters, in thousandths of an em
space.
The type of automatic kerning method
to use.
CHAPTER 1: AppleScript Objectscharacter 22
PropertyValue typeWhat it is
language
Valid values:
Bokmal Norwegian
Brazillian Portuguese
Bulgarian
Canadian French
Catalan
Chinese
Czech
Danish
Dutch
Dutch 2005 Reform
English
Finnish
German 2006 Reform
Greek
Hungarian
Icelandic
Italian
Japanese
Nynorsk Norwegian
old German
Polish
Romanian
Russian
Spanish
Serbian
standard French
standard German
standard Portuguese
Swedish
Swiss German
Swiss German 2006 Reform
Turkish
UK English
Ukranian
The language.
leadingreal
lengthinteger
ligatureboolean
no breakboolean
ordinalsboolean
ornamentsboolean
overprint fillboolean
overprint strokeboolean
propertiesrecord
The amount of space between two
lines of text, in points.
The length (in characters). Minimum: 0
If true, use the ligature.
If true, no break is allowed.
If true, use the OpenType ordinals.
If true, use the OpenType ornaments.
If true, overprint the fill of the text.
If true, overprinting of the stroke of the
text is allowed.
All properties of this object returned as
a record.
CHAPTER 1: AppleScript Objectscharacter 23
PropertyValue typeWhat it is
proportional
metrics
rotationreal
selectiontext or list of text
sizereal
storystory
strike throughboolean
stroke colorcolor info
stroke weightreal
stylistic
alternates
swashboolean
TCY horizontalinteger
boolean
boolean
If true, Japanese OpenType supports
proportional fonts.
The character rotation angle in
degrees.
Read-only. The selected text.
The font size in points.
Read-only. The story that contains the
object.
If true, characters use strike-through
style.
The color of the text stroke.
Line width of stroke.
If true, use OpenType stylistic
alternates.
If true, use the OpenType swash
character.
The Tate-Chu-Yoko horizontal
adjustment in points.
TCY verticalinteger
text fonttext font
titlingboolean
trackinginteger
Tsumereal
underlineboolean
vertical scalereal
warichu characters
after break
warichu characters
before break
long
long
The Tate-Chu-Yoko vertical adjustment
in points.
The text font.
If true, use the OpenType titling
alternates.
The tracking or range kerning amount
in thousandths of an em.
The percentage of space reduction
around a Japanese character.
If true, characters use underline style.
Character vertical scaling factor,
expressed as a percentage (100 is
100%).
How the characters in Wari-Chu text (an
inset note in Japanese text) are divided
into two or more lines.
How the characters in Wari-Chu text (an
inset note in Japanese text) are divided
into two or more lines.
CHAPTER 1: AppleScript Objectscharacter 24
PropertyValue typeWhat it is
warichu enabledboolean
warichu gapinteger
warichu
justification
warichu linesinteger
warichu scalereal
Valid values:
auto justify
center
full justify last line center
full justify
full justify last line left
full justify last line right
left
right
character object commands
apply character style
change case
count
delete
deselect
duplicate
exists
make
move
select
If true, Wari-Chu is enabled.
The Wari-Chu line gap in points.
The Wari-Chu justification.
The number of Wari-Chu (multiple text
lines fit into a space meant for one)
lines.
The Wari-Chu scale.
Make selected text superscript
-- Make the currently selected text superscript
tell application "Adobe Illustrator"
-- Make sure one or more characters of text are selected
set selectedText to selection of current document
if class of selectedText is text or ¬
class of selectedText is character then
-- Adjust the properties of the selected text to superscript it
set fontSize to size of selectedText
set fontBaseline to baseline shift of selectedText
set properties of selectedText to ¬
This example demonstrates how to use character properties to create unique effects from a script.
--Distort every character in the first text frame of a document
--by decreasing the horizontal scaling of each character to the midpoint
--then increasing from the mid point to the end (a smaller value here
--means more difference between largest and smallest horizontal
--scaling of the characters)
tell application "Adobe Illustrator"
-- Is there is a document and a text frame to work with
if (exists text frame 1 of current document) then
-- Make sure the text frame contains some text
set textframe to first text frame of current document
if textframe is not "" then -- contains some text
-- Gather info needed to calculate the scale factor
set characterCount to count characters in textframe
set factor to (characterCount + 1) / 2
-- Iterate over each character, changing its horizontal scale
repeat with i from 1 to characterCount
set hScaling to (factor - i) / factor
if hScaling < 0 then set hScaling to -hScaling
set widthScale to 100 + 100 * hScaling
set horizontal scale of character i of text frame 1 of document 1 to
widthScale
end repeat
end if
end if
end tell
CHAPTER 1: AppleScript Objectscharacter style, character styles 26
character style, character styles
A named style that specifies character attributes.
N
OTE: Character attributes do not have default values, and are undefined until explicitly set.
character style object properties
PropertyValue typeWhat it is
aki leftreal
aki rightreal
alignment
alternate glyphs
alternate
ligature
Valid values:
bottom
center
icf bottom
icf top
roman baseline
top
Valid values:
default
Traditional
Expert
jis78
jis83
half width
third width
quarter width
full width
proportional width
jis90
jis04
boolean
The left aki (in thousandths of an em).
The right aki (in thousandths of an em).
The character alignment type.
The alternate glyphs form.
If true, use the alternate ligature.
auto leadingboolean
baseline
direction
baseline position
baseline shiftreal
best type
Valid values:
standard
Tate Chu Yoko
vertical rotated
Valid values:
normal
subscript
superscript
type classRead-only. The best type for the object’s
If true, use automatic leading.
The Japanese text baseline direction.
The baseline position of text.
The amount of shift (in points) of the text
baseline.
value.
CHAPTER 1: AppleScript Objectscharacter style, character styles 27
Specifies which figure style to use in the
OpenType font.
fill colorcolor info
fractionsboolean
horizontal scalereal
indexinteger
italicsboolean
kerning method
Valid values:
auto
none
optical
metricsromanonly
The color of the text fill.
If true, use the OpenType fractions.
Character horizontal scaling factor
expressed as a percentage (100 = 100%).
Read-only. The index of this instance of
the object.
If true, the Japanese OpenType supports
italics.
The automatic kerning method to use.
CHAPTER 1: AppleScript Objectscharacter style, character styles 28
PropertyValue typeWhat it is
language
Valid values:
Bokmal Norwegian
Brazillian Portuguese
Bulgarian
Canadian French
Catalan
Chinese
Czech
Danish
Dutch
Dutch 2005 Reform
English
Finnish
German 2006 Reform
Greek
Hungarian
Icelandic
Italian
Japanese
Nynorsk Norwegian
old German
Polish
Romanian
Russian
Spanish
Serbian
standard French
standard German
standard Portuguese
Swedish
Swiss German
Swiss German 2006 Reform
Turkish
UK English
Ukranian
The amount of space between two lines
of text, in points.
If true, use the ligature.
The OpenType font baseline position.
If true, use the OpenType ordinals.
If true, use the OpenType ornaments.
If true, the fill of the text should be
overprinted.
CHAPTER 1: AppleScript Objectscharacter style, character styles 29
PropertyValue typeWhat it is
overprint strokeboolean
propertiesrecord
proportional
metrics
rotationreal
sizereal
strike throughboolean
stroke colorcolor info
stroke weightreal
stylistic
alternates
swashboolean
TCY horizontalinteger
boolean
boolean
If true, the stroke of the text should be
overprinted.
All properties of this object returned as a
record.
If true, the Japanese OpenType font
supports proportional glyphs.
The character rotation angle in degrees.
The font size in points.
If true, characters use strike-through
style.
The color of the text stroke.
The line width of the stroke.
If true, use the OpenType stylistic
alternates.
If true, use the OpenType swash glyph.
The Tate-Chu-Yoko horizontal
adjustment in points.
TCY verticalinteger
text fonttext
titlingboolean
trackinginteger
Tsumereal
underlineboolean
vertical scalereal
warichu
characters after
break
warichu
characters before
break
integer
integer
The Tate-Chu-Yoko vertical adjustment in
points.
The text font.
If true, use the OpenType titling
alternates.
The tracking or range kerning amount in
thousands of an em.
The percentage of space reduction
around a Japanese character (100 =
100%).
If true, characters use underline style.
The character vertical scaling factor
expressed as a percentage (100 = 100%).
How the characters in Wari-Chu text (an
inset note in Japanese text) are divided
into two or more lines.
How the characters in Wari-Chu text (an
inset note in Japanese text) are divided
into two or more lines.
warichu enabledboolean
If true, Wari-Chu is enabled.
CHAPTER 1: AppleScript Objectscharacter style, character styles 30
PropertyValue typeWhat it is
warichu gapinteger
warichu
justification
warichu linesinteger
Valid values:
auto justify
center
full justify last line center
full justify
full justify last line left
full justify last line right
left
right
The Wari-Chu line gap.
The Wari-Chu justification.
The number of Wari-Chu (multiple text
lines fit into a space meant for one) lines.
warichu scalereal
The Wari-Chu scale.
Character styles
-- Create a document with text frames containing text, then create and apply the same
character style to all
tell application "Adobe Illustrator"
activate
make new document
make new text frame in document 1 with properties {name:"text 1",
contents:"Scripting is fun!", position:{50, 100}}
make new text frame in document 1 with properties {name:"text 2",
contents:"Scripting is easy!", position:{100, 200}}
make new text frame in document 1 with properties {name:"text 3", contents:"Everyone
should script!", position:{150, 300}}
make new character style in document 1 with properties {name:"Big Red"}
set the size of character style "Big Red" of document 1 to 40
set the tracking of character style "Big Red" of document 1 to -50
set the capitalization of character style "Big Red" of document 1 to all caps
set the fill color of character style "Big Red" of document 1 to {class:RGB color
info, red:255, green:0, blue:0}
-- 'apply character style' is the event.
-- 'character style "Big Red" of document 1' is the style applied.
-- note that character styles must be applied to text ranges.
apply character style character style "Big Red" of document 1 to the text range of
text frame "text 1" of document 1
apply character style character style "Big Red" of document 1 to the text range of
text frame "text 2" of document 1
apply character style character style "Big Red" of document 1 to the text range of
text frame "text 3" of document 1
end tell
CHAPTER 1: AppleScript ObjectsCMYK color info 31
CMYK color info
A CMYK color specification, used to specify a CMYK color where a color info object is required. This class
contains the color component values of a CMYK color. Use it to specify and get color information from an
Illustrator document or page items.
color space of a document is RGB and you specify the color value for a page item in that document
If the
CMYK color info, Illustrator translates the CMYK color specification into an RGB color specification.
using
The same thing happens if the document’s color space is CMYK and you specify colors using
RGB color info. Since this translation can cause information loss you should specify colors using the color
info class that matches the document’s color space.
CMYK color info object properties
This class inherits all properties from the color info class.
PropertyValue typeWhat it is
cyanreal
magentareal
yellowreal
blackreal
The cyan color value. Range: 0.0 to 100.0. Default: 0.0.
The magenta color value. Range: 0.0 to 100.0. Default: 0.0.
The yellow color value. Range: 0.0 to 100.0. Default: 0.0.
The black color value. Range: 0.0 to 100.0. Default: 0.0.
Create a color swatch
-- Make a new CYMK color swatch in the current document
tell application "Adobe Illustrator"
if not (exists swatch "Our CMYK Swatch" in current document) then
set swatchColor to {cyan:50.0, magenta:20.0, yellow:20.0, black:0.0}
make new swatch at end of current document with properties ¬
{name:"Our CMYK Swatch", color:swatchColor}
end if
end tell
CHAPTER 1: AppleScript Objectscolor info 32
color info
An abstract parent class for all color classes used in Illustrator. Subclasses are:
CMYK color info
gradient color info
gray color info
Lab color info
no color info
pattern color info
RGB color info
spot color info
A compound path or list of compound paths. Compound paths are objects that contain two or more paths
that are painted so that holes appear where paths overlap.
All paths in a compound path share property values. Therefore, if you set the value of a property of any one
of the paths in the compound path, all other path’s matching property will be updated to the new value.
Paths contained within a compound path or group in a document are returned as individual paths when a
script asks for the paths contained in the document. However, paths contained in a compound path or
group are not returned when a script asks for the paths in a layer which contains the compound path or
group.
compound path item object elements
ElementRefer to by
path item
name, numeric index, range of elements, before/after another element, satisfying a test
compound path item object properties
This object class inherits all properties from the pageitem class.
PropertyValue typeWhat it is
propertiesrecord
All properties of this object returned as a record.
compound path item object commands
count
delete
duplicate
exists
make
move
rotate
scale
transform
translate
-- get paths in a document that are not part of a compound path or group
tell application "Adobe Illustrator"
set docRef to current document
set pathItemList to {}
set layerCount to count layers of docRef
repeat with i from 1 to layerCount
set pathItemList to pathItemList & every path item of layer i of docRef
end repeat
set selection to pathItemList
end tell
get pathItemList
Duplicate and group paths from a compound path
-- Create a group containing a set of paths duplicated from the
-- first compound path item of the document
tell application "Adobe Illustrator"
set pathItemList to every path item of compound path item 1 of current document
set groupRef to make new group item at beginning of layer 1 of document 1
duplicate pathItemList to beginning of groupRef
An object, or list of objects, that contains variables and their dynamic data.
dataset object properties
PropertyValue typeWhat it is
best type
class
container
type classRead-only. The best type for the dataset’s value. Always returns
type classRead-only. The object’s class, which is dataset.
object
reference
default type
indexinteger
name
propertiesrecord
type classRead-only. The default type for the data set. Always returns
Unicode textThe name of the dataset.
dataset object commands
count
delete
display
exists
make
update
reference.
Read-only. A reference to the art item that contains this data set.
reference.
Read-only. The index of this data set in the art item.
All properties of this object returned as a record.
Datasets and variables
-- Activate Illustrator
-- Make a new document
-- Make two variables, one of kind visibility and the other textual
-- Make a rectangle and a text frame, and attach the respective variables
-- Set the color of the rectangle and the contents of the text frame
-- Make the first dataset
-- Change the contents of the text and the visibility of the rectangle
-- Make the second dataset
-- display the two datasets
tell application "Adobe Illustrator"
activate
make new document
make new variable in document 1 with properties {name:"RecVariable",
kind:visibility}
make new variable in document 1 with properties {name:"TextVariable", kind:textual}
make new rectangle in document 1 with properties {name:"Rec1", position:{100, 500},
visibility variable:variable "RecVariable" of document 1}
make new text frame in document 1 with properties {name:"Text1", position:{100,
550}, content variable:variable "TextVariable" of document 1}
set the fill color of page item "Rec1" of document 1 to {class:RGB color info,
red:150, green:255, blue:255}
set the contents of text frame "Text1" of document 1 to "Now you see me..."
make new dataset in document 1 with properties {name:"My First Dataset"}
set hidden of page item "Rec1" of document 1 to true
set the contents of text frame "Text1" of document 1 to "Now you don't!"
make new dataset in document 1 with properties {name:"My Second Dataset"}
repeat 3 times
delay 1
display dataset "My First Dataset" of document 1
delay 1
display dataset "My Second Dataset" of document 1
end repeat
An Illustrator document or a list of documents. Documents are contained in the application object.
The default document settings—those properties starting with the word "default"—are global settings
that affect the current document. Be sure to modify these default properties only when a document is
open. Note that if you set default properties to desired values before creating new objects, you can
streamline your scripts, eliminating the need to specify properties such as
have analogous default properties.
fill color and stroked that
A document’s
color space, height, and width can only be set when the document is created. Once a
document is created, these properties cannot be changed.
The frontmost document can be referred to as either current document or document 1.
The stroke color for new paths if default stroked is
true.
The default distance into the dash pattern at which
the pattern should be started for new paths.
Default lengths for dashes and gaps in dashed lines,
starting with the first dash length, followed by the
first gap length, and so on. Set to an empty list,
{}, for
a solid line.
Default type of joints in new paths.
When defaultstrokejoin is set to mitered, this
property specifies when the join will be converted to
beveled (squared-off ) by default. The default miter
limit of 4 means that when the length of the point
reaches four times the stroke weight, the join
switches from a miter join to a bevel join. Values: 1 to
500. 1 specifies a bevel join.
If true, the art beneath a stroked object should be
overprinted by default.
default stroke widthreal
default strokedboolean
default type
file path
geometric boundsrectangle
heightreal
indexinteger
inkslist of ink
Kinsoku set
modifiedboolean
type classRead-only. The default type for the document object’s
file specificationRead-only. The file associated with the document,
list of Unicode textRead-only. The Kinsoku set of characters that cannot
Default width of stroke for new paths.
If true, new paths should be stroked.
value. Always returns
reference.
which includes the complete path to the file.
Read-only. The object’s bounds excluding the stroke
width.
Read-only. The height of the document, calculated
from the geometric bounds.
Read-only. The position of this document in the
stacking order of all open documents. The current
(frontmost) document is always
document 1.
Read-only. The list of inks in this document.
begin or end a line of Japanese text.
If true, the document has been modified since the
last save.
Unicode textThe XMP metadata packet associated with this
document object commands
arrange
capture
close
convert coordinate
count
delete
duplicate
exists
export
export PDF preset
export perspective grid preset
export print preset
export variables
fit artboard to selected art
get
get perspective active plane
hide perspective grid
import character styles
import paragraph styles
import PDF preset
import perspective grid preset
import print preset
import variables
make
open
print
rasterize
save
select objects on active artboard
select perspective preset
set perspective active plane
show perspective grid
Read-only. The object’s visible bounds, including
stroke width of any objects in the illustration.
Read-only. The width of this document, calculated
from the geometric bounds.
document.
Make sure a document is open
-- Check to make sure a document is open in Illustrator
-- before setting the application's default stroke width to 8 points
tell application "Adobe Illustrator"
if not (document 1 exists) then
make new document with properties {color space:CMYK, width:100.0, height:50.0}
end if
set the default stroke width of document 1 to 8.0
-- Creates 2 new documents with different default settings
-- the RGB document has the default fill and a 4.0 pt stroke
-- the CMYK document has no fill and a dashed stroke width of 8.0 pt
tell application "Adobe Illustrator"
set rgbDocRef to make new document with properties {color space:RGB}
set properties of rgbDocRef to {default filled:true ¬
, default stroked:true ¬
, default stroke width:4.0}
set rgbPropertyRef to properties of current document
set cmykDocRef to make new document with properties {color space:CMYK}
set properties of cmykDocRef to {default filled:false ¬
, default stroked:true ¬
, default stroke width:8.0 ¬
, default stroke dashes:{2.5, 1, 2.5, 1, 2.5, 1}}
set cmykPropertyRef to properties of current document
end tell
Get the file path of a document
This example demonstrates how to use document properties in other applications. In this case, the script
uses the
document in the Finder.
file path property of the active document to open the folder containing the Illustrator
-- Reveal and select a document’s file icon in the Finder
tell application "Adobe Illustrator"
set filepath to file path of current document
end tell
tell application "Finder"
activate
reveal filepath
end tell
CHAPTER 1: AppleScript Objectsdocument preset 46
document preset
A preset document template to use when creating a new document. See the add document command.
document preset properties
PropertyValue typeWhat it is
artboardLayout
artboardRowsOrColslong
artboardSpacingdouble
color mode
documentBleedLink
documentBleedOffsetR
ect
Valid values:
grid by row
grid by column
row
column
rl grid by row
rl grid by col
rl row
Valid values:
CMYK
RGB
BooleanThe document link for bleed
RectangleThe document bleed offset
The layout of artboards in the new
document. Default:
grid by row
The number of rows (for rows
layout) or columns (for column
layout) of artboards. Range: 1 to
numArtboards - 1) or 1 for single
(
row or column layouts. Default: 1
The spacing between artboards in
the new document. Default: 20.0
The number of artboards for the
new document. Range: 1 to 100.
Default: 1
CHAPTER 1: AppleScript Objectsdocument preset 47
PropertyValue typeWhat it is
preview mode
raster resolution
title
transparency grid
widthreal
Valid values:
default preview
pixel preview
overprint preview
Valid values:
screen resolution
medium resolution
high resolution
Unicode textThe document title. Default:
Valid values:
hide transparency grids
light color transparency grids
medium color transparency grids
dark color transparency grids
red color transparency grids
orange transparency grids
green transparency grids
blue transparency grids
purple transparency grids
The preview mode for the new
document.
Default:
default preview
The raster resolution for the new
document.
Default:
Untitled
screen resolution
The transparency grid color for
the new document.
Default:
grids
hide transparency
The width in document points.
Default: 612.0
CHAPTER 1: AppleScript Objectsellipse 48
ellipse
Used to create an elliptical path in an Illustrator document. This object is available only in the context of a
make command, which creates an instance of the path item class. This special class allows you to quickly
create complex path items. Properties associated with
be specified at the time of creation.
ellipse object properties
PropertyValue typeWhat it is
path items, such as fill color and note, can also
bounds
inscribedboolean
reversedboolean
list of pointsWrite-once. The bounds of the ellipse.
ellipse object commands
make
Create ellipses
-- Embellish a single selected path item by adding a bright red
-- ellipse to each point on the path
set pEllipseScale to 0.1
tell application "Adobe Illustrator"
activate
set selectedItems to selection
-- A bit of sanity checking
if (count selectedItems) is not 1 ¬
or class of selectedItems is text ¬
or class of item 1 of selectedItems is not path item then
Write-once. If true, the ellipse path should be inscribed (drawn
inside the rectangle described by the bounds).
Write-once. If true, the ellipse path is reversed. Default: false
display dialog "Please select a single path item before running this script"
else
set pathItem to item 1 of selectedItems
-- Set ellipse color based on document color space
set docColorSpace to color space of current document
if docColorSpace is RGB then
set ellipseColor to {red:255.0, green:0.0, blue:0.0}
else
set ellipseColor to {cyan:0.0, magenta:100.0, yellow:100.0, black:0.0}
end if
-- Gather needed info about the path item to be embellished
set itemWidth to width of pathItem
set itemHeight to height of pathItem
set pathPointList to anchor of every path point of pathItem
CHAPTER 1: AppleScript Objectsellipse 49
-- Calculate the position and bounds for each ellipse
repeat with aPoint in pathPointList
set {x, y} to aPoint
set rectLeft to x - (itemWidth * pEllipseScale)
set rectRight to x + (itemWidth * pEllipseScale)
set rectTop to y + (itemHeight * pEllipseScale)
set rectBottom to y - (itemHeight * pEllipseScale)
set ellipseRect to {rectLeft, rectTop, rectRight, rectBottom}
make new ellipse at beginning of current document with properties
{bounds:ellipseRect, inscribed:true, reversed:false, stroke color:ellipseColor, fill
color:ellipseColor}
end repeat
end if
end tell
CHAPTER 1: AppleScript ObjectsEPS save options 50
EPS save options
Options that can be supplied when saving a document as an Illustrator EPS file. See the save command for
additional details.
This class is used to define a record containing properties that specify options when saving a document as
an EPS file.
to get or create an
EPS save options object properties
PropertyValue typeWhat it is
EPS save options can only be used in conjunction with the save command. It is not possible
extraction, which specifies the artboard
range. An empty string extracts all the
artboards. Default: empty string
Optional. If true, the file should be saved as
CMYK PostScript. Default:
false
Optional. The Illustrator file format version to
create. Default:
Illustrator 19
9
12
3
Optional. If true, create a raster item of the
gradient or gradient mesh so that PostScript
Level 2 printers can print the object.
embed all fonts boolean
embed linked files boolean
flatten output
Valid values:
preserve paths
preserve appearance
Optional. If true, fonts used in the EPS file
should be embedded in the file (version 7 or
later). Default:
false
Optional. If true, linked image files are to be
included in the saved document. Default:
false
Optional. How transparency should be
flattened for file formats before Illustrator 9.
Default:
preserve appearance
CHAPTER 1: AppleScript ObjectsEPS save options 51
PropertyValue typeWhat it is
included document
thumbnails
overprint
PostScript
preview
save multiple
artboards
boolean
Valid values:
discarded
preserved
Valid values:
level 2
level 3
Valid values:
none
BW TIFF
color TIFF
transparent color TIFF
boolean
Optional. If true, the thumbnail image of the
EPS artwork should be included. Default:
true
Optional. The overprint style. Default:
preserved
Optional. Specifies the PostScript level to use
when saving the file (level 1 is valid for file
format version 8 or older). Default:
level 3
Specifies the format for the EPS preview
image. Default:
color TIFF
Optional. If true, all artboards or range of
artboards are saved. Default:
false
Save EPS files
This handler processes a folder of Illustrator files, saving each as an EPS file with level 2 PostScript and
Illustrator CC 2015 compatibility. The files are save to the folder specified in the
parameter. Note that the
class property is specified in the record to ensure that Illustrator can determine
the save option class.
destinationFolder
-- Opens files from a predefined source folder in Illustrator
-- then exports them to a predefined destination folder in the chosen format
-- fileList is a list of file names in the source folder
-- filePath is the full path to the source folder
-- destinationFolder is an alias to a folder where the files are to be saved
on ExportFilesAsEPS(fileList, filePath, destinationFolder)
set destinationPath to destinationFolder as string
set fileCount to count of fileList
if fileCount > 0 then
repeat with i from 1 to fileCount
set fileName to item i of fileList
set fullPath to filePath & fileName
set newFilePath to destinationPath & fileName & ".EPS"
tell application "Adobe Illustrator"
open POSIX file fullPath as alias without dialogs
save current document in file newFilePath as eps ¬
with options {class:EPS save options ¬
, compatibility:Illustrator 9 ¬
, preview:color TIFF ¬
, embed linked files:true ¬
, include document thumbnails:true ¬
, embed all fonts:true ¬
, CMYK PostScript:true ¬
, PostScript:level 2}
You can supply a number of options when exporting a document as Macromedia® Flash™ (SWF). See the
export command in the command reference for additional details.
This class is used to define a record containing properties that specify options when exporting a document
as a Flash (SWF) file. Flash export options can be supplied only in conjunction with the export
command. It is not possible to get or create a
All properties are optional.
Flash export options object properties
PropertyValue typeWhat it is
Flash export options object.
art clipping
artboard rangestring
background
color
background
layers
blend animation
compressed
convert text to
outlines
Valid values:
output art bounds
output artboard bounds
output croprect bounds
RGB color info
list of layers
Valid values:
in build
in sequence
none
boolean
boolean
How the arts should be clipped during the
output. Default:
output art bounds
If save multiple artboards is true, this is
considered for multi-asset extraction,
which specifies the artboard range. An
empty string extracts all the artboards.
Default: empty string
The background color.
Layers to be included as the static
background in all exported Flash frames.
How the blend art objects are animated
when exported to Flash frames.
Default:
none
If true, the exported file should be
compressed. Default:
false
If true, all text should be converted to
outlines. Default:
false
curve quality
export all
symbols
export style
integer
boolean
Valid values:
Flash file
layers to frames
layers to files
layers to symbols
Artboards to Files
How much curve information should be
preserved. Range: 0 to 10. Default:
7
If true, export all symbols defined in the
palette. Default:
Specifies transparency flattening options when printing a document with the print command. These
options are used to output artwork that contains transparency into a non-native format.
flattening options object properties
PropertyValue typeWhat it is
clip complex regionsboolean
convert strokes to outlinesboolean
convert text to outlinesboolean
flattening balanceinteger
gradient resolutionreal
If true, complex regions are clipped. Default: false
If true, all strokes are converted to outlines. Default:
false
If true, all text items are converted to outlines.
Default:
false
The flattening balance. Range: 0 to 100; Default: 100
The gradient resolution in dots per inch. Range: 1.0
to 9600.0; Default: 300.0
overprint
rasterization resolutionreal
Valid values:
discard
preserve
Overprint choice. Default: preserve
The rasterization resolution in dots per inch.
Range: 1.0 to 9600.0. Default: 300.0
Flattening options
-- Activate Illustrator
-- Create a variable that holds the flattening options
-- Create a variable that holds the print options
-- Print the document
tell application "Adobe Illustrator"
activate
set flatOpts to {class:flattening options, clip complex regions:true, gradient
resolution:360, rasterization resolution:360}
set printOpts to {class:print options, flattener settings:flatOpts}
if not (exists document 1) then error "There is no document available to print."
print document 1 options printOpts
end tell
CHAPTER 1: AppleScript Objectsfont options 57
font options
Font options when printing a document with the print command.
-- Print the current document, if available
tell application "Adobe Illustrator"
activate
set fontOptions to {class:font options, download fonts:complete, font substitution
kind:device substitution}
set printOpts to {class:print options, font settings:fontOptions}
if not (exists document 1) then error "There is no document available to print."
print document 1 options printOpts
end tell
CHAPTER 1: AppleScript ObjectsFreeHand options 58
FreeHand options
Options for opening a FreeHand file.
FreeHandFileOptions properties
PropertyValue typeWhat it is
best type
class
container
type classRead-only. The best type for the object’s value.
type classRead-only. The object’s class.
object
reference
convert text to outlinesboolean
default type
import single pageboolean
pagelong
propertiesrecord
type classRead-only. The default type for the object’s value.
Read-only. A reference to the document that
contains this object.
If true, converts all text to outlines.
Default:
false
If true, imports only the page specified in the page
property. Default:
true
The number of the page to import when opening a
multipage document.
NOTE: Valid only when importsinglepage is true.
All properties of this object returned as a record.
CHAPTER 1: AppleScript ObjectsFXG save options 59
FXG save options
Specifies options which may be supplied when saving a document as an FXG file. All properties are
optional.
If savemultipleartboards is true, this is
considered for multi-asset extraction, which
specifies the artboard range. An empty string
extracts all the artboards. Default: empty string
The policy used by FXG to expand blends.
Default:
autoConvert blends
If true, linked images are downsampled (at 72
dpi). Default:
false
The policy used by FXG to preserve filters.
Default:
keep filters editable
The version of the FXG file format to create.
Default:
version 2.0
The policy used by FXG to preserve gradients.
Default:
autoConvert gradients
If true, unused symbols are included.
Default:
false
preserve
editing
capabilities
save multiple
artboards
text policy
boolean
boolean
Valid values:
outline text
keep text editable
rasterize text
autoConvert text
If true, the editing capabilities of FXG are
preserved. Default:
true
If true, all artboards or range of artboards are
saved. Default:
-- Create a new RGB gradient with three gradient stops
set pGradientName to "RGB Hot Streak"
tell application "Adobe Illustrator"
if not (exists gradient pGradientName in current document) then
set newgradient to make new gradient at beginning of current document Â
with properties {name:pGradientName, gradient type:linear}
-- Since all new gradients are created with 2 gradient stops,
-- create another stop for the 3 stop gradient
make new gradient stop at beginning of newgradient
set properties of gradient stop 1 of newgradient to Â
CHAPTER 1: AppleScript Objectsgradient color info 64
gradient color info
A gradient color specification, used to specify the color component values of a gradient color swatch. It is
used for specifying and retrieving color information from an Illustrator document or from page items in a
document.
gradient color info object properties
This class inherits all properties from the color info class.
PropertyValue typeWhat it is
anglereal
gradient
object referenceA reference to the gradient object that defines the gradient to
The gradient vector angle (in degrees). Default: 0.0
use in this color definition.
hilite anglereal
hilite lengthreal
lengthreal
matrixmatrix
The gradient highlight vector angle in degrees. Default: 0.0
The gradient highlight vector length. Default: 0.0
The gradient vector length.
An additional transformation matrix to manipulate the gradient
path.
originfixed point
The gradient vector origin.
Gradient information
-- Set fill color of the first path in the current document
-- to the first gradient in the document
tell application "Adobe Illustrator"
set the fill color of path item 1 of document 1 to ¬
A gradient stop definition or definitions contained in a specific gradient. A gradient stop is a point on a
specific gradient that specifies a color change in the containing gradient.
gradient stop object properties
PropertyValue typeWhat it is
best type
type classRead-only. The best type for the gradient stop object’s value.
Always returns
class
colorcolor info
container
type classRead-only. The object’s class, which is gradient stop.
The color linked to this gradient stop.
object referenceRead-only. A reference to the gradient that contains this gradient
stop.
default type
type classRead-only. The default type for the gradient stop object’s value.
Always returns
indexinteger
midpointreal
Read-only. The position of this gradient stop in the gradient.
The midpoint of the blend between this stop’s and the next stop’s
colors. Range: 13.0 to 87.0
propertiesrecord
ramp pointreal
stop opacitydouble
All properties of this object returned as a record.
The location of the color in the gradient. Range: 0.0 to 100.0
The opacity value for the gradient stop. Range: 0.0 to 100.0
gradient stop object commands
reference.
reference.
count
delete
duplicate
exists
make
Reverse colors in a gradient
-- This script reverses the colors in the first gradient of the current document
tell application "Adobe Illustrator"
set gradientRef to gradient 1 of document 1
-- Get a list of the gradient's colors
set colorList to color of every gradient stop of gradientRef
-- Tell AppleScript to reverse the order of the list
set colorList to reverse of colorList
-- Iterate over the gradient resetting its colors
set colorCount to count items in colorList
repeat with i from 1 to colorCount
set color of gradient stop i of gradientRef to (item i of colorList)
-- For each graph item, rotate it 90 degrees counter clockwise
tell application "Adobe Illustrator"
activate
if not (exists document 1) then error "There is no available document."
set graphItems to every page item of document 1 whose class is graph item
if graphItems is {} then error "The document does not contain any graph items."
repeat with currentGraphItem in graphItems
Defines a set of appearance attributes that you can apply non-destructively to page items. Graphic styles
are contained in documents. The graphic styles can be accessed from a script, but cannot be created from
a script. You cannot delete default
graphic style object properties
PropertyValue typeWhat it is
graphic styles.
best type
type classRead-only. The best type for the graphic style object’s value.
Always returns
class
container
default type
indexinteger
name
propertiesrecord
type classRead-only. The object’s class, which is graphic style.
object referenceRead-only. A reference to the document that contains this
graphic style.
type classRead-only. The default type for the graphic style object, which is
reference.
Read-only. The index of this graphic style.
Unicode textThe name of this graphic style.
All properties of this object returned as a record.
graphic style object commands
apply
count
delete
exists
Applying a graphic style
reference.
-- Duplicate and group the selected path items, then apply
-- a random graphic style to the items in the new group
tell application "Adobe Illustrator"
set selectedItems to selection of document 1
-- Check for empty selection
if selectedItems is not {} then
-- Create the new group to contain the duplicated items
set groupRef to make new group item at document 1
-- Duplicate the selected items to the new group
set newItemList to duplicate selectedItems to beginning of groupRef
-- Get graphic style names for display in the choice list
set styleIndex to index of every graphic style of document 1
if (count styleIndex) > 0 then
-- select a random graphic style
set chosenStyle to (random number from 1 to (count styleIndex))
-- The randomly chosen graphic style is applied to the list
-- rather than to the new group itself, because the
-- apply command works on individual path items,
-- not groups of items
apply graphic style chosenStyle of current document to newItemList
end if
end if
end tell
CHAPTER 1: AppleScript Objectsgray color info 71
gray color info
A grayscale color specification, used to specify a gray color where a colorinfo object is required.
This class is used to define a record which contains the tint value of a gray color. It is used for specifying
and retrieving color information from an Illustrator document or from page items in a document.
gray color info object properties
This class inherits all properties from the color info class.
PropertyValue typeWhat it is
gray valuereal
The tint of the gray. Range: 0.0 (white) to 100.0 (black). Default: 0.0
Creating a gray color swatch
-- Create a new gray color swatch (35% black) in the current document
set pSwatchName to "35% Gray Swatch"
tell application "Adobe Illustrator"
if not (exists swatch pSwatchName in current document) then
make new swatch at beginning of current document with properties ¬
{name:pSwatchName, color:{gray value:35.0}}
end if
end tell
CHAPTER 1: AppleScript Objectsgroup item, group items 72
group item, group items
A grouped set of art items. Group items can contain all the same page items that a layer can contain,
including other nested groups.
Paths contained within a group or compound path in a document are returned as individual paths when a
script asks for the paths contained in the document. However, paths contained in a group or compound
path are not returned when a script asks for the paths in a layer which contains the group or compound
path.
A new group can be created that contains the contents of a vector art file if you provide a file specification
to the vector file (EPS or PDF) in the
be the same object as if the user had placed the file from the user interface using the File > Place
command with the embed checkbox checked.
group item object elements
ElementRefer to by
with data parameter of the make command. The resulting group will
compound path item
graph item
group item
legacy text item
mesh item
non native item
page item
path item
placed item
plugin item
raster item
symbol item
text frame
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
group item object properties
This class inherits all properties from the page item class.
PropertyValue typeWhat it is
clippedboolean
propertiesrecord
If true, the groupitem is clipped to the clipping mask.
All properties of this object returned as a record.
CHAPTER 1: AppleScript Objectsgroup item, group items 73
group item object commands
count
delete
duplicate
exists
make
move
rotate
scale
transform
translate
Group contents of a vector art file
-- Create a new group whose contents will be the contents of a vector art file
-- fileRef is an alias or file reference to the vector file to be placed
on EmbedVectorFile(fileRef)
tell application "Adobe Illustrator"
set groupRef to make new group item in document 1 with data fileRef ¬
with properties {position:{0, 600}}
end tell
return groupRef
end EmbedVectorFile
-- Call handler
set fileRef to choose file with prompt "Select vector file to place"
set groupRef to EmbedVectorFile(fileRef)
Create path items from a group
This script demonstrates how easily new groups can be created and populated with objects.
-- Create a new group, then add rectangles to it using
-- the available placement options
tell application "Adobe Illustrator"
set groupRef to make new group item in document 1
set rectRef to make new rectangle at beginning of groupRef with properties Â
{bounds:{150, 550, 350, 350}, fill color:{blue:255}}
make new rectangle after rectRef with properties Â
{bounds:{100, 600, 300, 400}, fill color:{red:255}}
set rectRef to make new rectangle at end of groupRef with properties Â
{bounds:{0, 700, 200, 500}, fill color:{green:255}}
make new rectangle before rectRef with properties Â
{bounds:{50, 650, 250, 450}, fill color:{black:100}}
end tell
CHAPTER 1: AppleScript Objectsgroup item, group items 74
Select items not in a group
-- Select only the page items in a document that are not part of
-- a group and that are not themselves groups
tell application "Adobe Illustrator"
-- First deselect everything in the document
set selection of current document to {}
if (count page items of current document) > 0 then
set layerCount to count layers in current document
repeat with i from 1 to layerCount
set layerRef to layer i of current document
if (count page items of layer i of current document) > 0 then
set selected of (every page item of current document ¬
whose container is layerRef ¬
and class is not group item) to true
end if
end repeat
end if
end tell
Making a clipping mask
This example shows how to create a clipping mask using the first path item in a group item. This is the
same effect as you get when you use the Object > Clipping Mask > Make command in the user interface.
-- Create a group of paths, then clip the group to the first path in the group
tell application "Adobe Illustrator"
-- Create a group to contain the paths to be clipped
set groupRef to make new group item in document 1
-- Add some path items to the group
make new rectangle at end of groupRef with properties ¬
{bounds:{200, 350, 300, 250}, fill color:{cyan:100}, stroked:false}
make new rectangle at end of groupRef with properties ¬
{bounds:{300, 250, 400, 150}, fill color:{magenta:100}, stroked:false}
make new rectangle at end of groupRef with properties ¬
{bounds:{300, 350, 400, 250}, fill color:{yellow:100}, stroked:false}
make new rectangle at end of groupRef with properties ¬
{bounds:{200, 250, 300, 150}, fill color:{green:255}, stroked:false}
-- Get a little fancy and create a rotated star at the center of the group
set pathRef to make new star at beginning of groupRef with properties ¬
{center point:{300, 250}, radius:25, inner radius:4, point count:4 ¬
, fill color:{black:100}, opacity:40, stroked:false}
set rotationMatrix to get rotation matrix angle 45
transform pathRef using rotationMatrix about center
-- Create the path that the group will be clipped with
-- The clipping path must be the first (frontmost) path in the group
make new star at beginning of groupRef with properties ¬
{center point:{300, 250}, radius:80, inner radius:25, point count:4 ¬
, stroked:false, filled:false}
-- Now clip the group to the top path
set clipped of groupRef to true
Specifies the preferred options for AutoCAD, FreeHand, PDF, and Photoshop files.
Preference accessor guidelines
Preference accessor commands, such as get boolean preference, should be used only as a solution of
last resort. For information on preference keys that can be accessed, see the
file in the Adobe Illustrator SDK.
NOTE: Preference keys other than those documented in AIPreferenceKeys.h are subject to change
without notice and should not be used.
Illustrator preferences object properties
PropertyValue typeWhat it is
AIPreferenceKeys.h header
AutoCAD file optionsAutoCAD options
best type
class type
default type
FreeHand file optionsFreeHand options
propertiesrecord
PDF file optionsPDF options
Photoshop file optionsPhotoshop
type classRead-only. The best type for the object’s value.
type classRead-only. The object’s class.
type classRead-only. The default type for the object's value.
options
Read-only. Options to use when opening or
placing an AutoCAD file.
Read-only. Options to use when opening or
placing a FreeHand file.
All properties of this object returned as a record.
Read-only. Options to use when opening or
placing a PDF file.
Read-only. Options to use when opening or
placing a Photoshop file.
CHAPTER 1: AppleScript ObjectsIllustrator save options 76
Illustrator save options
Options that may be supplied when saving a document as an Illustrator file. All properties are optional.
See the save
command for additional details.
This class is used to define a record containing properties used to specify options when saving a document
as an Illustrator file. Illustrator save options can only be supplied in conjunction with the save
command. It is not possible to get or create an
Illustrator save options object.
Illustrator save options object properties
PropertyValue typeWhat it is
artboard range
compatibility
stringIf 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
Options for image capture, used with the hide perspective grid command. All properties are optional.
ImageCaptureOptions properties
PropertyValue typeWhat it is
antialiasingboolean
matteboolean
matte colorRGB color info
resolutionreal
transparencyboolean
If true, the image result is anti-aliased. Default: false
If true, the artboard is matted with a color. Default: false
The color to use for the artboard matte. Default: white
The resolution of the captured image file in points-per-inch (PPI),
in the range [72.0 ... 2400.0]. Default: 150
If true, the image result is transparent. Default: false
CHAPTER 1: AppleScript Objectsink 80
ink
Specifies the properties of the inks to be used in printing the document.
ink object properties
PropertyValue typeWhat it is
name
propertiesink properties
Unicode textThe ink’s name.
The ink information.
List inks in a document
-- Create a new CMYK document
-- Get the name of every ink in document 1
-- Display the list of ink names in a text frame
tell application "Adobe Illustrator"
set inkNames to ""
set theText to ""
if not (exists document 1) then error "There is no available document."
get the name of every item of inks of document 1
repeat with theName in the result
set inkNames to inkNames & theName & return
end repeat
set theText to inkNames
set textRef to make new text frame in current document with properties
{position:{100, 500}}
set contents of textRef to theText
end tell
CHAPTER 1: AppleScript Objectsink properties 81
ink properties
Information about ink use when printing a document with the print command.
ink properties object properties
PropertyValue typeWhat it is
anglereal
custom colorlist of real
numbers
densityreal
dot shape
frequencyreal
kind
printing status
trapping
Unicode textThe dot shape name.
Valid values:
black ink
custom ink
cyan ink
magenta ink
yellow ink
Valid values:
convert ink
disable ink
enable ink
Valid values:
ignore opaque
normal
opaque
transparent
The ink’s screen angle in degrees. Range: -360 to 360
The custom color.
The neutral density. Minimum: 0.0
The ink’s frequency. Range: 0.0 to 1000.0
The ink type.
The ink printing status.
The trapping type.
trapping orderinteger
The order of trapping for the ink. Range: 1 to 4 for CMYK
CHAPTER 1: AppleScript Objectsinsertion point 82
insertion point
A location between characters, used to insert new text objects.
An insertion point is logically located between two characters in a text frame. Each insertion point is
before the corresponding character in a text frame. Insertion point 1 is before character 1, etc.
The properties of an insertion point are the same as the character at the same position in the text frame.
For example, the font for insertion point 2 of text frame 1 will be the same as the font for character 2 of text
frame 1.
You can set the properties for an insertion point, but setting only the contents property has no affect on
the text frame. The result of setting the contents of an insertion point to a string value is to insert the string
in the text frame at the insertion point’s location. Setting the contents to an empty string has no affect.
An insertion point is contained in an
character offset indicates the location of the insertion point and length is 0. This subclass does not
InsertionPoints collection. This is a text object in which
define any additional properties.
insertion point object elements
ElementsRefer to by
character style
character
insertion point
line
paragraph style
paragraph
text
word
name, numeric index, range of elements, before/after another element, satisfying
a test
numeric index, range of elements, before/after another element, satisfying a test
numeric index, range of elements, before/after another element, satisfying a test
numeric index, range of elements, before/after another element, satisfying a test
name, numeric index, range of elements, before/after another element, satisfying
a test
numeric index, range of elements, before/after another element, satisfying a test
numeric index, range of elements, before/after another element, satisfying a test
numeric index, range of elements, before/after another element, satisfying a test
insertion point object properties
PropertyValue typeWhat it is
best type
class
containerreference
default type
indexinteger
type classRead-only. The best type for the object’s value.
type classRead-only.The object’s class.
Read-only.The object’s container.
type classRead-only.The default type for the object’s value.
Read-only.The index of this instance of the object.
CHAPTER 1: AppleScript Objectsinsertion point 83
PropertyValue typeWhat it is
propertiesrecord
storystory
All properties of this object returned as a record.
Read-only.The story that contains the insertion point.
insertion point object commands
count
exists
Working with insertion points
This example shows several ways of working with insertion points.
tell application "Adobe Illustrator"
-- Set insertion point karat to beginning of a text frame
set selection to insertion point 1 of text frame 1 of document 1
-- Add a string to end of a text frame
get insertion point -1 of text frame 1 of document 1
make new word at (item 1 of the result) with properties {contents:"Some new text."}
-- Since the default type of an insertion point is string, asking for
-- a particular insertion point returns its contents. To get a reference
-- to an insertion point you need to ask for a reference
set insertionRef to ¬
insertion point after word 3 of text frame 1 of document 1 as reference
make new word at insertionRef with properties {contents:"more words"}
end tell
Add a word at the insertion point
-- Make a new document
--- Make a new text frame with contents "Wouldn't you rather be scripting?"
-- Change the size of the text frame
-- Get the insertion points of the last word of the text frame
-- Add a new word at the first insertion point of the result
tell application "Adobe Illustrator"
activate
make new document
make new text frame in document 1 with properties {contents:"Wouldn't you rather be
scripting?", position:{100, 400}}
set the size of the text of the result to 20
delay 1
get insertion points of the last word of text frame 1 of document 1
make new word at (item 1 of the result) with properties {contents:"AppleScript"}
end tell
CHAPTER 1: AppleScript Objectsjob options 84
job options
The print job options when printing a document with the print command.
job options object properties
PropertyValue typeWhat it is
artboard rangestring
bitmap resolutionreal
collateboolean
copiesinteger
designation
file path
name
print all
artboards
print area
Valid values:
all layers
visible layers
visible printable layers
file specificationThe file to which to print.
Unicode textThe print job name.
boolean
Valid values:
artboard bounds
artwork bounds
The artboard range to be printed if print all
artboards is false. Default: 1-
The bitmap resolution. Minimum: 0.0.
Default: 0.0
If true, collate print pages are collated.
Default:
false
The number of copies to print. Minimum: 1.
Default: 1
The layers/objects to be printed.
Default:
visible printable layers
Indicates whether to print all artboards.
Default:
true
The printing bounds.
Default:
artboard bounds
print as bitmapboolean
reverse pagesboolean
If true, the job is printed as a bitmap image.
Default:
false
If true, the pages are printed in reverse order.
Default:
false
CHAPTER 1: AppleScript Objectsjob options 85
Print job options
-- Makes new document containing 3 layers - 1
-- non printable, 1 non visible and 1 visible and printable
-- a text frame is added to each layer
-- Print all layers
-- Print only visible layers
-- Print only visible and printable layer
tell application "Adobe Illustrator"
activate
make new document
set the name of current layer of document 1 to "VPL"
make new text frame in document 1 with properties {contents:"Visible and Printable",
position:{200, 600}}
make new layer in document 1 with properties {name:"VnPL", printable:false}
make new text frame in layer "VnPL" of document 1 with properties {contents:"Visible
and Non-Printable", position:{200, 500}}
make new layer in document 1 with properties {name:"nVPL"}
make new text frame in layer "nVPL" of document 1 with properties
{contents:"Non-Visible", position:{200, 400}}
set visible of layer "nVPL" of document 1 to false
set printOptions to {class:print options, job settings:{class:job options,
designation:all layers, reverse pages:true}}
print document 1 options printOptions
set printOptions to {class:print options, job settings:{class:job options,
designation:visible layers, reverse pages:true}}
print document 1 options printOptions
set jobOptions to {class:job options, designation:visible printable layers, reverse
pages:true}
set printOptions to {class:print options, job settings:jobOptions}
print document 1 options printOptions
Options that can be supplied when exporting a document as a JPEG file. See the export command in the
command reference for additional details.
This class is used to define a record containing properties that specify options when exporting a document
as a JPEG file.
not possible to get or create a
JPEG export options object properties
PropertyValue typeWhat it is
JPEG export options can only be supplied in conjunction with the export command. It is
JPEG export options object.
antialiasingboolean
artboard clippingboolean
blurreal
horizontal scalingreal
matteboolean
matte colorRGB color info
optimizationboolean
qualityinteger
saving as HTMLboolean
If true, the resulting image should be anti-aliased.
Default:
true
If true, the resulting image should be clipped to the
artboard. Default:
false
The amount of blurring to apply to the resulting image.
Range: 0.0 to 2.0. Default: 0.0
The percent horizontal scaling factor to apply to the
resulting image. Range: 0.0 to 100.0. Default: 100.0
If true, the artboard should be matted with a color.
Default:
true
The color to use when matting the artboard.
Default:
white
If true, the resulting image should be optimized for web
viewing. Default:
true
The quality of the resulting image. Range: 0 to 100.
Default: 30
If true, the resulting image should be saved with an
accompanying HTML file. Default:
false
vertical scalingreal
The percent vertical scaling factor to apply to the
resulting image. Range: 0.0 to 776.19. Default: 100.0
This handler processes all Illustrator files in a specific folder, exporting each file as a medium-quality JPEG
image. Note that the
export option class.
-- Opens files from a predefined source folder in Illustrator
-- then exports them to a predefined destination folder in the chosen format
-- fileList is a list of file names in the source folder
-- filePath is the full path to the source folder
-- destinationFolder is an alias to a folder where the files are to be saved
on ExportFilesAsJPEGMedium(fileList, filePath, destinationFolder)
set destinationPath to destinationFolder as string
set fileCount to count of fileList
if fileCount > 0 then
repeat with i from 1 to fileCount
set fileName to item i of fileList
set fullPath to filePath & fileName
set newFilePath to destinationPath & fileName & ".jpg"
tell application "Adobe Illustrator"
end tell
end repeat
end if
end ExportFilesAsJPEGMedium
class property is specified in the record to ensure that Illustrator can determine the
open POSIX file fullPath as alias without dialogs
export current document to file newFilePath as JPEG with options ¬
A color specification in the CIE Lab color space, used where a color info object is required.
Lab color info properties
This class inherits all properties from the color info class.
PropertyValue typeWhat it is
areal
breal
lreal
The a (red-green) color value. Range -128.0–128.0. Default: 0.0
The b (yellow-blue) color value. Range -128.0–128.0. Default: 0.0
The l (lightness) color value. Range -128.0–128.0. Default: 0.0
CHAPTER 1: AppleScript Objectslayer, layers 89
layer, layers
A layer or list of layers. Layers may contain nested layers, which are called sublayers in the user interface.
The
layer object contains all the page items in the specific layer as elements. Your script can access page
items as elements of either the
items as elements of a layer, only objects in that layer can be accessed. To access page items throughout
the entire document, be sure to refer to them as elements of the document.
layer object elements
ElementRefer to by
layer object or as elements of the document object. When accessing page
compound path item
graph item
group item
layer
legacy text item
mesh item
non native item
page item
path item
placed item
plugin item
raster item
symbol item
text frame
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
name, index, before/after, range, test
CHAPTER 1: AppleScript Objectslayer, layers 90
layer object properties
PropertyValue typeWhat it is
best type
blend mode
class
colorRGB color info
container
type classRead-only. The best type for the layer object’s value. Always
Valid values:
color blend
color burn
color dodge
darken
difference
exclusion
hard light
hue
lighten
luminosity
multiply
normal
overlay
saturation blend
screen
soft light
type classRead-only. The layer object’s class, which is layer.
object referenceRead-only. A reference to the document that contains this
returns
reference.
The mode used when compositing an object. An object is
considered composited when its opacity is set to less than
100.0 (100%).
The layer’s selection mark color.
layer.
default type
dim placed
images
has selected
artwork
indexinteger
isolatedboolean
knockout
lockedboolean
name
type classRead-only. The default type for the layer object’s value.
boolean
boolean
Valid values:
unknown
disabled
enabled
inherited
Unicode textThe name of this layer.
Always returns
reference.
If true, placed images are to be rendered as dimmed in this
layer.
If true, one or more objects in this layer selected are
selected; setting this property to
false deselects all
objects in the layer.
Read-only. The position of this layer in the current stacking
order of layers in this document, where
layer 1 is always
the topmost layer in the stacking order.
If true, this object is isolated
Is this object used to create a knockout.
If true, the layer is editable.
CHAPTER 1: AppleScript Objectslayer, layers 91
PropertyValue typeWhat it is
opacityreal
previewboolean
printableboolean
propertiesrecord
slicedboolean
visibleboolean
layer object commands
count
delete
duplicate
exists
make
move
Move layers
The opacity of this layer, where 100.0 is completely opaque
and 0.0 is completely transparent.
If true, this layer should be displayed using preview mode.
If true, this layer should be printed when printing the
document.
All properties of this object returned as a record.
If true, slices should be preserved. Default: false
If true, this layer is visible.
-- Move the 2nd layer to the top of the stacking order
tell application "Adobe Illustrator"
if (count layers of current document) > 1 then
move layer 2 of document 1 to before layer 1 of document 1
end if
end tell
Create a layer
Commands that deal with changes to an object’s reference, including the creation of new objects with the
make command, return a reference to the new or modified object in their result. This example stores the
reference returned for a newly created layer and then creates a new path item in the layer using the
reference.
-- Make a new layer at the top of the layer stack
-- then create a new path in the layer
tell application "Adobe Illustrator"
set layerRef to make layer at document 1 with properties {name:"Our Layer"}
make new rectangle at beginning of layerRef
end tell
CHAPTER 1: AppleScript Objectslayer, layers 92
Delete layers
This example demonstrates the power of constructing simple tests (with the whose clause) to selectively
delete layers in a document based on their names. In this case, the script deletes all layers in the current
document that have names starting with the word “Temporary.”
-- Delete layers that have a name which begin with a particular string
set partialName to "Temp"
tell application "Adobe Illustrator"
delete (every layer of document 1 whose name starts with partialName)
end tell
CHAPTER 1: AppleScript Objectslegacy text item, legacy text items 93
legacy text item, legacy text items
A text item from a document in a pre-CS version of Illustrator (version 10 or earlier), or a list of such items.,
which are uneditable until converted. To convert legacy text, see convert
.
You can view, move, and print legacy text, but you cannot edit it. Legacy text has an
bounding box when selected.
legacy text item object properties
This class inherits all properties from the page item class.
PropertyValue typeWhat it is
convertedboolean
propertiesrecord
When true, the item has been updated to the current text
format (a
All properties of this object returned as a record.
legacy text item object commands
convert
"x" through its
text frame). Read-only.
CHAPTER 1: AppleScript Objectsline 94
line
A line or lines of text in a text frame. A document’s text can be accessed using the character, insertion
, word, line, paragraph, and text classes.
point
Lines of text cannot be created. When the
create text lines as it reflows the text within the text frame.
line object elements
ElementsRefer to by
character style
character
insertion point
line
paragraph style
paragraph
text
word
name, numeric index, range of elements, before/after another element, satisfying
a test
numeric index, range of elements, before/after another element, satisfying a test
numeric index, range of elements, before/after another element, satisfying a test
numeric index, range of elements, before/after another element, satisfying a test
name, numeric index, range of elements, before/after another element, satisfying
a test
numeric index, range of elements, before/after another element, satisfying a test
numeric index, range of elements, before/after another element, satisfying a test
numeric index, range of elements, before/after another element, satisfying a test
contents property of a text frame is modified, Illustrator will
line object properties
PropertyValue typeWhat it is
aki leftreal
aki rightreal
alignment
Valid values:
The amount of inter-glyph space added
to the left side of each glyph in
Japanese text (in thousandths of an
em).
The amount of inter-glyph spacing
added to the right side of each glyph in
Japanese text (in thousandths of an
em).
The character alignment type.
bottom
center
icf bottom
icf top
roman baseline
top
CHAPTER 1: AppleScript Objectsline 95
PropertyValue typeWhat it is
alternate glyphs
alternate ligature boolean
auto leadingboolean
baseline direction
baseline position
Valid values:
default
expert
full width
half width
jis78
jis83
proportional width
quarter width
third width
traditional
jis90
jis04
Valid values:
standard
Tate Chu Yoko
vertical rotated
Valid values:
normal
subscript
superscript
Specifies the type of alternate glyphs.
If true, use the alternate ligature.
If true, use automatic leading.
The Japanese text baseline direction.
The baseline position of text.
baseline shift real
best type
capitalization
character offsetinteger
class
connection formsboolean
containerreference
contents
contextual
ligature
default type
type classRead-only. The best type for the object’s
Valid values:
all caps
all small caps
normal
small caps
type classRead-only. The object’s class.
Unicode textThe text content.
boolean
type classRead-only. The default type for the
The amount of shift (in points) of the
text baseline.
Specifies which figure style to use in an
OpenType font.
The color of the text fill.
If true, use the OpenType fractions.
The character horizontal scaling factor
expressed as a percentage (100 =
100%).
Read-only. The index of this instance of
the object
If true, the Japanese OpenType support
supports the italic style.
Controls the spacing between two
characters, in thousandths of an em.
The automatic kerning method to use.
CHAPTER 1: AppleScript Objectsline 97
PropertyValue typeWhat it is
language
Valid values:
Bokmal Norwegian
Brazillian Portuguese
Bulgarian
Canadian French
Catalan
Chinese
Czech
Danish
Dutch
Dutch 2005 Reform
English
Finnish
German 2006 Reform
Greek
Hungarian
Icelandic
Italian
Japanese
Nynorsk Norwegian
old German
Polish
Romanian
Russian
Spanish
Serbian
standard French
standard German
standard Portuguese
Swedish
Swiss German
Swiss German 2006 Reform
Turkish
UK English
Ukranian
The amount of space between two lines
of text, in points.
The length in characters. Minimum: 0
If true, use the ligature.
Whether break is allowed.
The OpenType baseline position.
If true, use the OpenType ordinals.
If true, use the OpenType ornaments.
If true, overprint the fill of the text.
CHAPTER 1: AppleScript Objectsline 98
PropertyValue typeWhat it is
overprint strokeboolean
propertiesrecord
proportional
metrics
rotationreal
selectionlist of text
sizereal
story story
strike throughboolean
stroke colorcolor info
stroke weightreal
stylistic
alternates
boolean
boolean
If true, the stroke of the text may be
overprinted.
All properties of this object returned as
a record.
If true, the proportional metrics in
Japanese OpenType may be used.
The character rotation angle.
Read-only. The selected text.
Font size in points.
Read-only. The story that contains the
line.
If true, characters use strike-through
style.
The color of the text stroke.
line width of stroke.
If true, use the OpenType stylistic
alternates.
swashboolean
TCY horizontalinteger
TCY verticalinteger
text fonttext
titlingboolean
trackinginteger
Tsumereal
underlineboolean
vertical scalereal
warichu characters
after break
integer
If true, use the OpenType swash.
The Tate-Chu-Yoko horizontal
adjustment in points.
The Tate-Chu-Yoko vertical adjustment
in points.
The text font.
If true, use the OpenType titling
alternates.
The tracking or range kerning amount
in thousandths of an em.
The percentage of space reduction
around a Japanese character.
If true, characters use underline style.
Character vertical scaling factor.
How the characters in Wari-Chu text (an
inset note in Japanese text) are divided
into two or more lines.
warichu characters
before break
integer
How the characters in Wari-Chu text (an
inset note in Japanese text) are divided
into two or more lines.
CHAPTER 1: AppleScript Objectsline 99
PropertyValue typeWhat it is
warichu enabledboolean
warichu gapinteger
warichu
justification
warichu linesinteger
warichu scalereal
Valid values:
line object commands
apply character style
apply paragraph style
change case
count
delete
deselect
duplicate
exists
make
move
select
If true, Wari-Chu is enabled.
The Wari-Chu line gap.
The Wari-Chu justification.
auto justify
center
full justify last line center
full justify
full justify last line left
full justify last line right
left
right
The number of Wari-Chu (multiple text
lines fit into a space meant for one)
lines.
The Wari-Chu scale.
Finding lines of text
Lines of text can be located with matching characteristics using the whose clause, as this script
demonstrates.
-- Color red all lines of text containing more than 10 characters
tell application "Adobe Illustrator"
if (count text frames in document 1) > 0 then
set textItemCount to count text frames in document 1
repeat with i from 1 to textItemCount
set (fill color of every line of text frame i of document 1 ¬
whose length > 10) to {red:255.0}
end repeat
end if
end tell
CHAPTER 1: AppleScript Objectsmatrix 100
matrix
A transformation matrix specification, used to transform the geometry of objects.
Matrices are used in conjunction with the
You can generate an original matrix using the
get scale matrix, or get rotation matrix commands.
A
matrix is a record containing the matrix values, not a reference to a matrix object. The matrix
commands listed above operate on the values of a matrix record. If a command modifies a matrix, a
modified matrix record is returned as the result of the command. The original matrix record passed to the
command is not modified.
matrix object properties
PropertyValue typeWhat it is
mvalue_areal
mvalue_breal
mvalue_creal
mvalue_dreal
mvalue_txreal
mvalue_tyreal
Matrix property a.
Matrix property b.
Matrix property c.
Matrix property d.
Matrix property tx.
Matrix property ty.
transform command and as a property of a number of objects.
get identity matrix, get translation matrix,
matrix object commands
concatenate matrix
concatenate rotation matrix
concatenate scale matrix
concatenate translation matrix
equal matrices
get identity matrix
get rotation matrix
get scale matrix
get translation matrix
invert matrix
singular matrix
Getting a matrix for scale transformation
A matrix can be generated to effect a scale transformation using the getscalematrix command.
-- Scale all art in a document to 50% vertical size
tell application "Adobe Illustrator"
if (count page items in document 1) > 0 then
set scaleMatrix to get scale matrix horizontal scale 100.0 vertical scale 50.0
transform every page item in document 1 using scaleMatrix
end if
end tell
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.