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.

Changelog

1.2: InDesign CS5 support, and support for paragraph styles in paragraph style groups

I have been experiencing strange issues with the InDesign history after running some of my scripts (AppleScript or JavaScript).

Specifically I have created a floating palette using ScriptUI in JavaScript that contains a list of icon buttons, that when clicked runs an AppleScript, using doScript. This is an example of the code:

Running an AppleScript from JavaScript.

app.doScript(File('the_script.scpt'), ScriptLanguage.applescriptLanguage, ["argument_1","argument_2"], UndoModes.fastEntireScript);

Since the AppleScripts are performing a lot of actions, and I only want to save all these actions as one single "undo", I apply UndoModes.fastEntireScript to the doScript.

When I have run this script just once, the undo history of the InDesign document in general is changed. When working normally and undoing once, it will undo the last many steps and not just one step as usual.

What is the problem here? Does changing the UndoMode for a single script execution change the documents UndoMode as well? Is it a bug, or just an user error - what can I do to prevent it?

Recently I was introduced to the hidden "World-Ready composer" in InDesign CS4. It is really nice to see a little of how Adobe is preparing for the future in typesetting complicated, right to left languages etc.

After becoming aware of this new composer, some of the documentation I had previously stumbled across in InDesigns AppleScript library became more obvious, "kashidas", "diacritic position" etc.

An example of Arabic in InDesign CS4.

Arabic text in InDesign CS4

A little searching around the internet, I ended up at Thomas Phinney's fantastic blog, World-Ready Composer in Adobe CS4, where he explains the specifics about what the new composer is for, and why it wasn't officially documented and included in CS4, and gives you a lot of different tools to enable and use these features in InDesign.

The settings

After reading through all the documentation I could find, i have made a short list here, of things that can be applied to text in InDesign CS4 through e.g. AppleScript.

character direction

The direction of the character. Can be default direction, left to right direction or right to left direction.

composer

The text composer to use to compose the text. Can be "Adobe World-Ready Paragraph Composer", "Adobe World-Ready Single-line Composer", "Adobe Paragraph Composer" or "Adobe Single-line Composer".

diacritic position

Position of diacriticical characters. Can be default position, loose position, medium position, tight position or opentype position.

digits type

The digits type. Can be default digits, arabic digits, hindi digits, farsi digits, Native digits, full farsi digits, thai digits, lao digits, devanagari digits, bengali digits, gurmukhi digits, gujarati digits, oriya digits, tamil digits, telugu digits, kannada digits, malayalam digits, tibetan digits, khmer digits or burmese digits.

kashidas

Use of Kashidas for justification. Can be default kashidas or kashidas off.

keyboard direction

The keyboard direction of the character. Can be default direction, left to right direction or right to left direction.

paragraph direction

Paragraph direction. Can be left to right direction or right to left direction.

paragraph justification

Paragraph justification. Can be default justification, arabic justification or naskh justification.

x offset diacritic

The x (horizontal) offset for diacritic adjustment.

y offset diacritic

The y (vertical) offset for diacritic adjustment.

Small activation script

If you would like to play around with this, I have written a small piece of AppleScriptJavaScript that creates a paragraph style with these settings:

  • character direction: right to left direction
  • composer: "Adobe World-Ready Paragraph Composer"
  • digits type: arabic digits
  • paragraph direction: right to left direction
  • paragraph justification: arabic justification
  • kashidas: default kashidas
  • diacritic position: opentype position

The AppleScriptJavaScript can be downloaded here: create_arabic_pstyle.jsx. Modify the script to your needs, the AppleScriptJavaScript syntax should be quite easy to understand.

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.

If you run an InCopy workflow, or you have found this post by searching the web, you probably know the issue with markup up index words in InCopy - the tool is missing.

In the projects where we run an InCopy workflow, it is mainly books, where the editors easily can proofread and correct in the story itself, and letting them mark up index words would be a great in that process as well. I can't see any obvious reason to why Adobe left it out, other than InCopy might be more minded on magazine editing(?), and there isn't much use for indexing in magazines.

The solution

In books where the index are marked up late in the process, after the book is typeset and proofread, we either mark it up ourselves from a printed copy with highlighted words, or we let the editors mark up the index words in InCopy using a colour swatch. When we receive the InCopy story from them, an AppleScriptJavaScript in InDesign takes care of finding all the coloured words and marking them up as index words. When the script is done, a quick search/replace takes care of colouring the words back to their original colour.

The dialog box that asks you which swatch you want to make an index from.

Index from colour

The script might come in handy in other cases as well, but the InCopy case is the most obvious. The same script could be done with character styles as well, but since I'd like to enable marking up that already have a character style applied, I found swatches better suited.

The script

I have uploaded the basic script - letting you select a swatch from a list and it searches the current document, marking up words. You are free to modify it to your needs - might come in handy to convert words to lowercase or things like that.

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 X.0/Scripts/Scripts Panel" folder.

Download index_from_colour.jsx.