Skip to main content
andreasf
Inspiring
September 21, 2011
Question

Please: Need quick tips how to Script Indesign to clear ALL style overrides

  • September 21, 2011
  • 1 reply
  • 2060 views

Hi,

Having spent hours trying to figure out this myself I need your help.

I'm trying to write a script that tells Indesign to

Clear all local style overrides in both character and paragraph styles

Need to work on whatever style

I desperately need this, so that I can assign a shortcut to Indesign to fix this.

Please post the whole code – from first to last line – and tell me what I should name the file (js or jsx).

I am kind of new to scripts so its all jibberish to me.

Hope someone can help me out.

(Found this post but cant figure out how to do this, I just get script errors in Indesign, but that can be because I dont have the whole script

http://forums.adobe.com/message/3926903#3926903)

This topic has been closed for replies.

1 reply

Harbs.
Legend
September 21, 2011

app.documents[0].stories.everyItem().clearOverrides()

(This will not get footnotes or tables.)

Harbs

andreasf
andreasfAuthor
Inspiring
September 21, 2011

Great!!!

How can I get the script to affect:

1. Only selected paragraph (if possible)

2. Only selected textbox/es (if possible)

If that can be done, this would be a real lifesaver for me.

September 22, 2011

Try this script. It goes through your selection and clears overrides from selected text and text frames.

var mySelection;

for (var i = 0; i < app.selection.length; i++){

    mySelection = app.selection;

    if (mySelection instanceof TextFrame){

        mySelection.paragraphs.everyItem().clearOverrides();

    } else if (mySelection.hasOwnProperty("clearOverrides")){

        mySelection.clearOverrides();

    }

}