Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

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

Community Beginner ,
Jul 14, 2020 Jul 14, 2020

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
Scripting
454
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Guide ,
Jul 14, 2020 Jul 14, 2020

 

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

 

removes all appearance attributes, including brush. 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 15, 2020 Jul 15, 2020

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 15, 2020 Jul 15, 2020

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 15, 2020 Jul 15, 2020

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 15, 2020 Jul 15, 2020
LATEST

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

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