I was recently needing a way to clear all overrides in a 100+ page book. The book was divided into many separate stories, so it was not possible to simply “select all” and click on the “Clear overrides” button.
Instead of going through each story in turn, selecting all the text there, clearing overrides, and repeating that for each story in the document, I wrote a quick script.
(In fact, if it is necessary to clear all local overrides in footnotes it can be even more time-consuming, as there is no way to select all footnotes in one go. Rather, it would be necessary to clear the overrides one footnote at a time – although if the footnotes have a paragraph style applied then there is a shortcut for doing this.)
The script below will clear all paragraph-level and character-level overrides in the active InDesign document.
To use, simply copy the script into your favorite text editor, save with a .jsx extension, and place into your InDesign Scripts folder.
// Clear All Overrides
// Written by TAW. (c) 2014 by Bookraft Solutions, Israel (Id-Extras.com)
// Please do not delete this copyright notice.
//
var myOverrideType = OverrideType.ALL;
// var myOverrideType = OverrideType.CHARACTER_ONLY;
// var myOverrideType = OverrideType.PARAGRAPH_ONLY;
var allStories = app.activeDocument.stories.everyItem();
// Remove overrides from all stories
try{
allStories.clearOverrides(myOverrideType);
}
catch (e){alert ("No stories!")}
// Remove overrides from all footnotes
try{
allStories.footnotes.everyItem().texts.everyItem().clearOverrides(myOverrideType);
}
catch (e){alert ("No footnotes!")}
// Remove overrides from all table
try{
allStories.tables.everyItem().cells.everyItem().paragraphs.everyItem().clearOverrides(myOverrideType);
}
catch (e){alert ("No tables!")}
alert("Overrides cleared!");
As is, the script will clear all overrides throughout the document from all text, including all text in tables and footnotes. It will clear paragraph-level overrides as well as character-level overrides.
However, it is easy enough to modify the script to suit your needs.
First of all, if you need to clear only paragraph-level overrides, or only character-level overrides, simply comment out the relevant line: Of lines 7, 8, and 9, exactly two should be commented out. (I may add a UI if I get the chance.)
Then, if you do not need to delete overrides from tables, footnotes, or regular text, comment out the appropriate lines there too. It should be self-evident how to do this, but if you have a question, leave a comment below.
Nicole Nicolas
December 29, 2022 6:31 pmHi, is it possible to prevent this from working on master pages? Sometimes I have text on a master page that isn’t linked to a paragraph style, like a title for a cover page, and it’s not overridden in the document, just sitting on the master page. Can I prevent it from changing that?
Ariel
January 8, 2023 11:02 pmHi Nicole,
I’ve played around a little with your idea, but there isn’t a simple way of doing this while keeping the script structure the same.
The point is that in the script above, all stories are collected as what is known as an InDesign “collection,” meaning that an operation can be performed on all the stories in the collection in one go, without having to loop through each story.
This keeps the script quick and simple.
You’re wanting to filter out any stories originating on master pages. It’s definitely not difficult to do, but it means turning the collection of stories into an array of stories and looping through each one individually, filtering out the master-page ones.
Easy to do, but it’s quite a different script. If I get a chance, I will post an update, or an alternative script, that does this, when I get a chance…