4 Replies Latest reply on Jul 21, 2010 5:46 AM by [Jongware]

    phone directory shortcuts

    Fritz Hansen Level 1

      I'm typesetting a phone directory in which each entry starts with a last name, first name; 10-digit phone number, and then address. The last name and the phone number need to have a character style applied to them (both get the same style). I can do the Last Name with a nested style. Is there a way to apply a character style to a "word" [the phone number] within a line of text? Some kind of GREP search? Here's a sample entry with punctuation, in case it helps:


      LastName FirstName; 000-000-0000 123 Street; Job Title



      A second need is for a way to populate the page headers with the Last Name from the first and last entries on a spread. Is there a way to automate that?


      Many thanks in advance for any help with this.

        • 1. Re: phone directory shortcuts
          [Jongware] Most Valuable Participant

          What version of InDesign?


          Sure, it's possible with scripting; but with a (moderately) modern version of InDesign, you can use a GREP style to mark the phone number, and text variables (see First and Last Word on Page) to set your headers.

          • 2. Re: phone directory shortcuts
            Fritz Hansen Level 1

            Sorry, should have specified that. CS4. I'm not very good with GREP, but I did remember that there's a pre-installed GREP search to convert phone numbers with hyphens to a dot format, and I just took out the "replace" code and specified my character style, and that did the trick. I'll check out your link to do the headers. Thanks for a quick reply.

            • 3. Re: phone directory shortcuts
              Fritz Hansen Level 1

              Thanks for the link to the Text Variables instructions. I was a little concerned because when a word was selected, the character style palette didn't indicate that the nested character style was applied, even though it clearly was, so I thought the Text Variables might not pick up the nested style, but it worked like a charm, and all my page headers are populated with the appropriate names.

              • 4. Re: phone directory shortcuts
                [Jongware] Most Valuable Participant

                Yes, that was exactly the right thing to do -- twice


                I thought of something to try in combination, but it seems picking up data from GREP styles is not totally reliable to re-use in text variables. Fortunately, the nested style works perfect.[*]


                [*] Which is kind of ironic, because nested styles are internally just a variant of (and possibly a first attempt at) GREP styles.