Highlighted

How to "unapply" (ie, remove) a brush from a page item in javascript/extendscript

Community Beginner ,
Jul 14, 2020

Copy link to clipboard

Copied

To apply a brush to a page item in javascript, I can do this:

 

var brush = app.activeDocument.brushes.getByName("My Brush");
brush.applyTo(somePageItem);

 

But how would I remove a brush from a page item? I don't see any way to do that.

 

Note I don't want to remove the brush from the brushes palette or from a brush library, I want the page item to no longer have any brush applied. There is always a "Basic" brush in every brush library by default, it seems, but that doesn't seem to be accessable, ie, this gives an error:

 

var brush = app.activeDocument.brushes.getByName("Basic");

 

since there really is no brush with that name.

 

TOPICS
How to, Scripting

Views

89

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

How to "unapply" (ie, remove) a brush from a page item in javascript/extendscript

Community Beginner ,
Jul 14, 2020

Copy link to clipboard

Copied

To apply a brush to a page item in javascript, I can do this:

 

var brush = app.activeDocument.brushes.getByName("My Brush");
brush.applyTo(somePageItem);

 

But how would I remove a brush from a page item? I don't see any way to do that.

 

Note I don't want to remove the brush from the brushes palette or from a brush library, I want the page item to no longer have any brush applied. There is always a "Basic" brush in every brush library by default, it seems, but that doesn't seem to be accessable, ie, this gives an error:

 

var brush = app.activeDocument.brushes.getByName("Basic");

 

since there really is no brush with that name.

 

TOPICS
How to, Scripting

Views

90

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jul 14, 2020 0
Engaged ,
Jul 14, 2020

Copy link to clipboard

Copied

 

app.activeDocument.graphicStyles["[Default]"].applyTo(app.activeDocument.pathItems["yourPathItemName"]);

 

removes all appearance attributes, including brush. 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 14, 2020 0
Community Beginner ,
Jul 15, 2020

Copy link to clipboard

Copied

Is that the only way? I also may have effects applied that I do not want to remove, so this method won't work for me.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 15, 2020 0
Adobe Community Professional ,
Jul 15, 2020

Copy link to clipboard

Copied

record an Action to Remove Brush Stroke, then have the script play the action

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 15, 2020 0
Community Beginner ,
Jul 15, 2020

Copy link to clipboard

Copied

Thanks for the idea, I'll give that a try. I was hoping there was a native code method of doing it but I guess that's often not the case with adobe scripting.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 15, 2020 1
Adobe Community Professional ,
Jul 15, 2020

Copy link to clipboard

Copied

yeah, using actions is our last hope, not everything is accessible to scripting unfortunately.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 15, 2020 0
Resources