Copy link to clipboard
Copied
Hello, everyone.
How to streamline this script and disable any popup prompts.
Thank you very much.
// 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!");
// Remove overrides from all cells
try{
allStories.tables.everyItem().cells.everyItem().clearCellStyleOverrides(true);
}
catch (e){alert ("No tables!")}
Copy link to clipboard
Copied
You need to add this:
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;
at the beginning.
Then this - at the end:
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
Copy link to clipboard
Copied
I merged it, but for some reason it didn't work as well as the sentence-by-sentence.
try{
// Remove overrides from all stories
allStories.clearOverrides(myOverrideType);
// Remove overrides from all footnotes
allStories.footnotes.everyItem().texts.everyItem().clearOverrides(myOverrideType);
// Remove overrides from all table
allStories.tables.everyItem().cells.everyItem().paragraphs.everyItem().clearOverrides(myOverrideType);
// Remove overrides from all cells
allStories.tables.everyItem().cells.everyItem().clearCellStyleOverrides(true);
}
catch (e){}
Copy link to clipboard
Copied
Can you please elaborate what did not work? it Did you add the lines @Robert at ID-Tasker gave and you still see alerts and popups? Or does the original script not perform as you want it to?
-Manan
Copy link to clipboard
Copied
The script has a notice at the top:
Written by TAW. (c) 2014 by Bookraft Solutions, Israel (Id-Extras.com)
You should write to TAW (Ariel Walden), the web address is there.
Copy link to clipboard
Copied
Hi @Peter Kahrel,
Writing to the original author is always the first thing to consider. However, the OP seemed to have a very simple ask not related to the script in question and @Robert at ID-Tasker did answer it. The thing that bothered me is a terse statement that it does not work and then a code snippet. Very difficult to understand and help. It's like spending your own time to first make sense of the little information supplied and then come up with a suggestion that may or may not help. Tough task. I am pretty sure Ariel would also not be able to help with the ask here 🙂
-Manan