Categories
InDesign

InDesign Find & Style Paragraphs

If you have text that’s been imported with basic text tags to define what style should be applied to that specific paragraph, you can use a simple script to delete those “Text Tags” and apply the corresponding paragraph style.

For example, say you have the following text:

[HEADER] This is a Simple Header
[SUBHEAD] Subtitle Goes Here
Nullam quis risus eget urna mollis ornare vel eu leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Integer posuere erat a ante venenatis dapibus posuere velit aliquet.

And you want it to be formatted like so:

This is a Simple Header
Subtitle Goes Here
Nullam quis risus eget urna mollis ornare vel eu leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Integer posuere erat a ante venenatis dapibus posuere velit aliquet.

Here’s how to achieve this with a simple script that can save you a heap of time when you have a lot of such tags.

  1. In the Scripts panel, open the folder: Application > Samples > JavaScript > FindChangeSupport
  2. Right click on the .txt file and choose “Reveal in Finder”
  3. Open the .txt file in a text editor, add these two lines to the end of the file and save it (you can substitute the underlined strings with any combination you’d like, the first one is the “Text Tag” that’s currently in your document and the second is the name of the paragraph style that you want to apply to the matching paragraphs)
    text {findWhat:"[HEADER]"} {changeTo:" ", appliedParagraphStyle: "Heading"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}
    text {findWhat:"[SUBHEAD]"} {changeTo:" ", appliedParagraphStyle: "Subhead"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}
  4. Make sure that you have corresponding paragraph styles in your InDesign document
  5. Double click the script: Application > Samples > JavaScript > FindChangeList.jsx

Leave a Reply

Your email address will not be published. Required fields are marked *