3 Replies Latest reply: Jul 27, 2012 7:32 AM by Nagaraj Muthu RSS

    Mixed character style text selection?

    Nagaraj Muthu Community Member

      Hi all,

       

      I want to selecting the two character style contents, they should appear with one following the other on the same line or Multiline.  I used the findText() to find the first character style text,  then im stuggle in how to concatenate founded items with following text with specific character style.

       

      Thanks in advance for helping hands.

       

      Regards,

      Imagine.

        • 1. Re: Mixed character style text selection?
          Nagaraj Muthu Community Member

          Hi all,

           

          I tried myself using the selection techniques,  from the selected text i will move forward by character by character,  If that text end with specified character style means i will print that selection[0] text.

           

          I know the selection programs having the performance issues.   so that it takes long time for processing the outputs if the document having much pages.

          var myLocalSelection = app.selection[0];

           

          while (myLocalSelection.characters.nextItem(myLocalSelection.characters[-1]).isValid == true ) {

                      if (myLocalSelection.characters.nextItem(myLocalSelection.characters[-1]).contents == " ") {

                              myLocalSelection.characters.nextItem(myLocalSelection.characters[-1]).select(SelectionOpt ions.ADD_TO);

                              myLocalSelection = app.selection[0];

                              //LastCharIndex +=1;

                              //LastTargetIndex +=1;

                              }

                     else if (myLocalSelection.characters.nextItem(myLocalSelection.characters[-1]).contents == "\u000D") {

                                break;

                               }

                     else if (myLocalSelection.characters.nextItem(myLocalSelection.characters[-1]).appliedCharacterSt yle.name.indexOf ("_Highlighted_phrase_1") != -1) {

                                 myLocalSelection.characters.nextItem(myLocalSelection.characters[-1]).select(SelectionOpt ions.ADD_TO);

                                 myLocalSelection = app.selection[0];

                                 //LastTargetIndex +=1;

                              }

                     else if (myLocalSelection.characters.nextItem(myLocalSelection.characters[-1]).appliedCharacterSt yle.name.indexOf ("_Highlighted_phrase_2") != -1) {

                                 myLocalSelection.characters.nextItem(myLocalSelection.characters[-1]).select(SelectionOpt ions.ADD_TO);

                                 myLocalSelection = app.selection[0];

                                 //LastTargetIndex +=1;

                              }

                      else if (myLocalSelection.characters.nextItem(myLocalSelection.characters[-1]).appliedCharacterSt yle.name.indexOf ("_Highlighted_phrase_2") == -1) {

                               break;

                              }

                       } // end of While loop

           

          The same to be  possible in without selection methoed means please give the solution or guidelines

           

          Using InDesign CS5.5/ Windows 7

           

          Thanks in advance for helping hands.

           

          Regards,

          Imagine

          • 2. Re: Mixed character style text selection?
            csm_phil Community Member

            Hi Imagine,

             

            If you have the snapshot of your requirements (before & after) please post, Then only understanding of you requirements is easy to all, I feel.

             

            thx

            csm_phil

            • 3. Re: Mixed character style text selection?
              Nagaraj Muthu Community Member

              Hi csm

               

              thanks for the reply.  I had done this automation by using the grep tricks.