C
2: The Illustrator Scripting Object Model
HAPTER
Color objects
Your script can apply a color, pattern or gradient to a
stroke color
➤
Scripts can define new color swatches using the
object. Your script also can create a new spot color, using the
spots
➤
You can define the attributes of an
property. You access
The following objects allow you to create colors within defined color spaces:
➤
The
RGB color
➤
The
CMYK color
color values.
➤
The
grayscale color
in the Illustrator application.
Text objects
When you type content in an Illustrator document, the type automatically becomes a
and, at the same time, a
To observe this, open a new document in Illustrator and use the horizontal text tool to type some text,
then use the vertical text tool to type more text. Finally, create a rectangle and type some text inside it.
Now run the following JavaScript script:
var myDoc = app.activeDocument
alert("There are " + myDoc.textFrames.length + " text frames.")
alert("There are " + myDoc.stories.length + " stories.")
Text frames
There are three types of text frames:
➤
point
➤
area
➤
path
properties:
object.
objects through the
ink
object, using the range 0.0 to 255.0 for the each of the three individual color values.
object, using the percentage values 0.0 through 100.0 for each of the four individual
or
LAB color
object.
story
path item
command or
make
object using the
ink
ink info
property of the
ink list
objects, using the same range and number of values that you use
object, using the
fill color
method of the
add
command or
make
add
object, which is an
object.
document
text frame
Text objects 21
or
swatches
property of the
object
ink
object