Skip to content

Symbols

app.activeDocument.symbols

The collection of Symbol objects in the document.


app.activeDocument.symbols.length

Number of elements in the collection.

Number; read-only.


app.activeDocument.symbols.parent

The object’s container.

Object; read-only.


app.activeDocument.symbols.typename

The class name of the object.

String; read-only.


app.activeDocument.symbols.add(sourceArt[, registrationPoint])

Returns a symbol object created from the source art item, any of the following:

The default registration point is SymbolRegistrationPoint.SYMBOLCENTERPOINT.

ParameterTypeDescription
sourceArtPageItemSource art to create symbol from
registrationPointSymbolRegistrationPoint, optionalRegistration point to use

Symbol


app.activeDocument.symbols.getByName(name)

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

ParameterTypeDescription
nameStringName of element to get

Symbol


app.activeDocument.symbols.index(itemKey)

Gets an element from the collection.

ParameterTypeDescription
itemKeyString, NumberString or number key

Symbol


app.activeDocument.symbols.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.symbols.add(pathRef);
}