9 Replies Latest reply on Jul 6, 2011 9:02 PM by ADusa

    Find/Replace Grep Question

    ADusa Level 1

      Hi everyone, I have a question about find/replace.  My customer sent a file which is basically a table of contents, but not done in the traditional way.  They put product names in a text block and put another text block next to it, where I had to fill in the pages as we completed the catalog which contained the product descriptions.  I did the catalog and they did the other document which is like a TOC.  Long story, don't get hung up on that, just picture the formatting of a table of contents but the product names are in one text block, the page numbers are in a separate text block.

       

      So now, they think they might want to add a leader in between the product name and the page number.  Not a problem if it had been done in the traditional way but it wasn't and I don't want to retype the whole document so I'm wondering if there might be a work-a-round using find/replace.  Each text block containing the product name is the same width, there is space after the product name to enter a .......  Obviously the product names will be different lengths but the text box they are in are the same width, so is there a way to say, I want to add dots after the product name until they get to the right side of the text box? 

       

      So this is what I have:

       

      compost, dirt                        74

       

      And I'd like to get:

       

      compost, dirt ......................74

       

      without having to type all the dots by hand.  Each product name is currently followed by a line break, if that makes any difference.

       

      Thanks for any help you can give.  I'm not a wizard at grep so you might have to be specific in your explaination.

       

      Sincerely,

       

      Annette

        • 1. Re: Find/Replace Grep Question
          [Jongware] Most Valuable Participant

          Can't be done using Find/Replace -- but that's no reason to panic. Use the Tab settings to add what's called a "dot leader", like this:

           

          tab-leader.PNG

           

          -- note the right aligned tab and the period in the Leader field.

           

          Bob Bringhurst wrote up an article about the Tab settings and its possibilities here -- a must-read for Tab Starters, he touches upon all you ever wanted to know.

          • 2. Re: Find/Replace Grep Question
            ADusa Level 1

            I'm familiar with tabs and leaders but I have 50 pages with about 3000 products that the leader needs to be added too so I was looking for a more automated process. 

             

            And again, the text box with the product name is not connected to the text box with the page number in it.  My client set up the file and I'm trying to find a way to get this accomplished without having to retype the whole file and without having to add the leader individually to each product line.

             

            Thanks again,

             

            Annette

            • 3. Re: Find/Replace Grep Question
              Joel Cherney Adobe Community Professional & MVP
              the text box with the product name is not connected to the text box with the page number in it.  My client set up the file and I'm trying to find a way to get this accomplished without having to retype the whole file and without having to add the leader individually to each product line.

               

              I'm racking my brain over here, but when I was in your shoes, there was not much else I could have done. I mean, it's not like you have to add the leader individually to each line - if all of your items have the same paragraph style, you put the right-align tab with the dot leader in the paragraph style - but, other than that, I think you're out of luck (unless I don't understand your explanation).

               

              So, if your left-hand frame has lots of product names in it, you could just expand that frame until it was pretty close to the page numbers, then insert the right-align tab in the paragraph style to get the dot leader as close as is reasonably possible, and it wouldn't look too ugly. I broke up the left-hand frame into three sections, one for single-digit page numbers, another for double-digit page numbers, and a third for triple-digit page numbers.

               

              However I do have to say this: my workarounds cost the client about 3x as much as it would have cost for me to simply rebuild the file correctly, and I suspect that my designer/contact got fired for jerking us all around and wasting money on duct-tape fixes when doing the job correctly from the beginning, or even the middle, would have been cheaper. I never heard from that designer again, and when the job came up for revision some other designer-type was my contact, and my first instruction was "rebuild the TOC using InDesign's TOC tool so that the TOC can be easily updated in the future." Which was, incidentally, a word-for-word copy/paste from my own email to the client, advising them on what they ought to do.

               

              Which is also my advice for you and your client: if there is any chance whatsoever that anyone will ever need to re-use this document for any purpose, then you're better off deleting the fake-TOC garbage you're trying to fix, and actually build a real TOC using the tools which are meant for handling TOCs for large docs. Someone trying to make a product-list with page numbers in a separate frame... oy vey. Sure, it'll cost more time & money right now, but unless this job is a one-off for everyone involved, there's no point in trying to fake up a dot leader when you could just build a sensible TOC, in a single frame, with dot-leaders that Just Work(TM), which you could actually update further on down the line.

              • 4. Re: Find/Replace Grep Question
                peter minneapolis Level 4

                annette8431 wrote:

                 

                Hi everyone, I have a question about find/replace.  My customer sent a file which is basically a table of contents, but not done in the traditional way.  They put product names in a text block and put another text block next to it, where I had to fill in the pages as we completed the catalog which contained the product descriptions.  I did the catalog and they did the other document which is like a TOC.  Long story, don't get hung up on that, just picture the formatting of a table of contents but the product names are in one text block, the page numbers are in a separate text block.

                 

                So now, they think they might want to add a leader in between the product name and the page number.  Not a problem if it had been done in the traditional way but it wasn't and I don't want to retype the whole document so I'm wondering if there might be a work-a-round using find/replace.  Each text block containing the product name is the same width, there is space after the product name to enter a .......  Obviously the product names will be different lengths but the text box they are in are the same width, so is there a way to say, I want to add dots after the product name until they get to the right side of the text box? 

                 

                So this is what I have:

                 

                compost, dirt                        74

                 

                And I'd like to get:

                 

                compost, dirt ......................74

                 

                without having to type all the dots by hand.  Each product name is currently followed by a line break, if that makes any difference.

                 

                Thanks for any help you can give.  I'm not a wizard at grep so you might have to be specific in your explaination.

                 

                Sincerely,

                 

                Annette

                Hi, Annette:

                 

                Unless I'm misunderstanding your description, I suggest that you do indeed rebuild the TOC from scratch. BUT WAIT! No retyping is needed. Again unless I'm missing something, can't you generate a TOC from the catalog itself? You'd specify the paragraph style that's applied to product names as the one to extract, and the page numbers are captured by the TOC process. You can specify a dot leader in the style for the TOC entries.

                 

                Perhaps I'm overlooking the requirement that these two texts need to be in separate visible boxes on the "TOC" page? If so, if all the stars in the universe are in place, perhaps you can give this appearance to the new TOC you generate, with a master page that has the boxes. The TOC text won't actually be in the boxes, but they'll appear to be in them, if you can align them correctly.

                 

                HTH

                 

                Regards,

                 

                Peter

                _______________________

                Peter Gold

                KnowHow ProServices

                • 5. Re: Find/Replace Grep Question
                  ADusa Level 1

                  Thanks Joel, Peter and Jongware for taking the time to answer my question.  I sort of thought there wasn't a quick fix for this issue but your responses reaffirmed that.  I was able to insert a tab with a leader in the text box with the product name and I can put my curser in each line individually and insert a tab with a leader that ends near the page number box.  Joel, I appreciate the paragraph style info but there are actually 2 different styles in each line, 2 different font styles.  I wonder if a nested style would apply here?  For instance, I have:

                   

                  Product Name  Product Code

                   

                  I need the leader to be the same font as the product code.

                   

                  We've already generated a main TOC for the catalog.  This particular document I'm working on now, is kind of a cross reference.  There are conditions listed, then products that might affect that condition.  I'm not sure why the client wanted to set up this document themselves but they did.  And of course, I'm under a time crunch now so I don't really want to retype.  It's also formatted horizontally, so there are conditions, then several products listed in 3 columns horizontally, then another condition under that, 3 columns horizontally, etc.  It makes sense but I don't want to or have the time to retype it at this point. 

                   

                  I really appreciated everyone's input.  You folks are great!  At this point, I'm wondering about the nested style fix?  Any ideas on that?

                   

                  Sincerely,

                   

                   

                  Annette

                   

                   

                  • 6. Re: Find/Replace Grep Question
                    Joel Cherney Adobe Community Professional & MVP

                    Um.

                     

                    Yeah, I'd probably have wanted to set up the cross-references with InDesign's cross-reference tool.

                     

                    If the entries in your table don't already have paragraph styles, and it sounds like they don't, then yeah, if "product name" is reliably followed by a tab then a nested style (starting from the tab, applied through end-of-nested-style-character, meaning that it'd extend until the end of the paragraph because you're not inserting any end-of-nested-style characters) would do the trick.

                     

                    I have a feeling that there must be some way to automate this job out of existence, but I have a hard time imagining what it'd be. Something like:

                     

                    1) Copy leftmost frame to pasteboard    

                    2) Convert text to table

                    3) Insert another column to right 

                    4) Copy rightmost frame to pasteboard

                    5) Convert text to table

                    6) Paste table contents of results of 5) into results of 3)

                    7) Convert table to text; separate columns with tab

                    8) Select all text, edit tab to be right-aligned and have a dot leader

                     

                    In my experience, it usually takes me three or four tries with kludgy duct-tape workarounds like this before I finally hit the right technique. I'd bet that one of the other posters in this thread has a better, slicker technique with less trial and error.

                    • 7. Re: Find/Replace Grep Question
                      Peter Spier Most Valuable Participant (Moderator)

                      I'm a little late to this party, but if you assign a unique style the listings, you can, indeed do a lot of this autoamtically. Use GREP to find .$ which is the last character in the paragraph. Replace with $0\t to add a tab.

                       

                      In the style definition for this unique style, go to the Tabs pane and add the tab and leader. All paragraphs will update at once.

                      • 8. Re: Find/Replace Grep Question
                        Peter Spier Most Valuable Participant (Moderator)

                        forgot to address the part where you wanted the leader to be the same font as the product code. That should happen automatically, but if you want to change the font for some reason, or change the color, or whatever, use a nested style applied to the tab as part of the paragrapg style.

                        • 9. Re: Find/Replace Grep Question
                          ADusa Level 1

                          Hi everyone, just wanted to say thank you again to all who responded to my issue.  It's been a real mind bender.  I've tried everything you've suggested and think I'm still stuck with doing it semi-by hand.  I tried the nested style route but there isn't any real difference in the line of text other than a different font.  But, the product name varies from 1 word to up to 5 and there isn't any break between the product name & product code other than a space.  They just made the font for the name one font and the font for the product code a lighter version with just a space between them so the nested style didn't know how to read the end of the name and the beginning of the code.  Ug!  At this point, the client is wanting to move this along so I think I'm going to do it putting in a tab with a leader after every name/code entry.  I have to do it line by line but at least I don't have to do all the dots by hand.  I was a bit leary when they said they were setting up this part of the document, but anyway, it's not the worst thing.

                           

                          Just wanted to say thank you all for your help!  It's so good to know I have some knowledgable folks to ask! 

                           

                          Sincerely,

                           

                          Annette