2 Replies Latest reply on Dec 6, 2012 1:17 AM by SimonLinden

    changeGrep() clears overrides

    SimonLinden Level 1

      Hi!
      I'm working on a script to automatically assign paragraph and character styles to texts that are sent to me by other writers. I do grep find/replace to apply the right styles to the right paragraphs. The problem is that it seems like the function changeGrep() clears overrides when it appiles the paragraph style. Is there any way to disable that behaviour? If I do a manual grep find/replace in inDesign with the same settings the overrides are not cleared so it should be possible.

       

      This is an example of my code:

       

      app.findGrepPreferences = NothingEnum.nothing;
      app.changeGrepPreferences = NothingEnum.nothing;
      
      app.findGrepPreferences.findWhat = "^\\d+\\w";
      app.findGrepPreferences.pointSize = 12;
      app.findGrepPreferences.fontStyle = "Regular";
      app.findGrepPreferences.dropCapLines = 2;
      
      var styles = app.activeDocument.paragraphStyles;
      var style;
      style = styles.item("p-new-chapter");
      app.changeGrepPreferences.appliedParagraphStyle = style;
      
      
      myStory.changeGrep();