Adobe 65010248 Scripting Guide - Page 20

Art styles, AppleScript, JavaScript

Page 20 highlights

CHAPTER 2: The Illustrator Scripting Object Model The artwork tree 20 ➤ mesh item ➤ non native item ➤ path item ➤ placed item ➤ plugin item ➤ raster item ➤ symbol item (see "Dynamic objects" on page 24) ➤ text frame Your scripts can access and manipulate art objects through collections in the document and layer objects. There are two types of art-object collections: ➤ Collection objects that correspond to each individual artwork object type, such as the graph items object or the mesh items object. ➤ The page items object, which includes art objects of all types. Also, you can use the group item object to reference a grouped set of art items. You can create new art objects using the make command (AppleScript) or add method of an artwork item collection object. For example, to create a new path item object: AppleScript set myPathItem to make new path item in current document JavaScript var myPathItem = activeDocument.pathItems.add(); VBScript Set myPathItem = appRef.ActiveDocument.PathItems.Add() The following artwork collections do not allow the creation of new objects using the make command or add method: ➤ graph items object ➤ mesh items object ➤ plugin items object ➤ legacy text items object For details on creating objects of these types, see the Adobe Illustrator CS4 Scripting Reference for your language. Art styles Your script can apply a graphic style to artwork using the graphic style object. To apply a graphic style, use the graphic styles property of the document object to access the apply to method of the graphic style object. Similarly, the brush object allows you to specify the brush to apply to artwork. You access any brush through the brushes collection object, which is a property of the document object.

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57

C
HAPTER
2: The Illustrator Scripting Object Model
The artwork tree
20
mesh
item
non
native
item
path
item
placed
item
plugin
item
raster
item
symbol
item
(see
Dynamic objects
” on page 24
)
text
frame
Your scripts can access and manipulate art objects through collections in the
document
and
layer
objects.
There are two types of art-object collections:
Collection objects that correspond to each individual artwork object type, such as the
graph
items
object or the
mesh
items
object.
The
page
items
object, which includes art objects of all types.
Also, you can use the
group
item
object to reference a grouped set of art items.
You can create new art objects using the
make
command (AppleScript) or
add
method of an artwork item
collection object. For example, to create a new
path
item
object:
AppleScript
set myPathItem to make new path item in current document
JavaScript
var myPathItem = activeDocument.pathItems.add();
VBScript
Set myPathItem = appRef.ActiveDocument.PathItems.Add()
The following artwork collections do not allow the creation of new objects using the
make
command or
add
method:
graph
items
object
mesh
items
object
plugin
items
object
legacy
text
items
object
For details on creating objects of these types, see the
Adobe Illustrator CS4 Scripting Reference
for your
language.
Art styles
Your script can apply a graphic style to artwork using the
graphic
style
object. To apply a graphic style,
use the
graphic
styles
property of the
document
object to access the
apply
to
method of the
graphic
style
object.
Similarly, the
brush
object allows you to specify the brush to apply to artwork. You access any brush
through the
brushes
collection object, which is a property of the
document
object.