Skip navigation
M Karthik
Currently Being Moderated

How to apply the two different styles using find and replace

Aug 5, 2012 11:02 PM

Hello All,

 

In the manuscript i have lot of bullet list paragraphs. In indesign i have three styles (Bullet first, Bullet Middle, and Bullet Last).I can easily applied the Bullet Middle (BL) style for all the bullet list paragraphs. Now i need to apply the Bullet first (BL1) and Bullet Last (BL2) style. I have used the below script, but this is not applied the specfic styles.

 

app.findTextPreferences.appliedParagraphStyle=app.activeDocument.paragraphStyles.item("BL");
var myResults = app.activeDocument.findText();
     for (i = 0; i <= myResults.length - 1; i++) 
     { 
          myResults.select; 
          var mySel = app.selection[0];
          var myParagraphs = mySel.paragraphs.length;
          //alert(myParagraphs);
          mySel.paragraphs[0].appliedParagraphStyle = "BL1";
          mySel.paragraphs[myParagraphs-1].appliedParagraphStyle = "BL2";
     }

 

Kindly help me on this.......

 
Replies
  • Currently Being Moderated
    Aug 6, 2012 1:18 AM   in reply to M Karthik

    As is said so often in this forum, there's no need to select anything:

     

    for (i = 0; i < myResults.length; i++)

        {

        myResults[i].paragraphs[0].appliedParagraphStyle = "BL1";

        myResults[i].paragraphs[-1].appliedParagraphStyle = "BL2";

        }

     

    Peter

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points