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

Script to remove overrides

Advocate ,
Sep 21, 2011 Sep 21, 2011

Does anyone know of a script that can remove paragraph overrides from text that is selected with the Type tool?

I have many paragraphs that have nested styles. InDesign does not implement the nested style untl I select the paragraph and Alt-click the style in the Paragraph Styles panel to remove the override. After that, the paragraph has the correct formatting.

This is hugely time-consuming because I have to place many such paragraphs in a very long document.

I don't want to remove overrides throughout the whole document, just those paragraphs that are selected. That way, I can place a bunch of text into InDesign, select the text and remove the overrides, before moving it into place on the layout.

If anyone can help, it would be a tremendous relief to me.

TOPICS
Scripting
10.9K
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
LEGEND ,
Sep 21, 2011 Sep 21, 2011

app.selection[0].clearOverrides(OverrideType.PARAGRAPH_ONLY);

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
Advocate ,
Sep 21, 2011 Sep 21, 2011

Harbs,

Thank you so much for your quick reply. Does this script remove overrides in multiple types of paragraphs?

I need to select a bunch of paragraphs, each paragraph may have a different style applied to it, and remove the overrides from all of them at once.

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
LEGEND ,
Sep 21, 2011 Sep 21, 2011

Yes.

It only removes paragraph level overrides.

If you need it to remove all overrides, remove the argument: OverrideType.PARAGRAPH_ONLY

Harbs

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
Advocate ,
Sep 21, 2011 Sep 21, 2011

Harbs,

Got a chance to try out your script this evening. I'm using InDesign CS5. I saved the script as a plain text file with a .jsx file extention, and put the script into the User folder inside the Scripts folder.

It shows up in the InDesign Scripts panel. I tried using it by selecting a couple of paragraphs with overrides, and then clicking on the script in the Scripts panel. It didn't remove the overrides. These paragraphs have nested styles, so I thought that perhaps I need to remove the "OverrideType.PARAGRAPH_ONLY"

The revised script looks like this:

app.selection[0].clearOverrides;

However, that didn't work either.

What am I doing wrong that the script isn't working for me? I hope that you have a suggestion.

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
Advocate ,
Sep 21, 2011 Sep 21, 2011

Harbs,

Adding to my message, if I select each paragraph one at a time, and Alt-Shift-click on the style in the Paragraph Styles panel, it removes the overrides. Of course, I'm trying to avoid doing one paragraph at a time.

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 ,
Sep 22, 2011 Sep 22, 2011

Jay,

Experiment with different types of override:

app.selection[0].clearOverrides(OverrideType.ALL);

app.selection[0].clearOverrides(OverrideType.PARAGRAPH_ONLY);

app.selection[0].clearOverrides(OverrideType.CHARACTER_ONLY);

Your app.selection[0].clearOverrides will never work: it's a method and should always have two parentheses at the end: app.selection[0].clearOverrides(). Don't know if that'll work, though.

Peter

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
LEGEND ,
Sep 22, 2011 Sep 22, 2011

The default of clearOverrides() is OverrideType.ALL

so

app.selection[0].clearOverrides(); is the same thing as app.selection[0].clearOverrides(OverrideType.ALL);

Harbs

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 ,
Sep 22, 2011 Sep 22, 2011

Aha! Thanks.

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
Participant ,
Dec 03, 2017 Dec 03, 2017

Thank you. More than 6 years after you posted this it let me get rid of the odious "ideoSpaceBehavior" override that no one to my and Google's knowledge ever solved! BTW, in more than 10K paragraphs where the usual alt-click to remove overrides would only do 1 para at a time.

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
Explorer ,
Jan 13, 2021 Jan 13, 2021

That ideoSpaceBehaviour thing has snuck into some of my style sheets, and I have no idea how to get rid of it. How did this help?

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
Enthusiast ,
Jul 23, 2022 Jul 23, 2022

@Peter Kahrel Wow thats a great sharing.
What would be a good exampel of Paragraph_only override and Character_only override. 

I colored a paragraph and tried paragraph_only overide code mentioned above. It did not work. OveridtyTypeAll is working. I havent tried Character_only. Thats the reason I ask. Thanks in advance.

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
Enthusiast ,
Jul 23, 2022 Jul 23, 2022
LATEST

Ok finally I understood what it means.

Character only styles are covered by Character Panel in Indesign. Similarly Paragraph Only styles are covered by Paragraph Panel. All covers both.

Thanks

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
Advocate ,
Sep 21, 2011 Sep 21, 2011

Harbs,

Another thought. If this script removes overrides from only one paragraph style at a time, could it be revised to list all of the paragraph styles that need overrides removed?

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
Advocate ,
Sep 23, 2011 Sep 23, 2011

Thank you Harbs and Peter, for your suggestions.

I tried the following scripts, none of which have worked:

app.selection[0].clearOverrides()

app.selection[0].clearOverrides(OverrideType.CHARACTER_ONLY);

app.selection[0].clearOverrides(OverrideType.PARAGRAPH_ONLY);

app.selection[0].clearOverrides(OverrideType.ALL);

Unfortunately, InDesign is still clinging tightly to the overrides. If it would help for me to upload a few paragraphs for you to look at, let me know.

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 ,
Sep 24, 2011 Sep 24, 2011

> If it would help for me to upload a few paragraphs for you to look at, let me know.

By all means do.

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 23, 2018 Jul 23, 2018

Hi Peter,

I know this is a very old discussion.

But can you remember if Jay Fresno provided a sample text where clearOverrides() did not work entirely?

And perhaps alt + click or alt + shift +click the paragraph style did work?

Thanks,
Uwe

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 23, 2018 Jul 23, 2018

I don't think he did. Those key strokes you mentioned are keyboard equivalents of the clearOverrides() parameters.

P.

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 23, 2018 Jul 23, 2018

Thanks, Peter!

Best,
Uwe

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