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

How to De-Clutter InDesign Styles, Characters, and Parents across book documents

Community Beginner ,
Dec 19, 2024 Dec 19, 2024

I couldn't find scripts to reduce the number of character and paragraph styles, and parent pages across multiple documents without reducing unused styles I might need later which were in use in other book documents. I found a few scripts and community posts that would reduce the style or parent page by comparing only within one document at a time. What I couldn't find were scripts to iterate through a set of documents and keep styles or parents in use across all documents and remove the unused across all open documents.

 

So I tried my hand at authoring scripts with help from an LLM. My goals in these scripts are in context of managing book documents and combining various documents and then reducing clutter. I didn't want to figure out how to iterate through book documents or handle opening and saving a document if it wasn't open already, so I stuck to the documents that are open at the time the script runs.

 

I wish reducing unused styles and parents across multiple documents was a feature of InDesign.

 

For those who are better at scripting, here is a link to the github repo where I have my proof of concepts stored. If you believe the scripts can be improved please improve them. I haven't attempted UXP or plugins. It would be nice if these had a better visual workflow.

 

The general steps of each script are:

  1.  loop through open documents and track which styles or parent pages are in use
  2. for parent pages, look through parents and track which parents have nested parents applied
  3. tell the user in an alert which styles are in use
  4. loop through the open documents again and remove styles or parents that aren't in use in any of the open documents.

 

My aim in posting to the community is to help any other who might be looking for the same.

TOPICS
Feature request , Scripting , UXP Scripting
762
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 ,
Jan 14, 2025 Jan 14, 2025

Why do you need this - if they're not in use then there's no issue, right? So it has 0 impact.

 

And they might be needed at a later date.

 

Just curious why you need to remove them?

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
People's Champ ,
Jan 15, 2025 Jan 15, 2025

I think "decluttering" is a valid reason, as the OP mentions.

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 ,
Jan 15, 2025 Jan 15, 2025

Thanks for your thoughts, @TᴀW. I can see how decluttering might be useful for some workflows, especially in projects with a lot of styles and parent pages. My curiosity stems from the idea that if these elements aren’t actively causing issues, why go through the effort of removing them? It seems like it could risk removing something that might be needed later.

 

@Jonathan36598472odjx, could you share more about specific scenarios where having fewer styles or parent pages has improved your workflow? It might help me (and others) better understand the tangible benefits of decluttering in this way.

 

I'm not saying dont' 'declutter' and I'm not saying it's a bad idea - I'd just like to know more about it to better understand the request and offer a solution with more information.

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 Beginner ,
Jan 15, 2025 Jan 15, 2025

Hi @Eugene Tyson,

 

To directly answer your question "Why remove them?", it's so I'm only seeing styles and parent pages I intend to use and remove redundant and orphaned styles I never intend to use again. I wanted to keep book-wide styles and parent pages so they're available within a document if needed.

 

The context is a set of indesign documents within a book. The documents were their own thing with their own styles and then I started conforming them to the same set of paragraph, object, character styles and master/parent pages. Indesign synchronizes by adding and updating only, so the number of styles and parent pages grew over a short amount of time. After conforming all of the documents there were orphaned styles and parent pages, enough to be cumbersome, but also unused styles and parents used in other documents that might be considered book styles and parent pages to be used as needed.

 

Another factor is out editorial work flow was someone else editing in word and I was importing the story into Indesign and synchronizing changes. The default word import generated 20+ paragraph and 10+ character styles for each import or instance when the author of the document wasn't using a document I had prepared for them to use.

 

All combined across all documents there must've been 100+ styles to sift through.

 

Given the presence of orphaned InDesign and Word styles and unused but necessary book-wide Indesign styles and parent pages, the script attempts to take into consideration styles in use across all open documents (a stand-in for processing book documents) and remove only unused items.

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 ,
Jan 15, 2025 Jan 15, 2025

@Jonathan36598472odjx

 

If you work on a PC - you could use my ID-Tasker tool. 

 

Even in the free version you can load Styles' info from multiple documents - then sort and filter. 

 

Paid version - can automatically process whole server full of INDD files - rename, remove, reorganise, compare, create a report so you can decide what to do, etc. 

 

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 Beginner ,
Jan 15, 2025 Jan 15, 2025

I remember you DM'ing me about this. It looks very cool.

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 ,
Jan 15, 2025 Jan 15, 2025

@Jonathan36598472odjx

 

You've overcomplicated things - not you but LLM - please check this thread:

 

https://community.adobe.com/t5/indesign-discussions/script-to-delete-all-unused-styles-object-paragr... 

 

There is no need to iterate through ALL Characters / Paragraphs - you can invoke() command from the pallet - to remove unused. 

 

Also - there can be CharStyles used in ParaStyles used in Cell Styles.

 

Can't check this right now - but i think CharStyles used in GREP Styles are also not reported when checking CharStyle applied to the text. 

 

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 Beginner ,
Jan 15, 2025 Jan 15, 2025

I encountered this issue with the GREP setting within a paragraph style where the character style it used was only used within it and the character style was deleted. I'm unsure how to address it.

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 ,
Jan 15, 2025 Jan 15, 2025

@Jonathan36598472odjx

 

Please check the link - by using invoke() - you are offloading this checking to InDesign 😉

 

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 ,
Jan 15, 2025 Jan 15, 2025

And it's WAY quicker than iterating through everything 😉 

 

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 ,
Jan 15, 2025 Jan 15, 2025

There is also one more method - the best one - copying ALL pages to a new document. 

 

This way - you are purging EVERYTHING that is not used. 

 

But you need to copy all pages together - using itemByRange - you can't copy them one-by-one as you'll break text threads. 

 

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 ,
Jan 15, 2025 Jan 15, 2025

@Jonathan36598472odjx

 

If you really want to use your method - iterating through all Characters - it will be quicker if you would switch to iterating Text Style Ranges.

 

TSR is at least one Character with exactly the same formatting. So if you'll have a paragraph with first word in bold - then 200+ characters in regular - you'll have only TWO TSRs to check - instead of 200+ characters. 

 

The same with 10x 500x character long paragraphs - styled exactly the same - you'll have ONE TSR - instead of 5000x characters. 

 

 

Unfortunately, LLM's are still far behind human experience.

 

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 Beginner ,
Jan 15, 2025 Jan 15, 2025

@Robert at ID-Tasker 

 

I didn't know about Text Style Ranges, thank you for your insight. 

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 ,
Jan 15, 2025 Jan 15, 2025
quote

@Robert at ID-Tasker 

 

I didn't know about Text Style Ranges, thank you for your insight. 


By @Jonathan36598472odjx


You're welcome. 

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 ,
Jan 15, 2025 Jan 15, 2025
LATEST

There is one more way to do it - I'll just pitch in idea as I'm on my phone and I'm not JS guy - using everyItem() and getElements() - then sort - those two can be done as a one-liner. 3rd step - removal of duplicates - I think there is a Set()? Or a loop through all elements.

 

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