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
Loading...
+ 300 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.