0 Replies Latest reply on May 25, 2012 6:48 AM by JossHarris

    Inserting a character at the end of a paragraph IF the next paragraph is a certain style




      I have found a section of a collegues script that will insert a bullet at the end of a paragraph if the PREVIOUS para is styled with a certain style, I have been trying to modify it to work if the FOLLOWING paragraph is a certain style instead but as I am not sure how the "insertionPoints[f[i].index-1].appliedParagraphStyle.name" part of it is working I have hit a brick wall. Can anyone shed any light on this?




      myDoc = app.activeDocument

      // This part checks if "News text para indent" is followed by "News title regular" and inserts a bullet

      app.findGrepPreferences = null;

      app.findGrepPreferences.appliedParagraphStyle = "News text para indent";

      app.findGrepPreferences.findWhat = "^.+$";

      f = myDoc.findGrep();



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


          var inser= f[i].insertionPoints.length

        if (f[i].parentStory.insertionPoints[f[i].index-1].appliedParagraphStyle.name == "News title regular")



      var bullet =  f[i].parentStory.insertionPoints[f[i].index+inser-1].contents="\u25CF"