Free Scripts Help Fix Word Formatting
At the InDesign Conference in Washington, D.C. (which is about to begin Day 2 as I write this), I presented a seminar on tips and techniques for successful Word/ID workflows. I started to run out of time as I got to the topic of useful scripts, and promised the attendees I'd post here to recap what I said and to link to them.
Faithful blog readers will recognize a couple of these being mentioned in a comment or two in the past, but I think you'd agree they deserve to get top billing in an actual post. ;-)
Convert Local Formatting to Character Styles
- Preserve Local Formatting.jsx is by Dave Saunders and works for InDesign CS1 (change the script's extension to .js), CS2, and CS3. Preserve Local Formatting can run through a selection of text (or the whole document, if nothing is selected) and replace locally-formatted bolds and italics, among others, with equivalent character styles. The script adds the styles to the Character Styles palettes on its own - no need to create them yourself.
- PrepText.zip is by Jongware, and works with CS4 only. It unzips to a .jsx script. It works just like Dave's script, or you can read the InDesign Forum thread on Adobe.com where Jongware first posted a link to the script and gave some tips on how to best use it, if you like.
In the screen shot below, I started with a paragraph full of various text styles, all created with local (manual) formatting, and an empty Character Styles panel. I opened my Scripts panel (Windows > Automation) and double-clicked the PrepText.jsx script, which created and applied all the character styles you see below.
The ability to convert local formatting into Character Styles is also available with David's upcoming BlatnerTools plug-in for InDesign CS3 or CS4, along with dozens of other functions. You can download a free public beta of the cross-platform plug-in from the Blatner Tools page on the DTP Tools site.
Convert GREP and Nested Styles to Manual Character Styles
Let's say you're a clever gal or guy and you've tweaked certain paragraph styles to automatically apply character styles according to your specs, either via the Nested Styles pane (CS3 and CS4) or the GREP Styles pane (CS4). Everything works perfectly ... until you need to export text formatted with those automatically-applied character styles, such as exporting to RTF to share with a Word user. The character style formatting gets lost, and the text reverts to its base formatting defined by the paragraph style.
To retain the formatting, you need to manually apply the character style to every instance of styled text. But why waste your time doing that tedious work when two wonderful people have come up with scripts that do that for you?
- ApplyNestedStyles.zip (CS3 and CS4) is a cross-platform script written by our friend Harbs (owner of In-Tools) that takes care of the Nested Styles problem. It doesn't change the paragraph style definition at all, the paragraph style is still applying its Nested Styles as defined. It's just that, when you run the script, the affected text also gets the same character style applied to it manually, meaning it will be correctly formatted when you export it.
- TurnGrepStyles2CharStyles.zip (CS4) is a cross-platform script written by an Adobe guru from Israel named Adi Ravid. Like ApplyNestedStyle, the script manually applies the same character style to text that is styled that way because of a GREP Style defined in the parent paragraph style, and doesn't touch the paragraph style definition. Unfortunately I didn't bookmark the page where I learned about it - probably from a forum - and can't find much on Google other than Adi's mac.com public download folder where I first got the script.
The two paragraphs below are formatted with a paragraph style that uses Nested Styles to make the first word red (character style: Red text) and the next three words bold (character style: Bold lead-in). Running Harbs' ApplyNestedStyles.jsx script doesn't change how the text looks, but I can tell it's done its job by selecting some of the styled text and looking at the Character Styles panel.
The style entry "Bold lead-in" is highlighted, indicating the style has been manually applied (and so the text will export with the correct formatting). But notice how you still see the notation "Bold lead-in" in the bottom status area of the panel, next to a paragraph symbol, which is InDesign's way of telling us the character style is being applied via a paragraph style.
Converting Nested and GREP'd styles to manually-applied Character Styles is also useful when you export a layout to INX (CS3 would lose CS4's GREP Style formatting, for example); and when exporting text to ePub, XHTML, and XML.
I recommend you run these scripts on a copy of the file, though, because you really can't do any major editing of the text without having to be careful to watch for and remove the manually-applied character styles when necessary. For example, if you add a word before the first word in either of the paragraphs in the above screen shot, you're going to end up with two words that are red, since the existing one has the style manually applied to it.