StylePainter

This is a free download; it supports Mac & Windows versions of InDesign CS, CS2, CS3 or CS4.
Goal
This tool allows you to search throughout a document for one or more GREP expressions, and ‘paint’ various style attributes onto matching areas of text. GREP is a standardized, powerful way to search and match text patterns.
This tool also works with InDesign CS and InDesign CS2 – bringing some GREP power to these older versions of InDesign.
Most of what this tool offers can also be achieved with GREP styles in CS4, but there are a few differences which mean that even in CS4, this tool has some uses.
The GREP definitions are all listed in a text frame (called the stylepainterframe) which resides on the pasteboard – this makes it easy to re-use and share the same GREP-based style list between multiple documents – simply copy the stylepainterframe between documents.
Second, you can have a whole list of GREP patterns, without needing to create a named style for each individual pattern.
Remark: InDesign CS4 and higher actually have more than one GREP engine inside the application. The GREP engine used by StylePainter is the GREP engine provided within the ExtendScript environment – which has some marked differences to the second GREP engine which is used with InDesign CS4’s named styles.
Example
Imagine you would like to assign a character style to all numbers that occur throughout a document. Install the software first, and then fire up InDesign and open the document.
- Create a character style to your liking (e.g. it could be called AllNumbers or so and it could use a specific font with nice digits).
- Create a text frame on the left hand pasteboard of the first page of the document.
- In this frame, type a line with the following 3 characters
\d+ - This is a GREP expression that matches all numeric strings of one or more digits.
- Now the magic bit: select the GREP expression (i.e. \d+) and format it with the desired AllNumbers character style. The trick is that we link our desired formatting and style to a GREP expression by formatting the GREP expression itself.
- Select the API – StylePainter – Paint Document menu item
If all goes well, all strings of one or more digits in your document will now have theAllNumbers character style applied to them.
Download
This is a free download. Before you can use the StylePainter plug-in you also have to install our free APID ToolAssistant plug-in, which is available as a second, separate download.
Download the StylePainter plug-in (version 1.0.2. Free download. For InDesign CS, CS2, CS3 and CS4 on Mac or Windows; does not include the APID ToolAssistant. Don’t worry about the icon of the .spln file: it might not be a ‘regular’ icon, and that’s OK)
- Macintosh APID ToolAssistant:
- Windows APID ToolAssistant:
You don’t need to purchase a license for APID ToolAssistant (but we’re always grateful if you do – it helps us fund further development). The StylePainter plug-in will work fine with an unlicensed APID ToolAssistant.
To encourage us by purchasing the US$25 optional license, select the API – APID ToolAssistant… menu item, select the ‘APID ToolAssistant’ entry in the list, and click the Get License… button. Purchasing a license helps us fund further development of cool stuff!
If you don’t purchase a license, APID ToolAssistant will show itself as ‘Demo’ for the first 20 days after it was first installed, and after the 20 days are up, it will change to ‘Unlicensed’. Don’t be alarmed by this. It will not stop working. StylePainter works with an unlicensed version of APID ToolAssistant, and purchasing a license is optional.
Let us know if this tool is useful to you, at pluginsupport@rorohiko.com. Thanks!
Installation
Please make sure you have a copy of the APID ToolAssistant plug-in installed.
Make sure you install the proper plug-in for your version of InDesign. InDesign CS, CS2, CS3 and CS4 plug-ins are mutually incompatible.
If you already have an APID ToolAssistant plug-in installed (e.g. because you use one of our other plug-ins), make sure it is up-to-date.
APID ToolAssistant used to be called ‘Active Page Item Runtime‘ – if you have any copies of Active Page Item Runtime or Active Page Item Developer installed, please remove them, and replace them with APID ToolAssistant.
When installing plug-ins make sure you copy plug-in files, not the folders they are contained in.
Copy the StylePainter.spln into the same folder as the APID ToolAssistant plug-in you installed (typically that will be the InDesign Plug-Ins folder). Don’t worry about the icon of the .spln file: it might not be a ‘regular’ icon, and that’s OK.
Usage
You can list as many GREP expressions as you want in the style painter frame on the pasteboard, one GREP expression per paragraph, and you can apply different attributes to each and every one of these GREP expressions.
StylePainter will work its way through your list of GREP expressions from top to bottom, and apply each GREP expression to the whole document in turn.
Check the sample grepstyles.indd document for a few slightly crazy examples.
It is possible that the pasteboard already contains some other text frames that might be confusing for the StylePainter. In that case you can ‘mark’ the stylepainterframe by giving it a script label.
Select the Window – Automation – Script Label menu item or the Window – Scripting – Script Label menu item (if necessary) to make the Script Label panel visible. Select the stylepainterframe, and type
stylepainterframe
in the Script Label panel (in one word, all lowercase. Be careful and avoid adding any whitespace). Then click somewhere else in the pasteboard area to deselect the stylepainterframe.
It is also possible to keep more than one stylepainterframe on the pasteboard all of which would need to have the proper script label.
If this happens, the StylePainter will pick the leftmost, uppermost stylepainterframe – so you can decide which of the stylepainterframe-s is ‘active’ simply by moving it leftmost, and highest on the pasteboard.
Version history
27-Nov-2009 Version 1.0.2:
- Fixed issue when trying to apply the first character style listed on the character palette.
18-May-2008 Version 1.0.1:
- Improved style painting
- Adjusted ReadMe.txt to refer to APID ToolAssistant instead of Active Page Item Runtime.
18-April-2008 Version 1.0 Beta:
- Initial Beta Release
