You probably know the issue, which I have also mentioned in a previous blog post - you can't search on paragraph style combinations using GREP search.

The obvious case where this could be handy, is if your story contains a lot of subheadings and indented paragraphs, and you want to make all indented paragraphs, not indented if they are appearing below a subheading. As I mentioned in the GREP wishlist article my current way to do this is by exporting the story as tagged text, and do a regular expression search in a text editor.

Subheadings followed by an indented paragraph.

Subheadings followed by an indented paragraph

But not anymore!

Today I wrote a small AppleScriptJavaScript to take care of the issue - it is actually quite simple and doesn't require much introduction. Once you have launched the script, you are asked what pair of styles you are looking for, and what you want them changed to:

Fix paragraph style pairs.

Fix paragraph style pairs

The script will search the current story and fix all occurrences of the pair.

The AppleScriptJavaScript can be downloaded here: fix_pstyle_pairs.jsx.

You can add it to your Scripts palette and run it from there. To do that, place the file inside the "~/Library/Preferences/Adobe InDesign/Version 6.0/Scripts/Scripts Panel" folder. It should work in CS3 and CS4 in Windows and Mac.

Comments

deborah rich wrote:

I tried your script, but it didn't work.

I got the error:
Error Number -1708
Error String: Adobe InDesign CS4 got an error: page id 190 of spread id 185 of document "script test.indd" doesn't understand the find grep message.
File: /Users/deborahrich/Library/Preferences/Adobe InDesign/Version 6.0/en US/Scripts Panel/fix_pstyle_pairs.scpt

Silkjaer wrote:

Deborah: I might have forgotten to mention in the post, that you have to have the text pointer placed in the story you wish to perform the search in.

I am sorry about that, but that should "fix" the error you mention.

Dear Thomas,
I made an interesting observation: your neat script can see only those styles which are not arranged in groups!
This info may be helpful for those who failed to use it.
Thank you very much for your script.
Nadya

...?indesigning.net veo que han creado un script en esta entrada de su blog que busca dos estilos y los sustituye por otros dos que es justo lo que queremos hacer:...

...t can save you a bundle of production time!
Important Links Thomas Silkjær’s totally awesome Fixing Paragraph Style Combinations script. Bumper music is by Creature...

Marcos wrote:

¿Cómo puedo hacer que en la lista de estilos aparezcan todos los estilos (grupos de estilos incluidos), o los de un grupo concreto?

Marcos wrote:

How can I see styles arranged in groups?

Silkjaer wrote:

Marcos: The script unfortunately can't see styles in groups. A quick solution is to temporarily move the styles out of their groups.

maria wrote:

Thomas, please help. How do I update page references in a long document (this is not an index issue, more of a content issue)? I have searched hi and lo for a script. For example. I have a sentence on page 3 of 128 pages, which ends (see page XX). Often the reference is way ahead in the document (say, on page 58), and I tediously go through and update the 'xx' as the document changes, sometimes two or three times (page 58 may become 62, or 83, etc). I need to somehow make a marker next to 'xx' which automatically changes the number to the new anchor further ahead.

Cheers.
Maria

Silkjaer wrote:

Maria: Please take a look at InDesign CS4's cross reference feature - it is exactly what you are looking for.

Greg Ledger wrote:

Hi,
This is the script I've been looking for. I can add it to an Applescript I wrote, and almost automate then entire styling process.

Wish there was a translator, or at least a guide to making Applescripts into Javascripts. I get confused by that whole +i vs. i+ thing.

Orielwen wrote:

I used this a lot in CS4, but now in CS5 it crashes InDesign! Any chance of an update?

Write a comment!