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

How to streamline this script and disable any popup prompts.

Advisor ,
Dec 25, 2024 Dec 25, 2024

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!")}

 

 

TOPICS
Bug , Feature request , How to , Scripting

Views

129

Translate

Translate

Report

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 ,
Dec 25, 2024 Dec 25, 2024

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;

 

Votes

Translate

Translate

Report

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
Advisor ,
Dec 25, 2024 Dec 25, 2024

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){}
	

 

Votes

Translate

Translate

Report

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 ,
Dec 26, 2024 Dec 26, 2024

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

Votes

Translate

Translate

Report

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 ,
Dec 26, 2024 Dec 26, 2024

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.

Votes

Translate

Translate

Report

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 ,
Dec 26, 2024 Dec 26, 2024

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

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