7 Replies Latest reply on May 23, 2011 5:18 AM by aanavaras

    Bold text

    Big Little Al

      Newbie to scripting, I want to search for a word ie Steers: and make it bold, but I want to text after the colon to remain normal.

       

      I have a style to make the first word of a paragraph to colon bold, but I want to get rid of the end paragaph and run the text on.

       

      text {findWhat:"^pSteers:"} {changeTo:" Steers:"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}

       

      Cheers, Allan

        • 1. Re: Bold text
          John Hawkinson Level 5

          Hi, BLAl:

           

            This isn't really a scripting question, as much as a Find/Change or GREP question. Though it sounds like you're using FindChangeByList.jsx? Make sure to tell us if that's what you're doing! [or are you using the AppleScript or VB versions? Unfortunately it makes a difference.]

           

          Newbie to scripting, I want to search for a word ie Steers: and make it bold, but I want to text after the colon to remain normal.

           

            You can't achieve that with regular Find/Change, you have to use GREP. You can search for "^Steers(?=:)" and replace it with "Steers" with the boldface. The ^ anchors the regular expression to the beginning of a line (paragraph). And the (?=:) is a positive lookahead that makes the regular expression true only if it is followed by a colon.

           

           

          I have a style to make the first word of a paragraph to colon bold, but I want to get rid of the end paragaph and run the text on.

          I'm afraid I don't follow.

          • 2. Re: Bold text
            Big Little Al Level 1

            Hi, I know it is not really a scripting question but I have a large number of words t

            hat I need to find and replace and I thought placing them in a script was the way to go.

            You have partially answered my question but what is the string to make the text boldface?

             

            Cheers, Big Al

            • 3. Re: Bold text
              John Hawkinson Level 5

              Allan: You'll get better help if you answer the questions you are asked:

              1. Though it sounds like you're using FindChangeByList.jsx? Make sure to  tell us if that's what you're doing!
              2. [or are you using the AppleScript  or VB versions? Unfortunately it makes a difference.]
              3. You wrote, "I have a style to make the first word of  a paragraph to colon bold, but I want to get rid of the end paragaph  and run the text on." I'm afraid I don't follow. What does this quoted sentence mean?
              • 4. Re: Bold text
                Big Little Al Level 1

                Sorry for that John.

                 

                Yes I am using FindChangeByList.jsx, and I 'm using VB.

                 

                Please disregard the statement about the style, that was about a paragraph style that I was attempting to use to sort out the problem.

                 

                What I am trying to do currently is I have text imported into Indesign in paragraph format starting with words like "Steers:" but I want to get rid of the paragraphs and just make the one word in boldface with the rest of the text light face. ie:

                 

                Steers: aa strs 613, 206, 1263 AJ & BT Anscombe, Woolsthorpe.

                Vealers: Limo x strs 410, 238, 975 GL & MA Antony, Cashmore.

                Heifers: bb hfrs 536, 187.5, 1007 NJ & BT A.

                 

                 

                 

                 

                 

                and change to:

                 

                 

                 

                I hope this helps.

                Cheers, Big Al

                Steers: aa strs 613, 206, 1263 AJ & BT Anscombe, Woolsthorpe. Vealers: Limo x strs 410, 238, 975 GL & MA Antony, Cashmore. Heifers: bb hfrs 536, 187.5, 1007 NJ & BT A.

                • 5. Re: Bold text
                  John Hawkinson Level 5

                  Yes I am using FindChangeByList.jsx, and I 'm using VB.

                   

                  Err, so not .jsx but the VB version? Just checking, because it

                  cannot be both.

                  • 6. Re: Bold text
                    Big Little Al Level 1

                    No, sorry, just Javascript.

                     

                    Cheers, Big Al

                    • 7. Re: Bold text
                      aanavaras Level 1


                      Try this.


                      app.findGrepPreferences = NothingEnum.nothing;
                      app.changeGrepPreferences = NothingEnum.nothing;
                      app.findGrepPreferences.findWhat = "~b?^([A-Za-z]+:)";
                      app.changeGrepPreferences.changeTo = " $1";
                      app.changeGrepPreferences.fontStyle = Bold;
                      app.documents.changeGrep();


                      Hope this helps.


                      SaRaVaNaN.N