4 Replies Latest reply on Oct 9, 2011 12:36 PM by Gowersoc

    Question about GREP behaviour and plug-ins

    Gowersoc

      Hi! Can anyone help with this?

      I have an odd thing which I don’t understand. I’m using GREP Find/Change to add some text before and after blocks of code. The blocks have soft returns at the end of each line, then a final CR.
      Using ^((.+\n?)*$) finds the entire block and the change works except for one thing – it slightly alters many of the character styles used to color the code, in two kind-of diagonal lines . And it only does this when I try to insert something before the block. Changing to $1 alone or plus extra following text is fine, but the preceding tag does this odd thing with the colors. The character styles are then correct for the odd new colors, which are often the ends or just bits of words.

      If I use just one character style for the whole block, there are no problems. There is a pattern there, perhaps to do with the number of characters I have added at the top, but I can't work it out yet.

       

      This also does the same thing whether soft or hard returns, and also if the block is only one line long.

       

      I'm using InDesign 5.5, fully updated. With earlier versions I used a script which exported a section of script, then reimported it in a separate frame. Sadly, this does not work with 5.5.

       

      The purpose of all this is to create divs in an epub export, by the way.

       

      Weird? Any ideas gratefully received.

      Best wishes, Chazz Garratt

        • 1. Re: Question about GREP behaviour and plug-ins
          [Jongware] Most Valuable Participant

          Gowersoc wrote:

           

          ... one thing – it slightly alters many of the character styles used to color the code, in two kind-of diagonal lines . And it only does this when I try to insert something before the block.

           

          Seen that as well. I'm not sure how to work around it -- it used to be much worse in older versions of InDesign, but on occasion it still pops up.

          But maybe it's not necessary to delve deeper into this.

           

          Gowersoc wrote:

           

          With earlier versions I used a script which exported a section of script, then reimported it in a separate frame. Sadly, this does not work with 5.5.

           

           

          You can try if this script comes back to life if you place it inside a specially-named folder inside the Scripting panel folder and run it from there. Follow the tips in this thread: http://forums.adobe.com/thread/323565

          You don't say which version you used before, but I don't know the actual actual version numbers anyway so you'll have to experiment.

          1 person found this helpful
          • 2. Re: Question about GREP behaviour and plug-ins
            Gowersoc Level 1

            Hi, Jongware,

             

            I tried to reply to you by email from Outlook, but it was returned, so I hope you receive this one.

             

            Many thanks for your prompt reply and advice. My previous version of InDesign was 4, so I tried Version 6.0 and 6.0.6 in the new folder. I still have it, and I checked that the script works there.

             

            I have tried both methods suggested in the link you provided, but the best I can come up with in 5.5 is to get it to copy the first line of a story, and even then, only when it is the only instance of a particular style. I recently got what promises to be an excellent book on scripting, but I haven’t had time to get into it yet.

            The original script was from Thomas Silkjaer, but I think he may be doing other things now.

             

            So it looks as if I’ll have to put the tags in manually unless I can find a GREP that does a positive lookahead to a different style, then adds the tag to the end of the preceding style. It’s this change in style which is the sticking point for me.

             

            Anyway, once again, than you for your time and trouble,

             

            Best wishes,

             

            Chazz Garratt (Gowersoc)

            • 3. Re: Question about GREP behaviour and plug-ins
              Peter Spier Most Valuable Participant (Moderator)

              Make a new sufolder named "Version 6.0 Scripts" (without the quotes) in the scripts folder and put your script in that. See if that works.

              1 person found this helpful
              • 4. Re: Question about GREP behaviour and plug-ins
                Gowersoc Level 1

                Hi, Peter,

                 

                I have tried that, and it works on the first line only of a story, and then only if there are no more instances of that particular style. I think I'm going to have to go at this another way.

                 

                Many thanks for the suggestion, though.

                 

                Best wishes,

                Chazz Garratt