Skip to main content
Participant
December 19, 2024
Question

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

  • December 19, 2024
  • 5 replies
  • 800 views

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.

5 replies

Robert at ID-Tasker
Legend
January 15, 2025

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.

 

Robert at ID-Tasker
Legend
January 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.

 

Participant
January 15, 2025

@Robert at ID-Tasker 

 

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

Robert at ID-Tasker
Legend
January 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. 

Robert at ID-Tasker
Legend
January 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-paragraph-and-text-in-all-open-documents/td-p/14793153 

 

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. 

 

Participant
January 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.

Robert at ID-Tasker
Legend
January 15, 2025

@Jonathan36598472odjx

 

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

 

Robert at ID-Tasker
Legend
January 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. 

 

Participant
January 15, 2025

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

Community Expert
January 15, 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?

TᴀW
Legend
January 15, 2025

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

id-extras.com | InDesign tools & scripts for typesetters, form designers, and translators
Community Expert
January 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.