I work for a daily newspaper and I am fairly new to the world of InDesign javascripting. I have been making the most of modifying FindChangesByList.jsx and the support file FindChangeList.txt to format articles and sports agate. I am using InDesign CS5.

I have a couple of questions and would appreciate any assistance:

1. AppliedParagraphStyle question

How do you refer to a paragraph style when it is in a Style Group folder?

2. Grep question

A. I am trying to get FindChangeList to look for a reporter's name, which is at the beginning of the article and is two upper case words followed by a comma.

I've tried the following - grep {findWhat:"\u+ \u+[,]"} - but it doesn't seem to work.

B. Once I find the reporter's name, I would like to add the word "By" in front of the name and remove the comma. I am at a lose how to do this.

3. I am also looking for a way to find a reporter's name (which is at the beginning of the article) and then add that reporter's contact information at the end of the article. I am not sure this can be done with FindChangeByList.

4. Last question: What book or guide would you commend for someone just learning javascripting in InDesign?

1. There isn't an example in the sample text file, but someone posted the answer in a thread that came up as related to this one. This is how you'd do it for a para style called "Blue" in a style group called "Colors":

2A/B. You're close, but whenever you have something in GREP that starts with a backslash that's running through javascript, you have to escape it by adding another backslash. Also, because of what you want to do in 2B, you'll want to write your search expression with subexpressions so you can delete the comma:

{findWhat:"(\\u+ \\u+)(,)"}

{changeTo:"By $1"}

To explain what's going on here in the changeTo, you're inserting "By" and a space, followed by the contents of the first set of parentheses ($1 = your reporters' names), and by omitting $2 (the contents of the second set of parens), you'll delete the comma.

Offhand I can't think how you'd do #3 using FindChangeList. It could undoubtedly by done via scripting, provided the story is all in one text flow.

I'll leave it to the folks who do know javascript to recommend a book!

I am not having much luck cracking #3 (I am also looking for a way to find a reporter's name (which is at the beginning of the article) and then add that reporter's contact information at the end of the article). Any suggestions?

• • • • •

EXAMPLE:

By PETER PARKER

DAILY BUGLE

Text text text text text text text text text text text.

Text text text text text text text text text text text.

Text text text text text text text text text text text.

• • • • •

The script would find "PETER PARKER"

And then would jump to the end of the article and insert "Peter Parker is a reporter with the Daily Bugle and can be reached at 555-5555."

Any help would be appreciated. Thanks in advance.

I am looking to build a script that will look for a reporter's name (which is at the beginning of the article) and then will move to the end of the article add that reporter's contact information at the end of the article. I am not sure this can be done with FindChangeByList.

grep {findWhat:"(PARKER\\r)((.+\\r)+)"} {changeTo:"$1$2\\rPeter Parker is a reporter for The Daily Bugle. He can be reached at 555-555-5555 or by email at peter.parker@thedailybugle.com."} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}