Skip to content

Brush

app.activeDocument.brushes[index]

A brush in an Illustrator document. Brushes are contained in documents. Additional brushes may be created by the user within Illustrator. You can access brushes within a script, but you cannot create them.


app.activeDocument.brushes[index].name

The name of the brush

String


app.activeDocument.brushes[index].parent

The document that contains this brush.

Document; read-only.


app.activeDocument.brushes[index].typename

The class name of the referenced object.

String; read-only.


app.activeDocument.brushes[index].applyTo(artItem)

Applies the brush to a specific art item.

ParameterTypeDescription
artItemPageItemArt item to apply brush to

Nothing.


// Duplicates and groups all items in the current selection,
// then applies the same brush to each item in the group
if (app.documents.length > 0) {
var docSelection = app.activeDocument.selection;
if (docSelection.length > 0) {
var newGroup = app.activeDocument.groupItems.add();
for (var i = 0; i < docSelection.length; i++) {
var newItem = docSelection[i].duplicate();
newItem.moveToBeginning(newGroup);
}
var brush = app.activeDocument.brushes[1];
brush.applyTo(newGroup);
}
}