7 Replies Latest reply on Sep 27, 2016 12:53 AM by jakec88782761

    object contains no text for Find/Change

    jakec88782761 Level 2

      I'm trying to run this script to select text if it is found but it says there no text even though I've wrapped it in an if statement.


      function seeSection () { 


        app.findGrepPreferences.findWhat= "the (section\\s+?\\d+?[\\.\\d+]?)"; 


          app.changeGrepPreferences.appliedCharacterStyle="cross reference";

            if (app.activeDocument.findText()){



         var changes1 = app.activeDocument.changeGrep();

          if (changes1.length===1){

      alert(changes1.length+" instance of 'the section' was changed to 'section'.");


         alert(changes1.length+" instances of 'the section' were changed to 'section'.");