Skip to content

SymbolItems

app.activeDocument.symbolItems

The collection of SymbolItem objects in the document.


app.activeDocument.symbolItems.length

Number of elements in the collection.

Number; read-only.


app.activeDocument.symbolItems.parent

The object’s container.

Object; read-only.


app.activeDocument.symbolItems.typename

The class name of the object.

String; read-only.


app.activeDocument.symbolItems.add(symbol)

Creates an instance of the specified symbol.

ParameterTypeDescription
symbolSymbolSymbol to instance

SymbolItem


app.activeDocument.symbolItems.getByName(name)

Get the first element in the collection with the provided name.

ParameterTypeDescription
nameStringName of element to get

SymbolItem


app.activeDocument.symbolItems.index(itemKey)

Gets an element from the collection.

ParameterTypeDescription
itemKeyString, NumberString or number key

SymbolItem


app.activeDocument.symbolItems.removeAll()

Deletes all elements in the collection.

Nothing.


// 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);
}