Adobe 65010248 Scripting Guide - Page 21
Color objects, Text objects, Text frames
UPC - 883919156484
View all Adobe 65010248 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 21 highlights
CHAPTER 2: The Illustrator Scripting Object Model Text objects 21 Color objects Your script can apply a color, pattern or gradient to a path item object, using the fill color or stroke color properties: ➤ Scripts can define new color swatches using the make command or add method of the swatches object. Your script also can create a new spot color, using the make command or add property of the spots object. ➤ You can define the attributes of an ink object using the ink info object, which is an ink object property. You access ink objects through the ink list property of the document object. The following objects allow you to create colors within defined color spaces: ➤ The RGB color object, using the range 0.0 to 255.0 for the each of the three individual color values. ➤ The CMYK color object, using the percentage values 0.0 through 100.0 for each of the four individual color values. ➤ The grayscale color or LAB color objects, using the same range and number of values that you use in the Illustrator application. Text objects When you type content in an Illustrator document, the type automatically becomes a text frame object and, at the same time, a story object. To observe this, open a new document in Illustrator and use the horizontal text tool to type some text, then use the vertical text tool to type more text. Finally, create a rectangle and type some text inside it. Now run the following JavaScript script: var myDoc = 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