Skip to main content
Known Participant
August 20, 2008
Question

Delete Unused Paragraph Styles

  • August 20, 2008
  • 13 replies
  • 20271 views
Hi All,

I realize this one is probably pretty easy, but it has given me some grief these last few minutes. I'm trying to delete all unused paragraph styles in a document in InDesign CS. Here's the latest on what I have:

tell application "InDesign CS" to delete every unused paragraph style of document 1

I can't even get it to compile that. I've tried several variations, but all had the same result...it does not seem to like where I placed the word "unused", but I can't seem to figure out any other correct syntax.

Any help is greatly appreciated!
This topic has been closed for replies.

13 replies

Inspiring
August 21, 2008
You have to think of the UI as a large, efficient script that was written using the object model. Many of the things it does have a one-to-one relationship with what can be done in the object model, but equally, many of the things it does don't have such a relationship. You've picked one of the latter.

But yes, you can write such a script. I have in the past. I even wrote a blog entry about it:

http://jsid.blogspot.com/2005_08_01_archive.html

Scroll down to "Style in Use" -- it was written three years ago, so it might not be completely up-to-date; it probably uses the older search mechanism, for example.

Dave
Known Participant
August 21, 2008
Thanks for your reply, Dave.

When I go to the Paragraph Styles palette in InDesign and click the right arrow and click "Select All Unused", then whatever styles that have not been applied to any text in the document are then highlighted for easy deletion. I'd really like to be able to automate that menu action with either a simple command (ie: delete all unused paragraph styles of document 1) or with a menu command (ie: get menu item 3 of menu...). I just have not been able to get the syntax correct to be able to do it.

I get what you are saying. It just seems that if I can click on the item with a mouse and have InDesign perform the action, I should also be able to automate that same action with a command of some type. What do you think?
Inspiring
August 20, 2008
There is no such thing as an unused paragraph style as far as the object model is concerned. You have to examine the paragraph styles and determine whether or not they're used.

Is any text set in them? Use search for that.
Is any other style based on this one? If yes, does that mean it is in use? Up to you to decide.
Is this the "Next Style" for some other style? If yes, does that mean it is in use? Again, up to you.

Dave