SymbolItems
SymbolItems
Section titled “SymbolItems”app.activeDocument.symbolItems
Description
Section titled “Description”The collection of SymbolItem objects in the document.
Properties
Section titled “Properties”SymbolItems.length
Section titled “SymbolItems.length”app.activeDocument.symbolItems.length
Description
Section titled “Description”Number of elements in the collection.
Number; read-only.
SymbolItems.parent
Section titled “SymbolItems.parent”app.activeDocument.symbolItems.parent
Description
Section titled “Description”The object’s container.
Object; read-only.
SymbolItems.typename
Section titled “SymbolItems.typename”app.activeDocument.symbolItems.typename
Description
Section titled “Description”The class name of the object.
String; read-only.
Methods
Section titled “Methods”SymbolItems.add()
Section titled “SymbolItems.add()”app.activeDocument.symbolItems.add(symbol)
Description
Section titled “Description”Creates an instance of the specified symbol.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
symbol | Symbol | Symbol to instance |
Returns
Section titled “Returns”SymbolItems.getByName()
Section titled “SymbolItems.getByName()”app.activeDocument.symbolItems.getByName(name)
Description
Section titled “Description”Get the first element in the collection with the provided name.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
name | String | Name of element to get |
Returns
Section titled “Returns”SymbolItems.index()
Section titled “SymbolItems.index()”app.activeDocument.symbolItems.index(itemKey)
Description
Section titled “Description”Gets an element from the collection.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
itemKey | String, Number | String or number key |
Returns
Section titled “Returns”SymbolItems.removeAll()
Section titled “SymbolItems.removeAll()”app.activeDocument.symbolItems.removeAll()
Description
Section titled “Description”Deletes all elements in the collection.
Returns
Section titled “Returns”Nothing.
Example
Section titled “Example”Creating a symbol
Section titled “Creating a symbol”// Creates a path item from each graphic style// then adds each item as a new symbol
var docRef = documents.add();var y = 750;var x = 25;
var iCount = docRef.graphicStyles.length;
for (var i=0; i<iCount; i++) {
var pathRef = docRef.pathItems.rectangle( y, x, 20, 20 ); docRef.graphicStyles[i].applyTo(pathRef);
// are we at bottom? if ( (y-=60) <= 60 ) { y = 750; // go back to the top. x+= 200 }
redraw(); docRef.symbolItems.add(pathRef);}