4 Replies Latest reply on May 25, 2010 8:36 AM by [Jongware]

    Replace overset text

    Pontus Uggla Level 1

      When I search and replace text in a specific text box I have to make it bigger since I can´t get it to replace overset text.

       

      Is it possible or do you do the same?

        • 1. Re: Replace overset text
          [Jongware] Most Valuable Participant

          That is correct; if you use changeText on a text frame, it only works on what's visible.

          But it should be possible to use the same changeText on the entire story in that text box (yourFrame.stories[0]) -- that will include overset text.

          1 person found this helpful
          • 2. Re: Replace overset text
            Pontus Uggla Level 1

            textFrame.stories doesn´t seem to work, only application has stories as far as I can tell. But it does work to loop the paragrahs of the textframe and it seems to be fast enough for me.

             

             

             

            var my_frame = app.documents[0].selection[0];

             

            app.findTextPreferences = NothingEnum.nothing;

            app.changeTextPreferences = NothingEnum.nothing;

             

            app.findTextPreferences.findWhat = "find";

            app.changeTextPreferences.changeTo = "replace";

             

             

            for(i = 0; i < my_frame.paragraphs.length; i++) {

                my_frame.paragraphs[i].changeText();

            }

            • 3. Re: Replace overset text
              Shonkyin Level 3

              You need to use my_frame.parentStory instead of my_frame.stories.

               

              Here is working code.

               

              var my_frame = app.documents[0].selection[0];
              app.findTextPreferences = NothingEnum.nothing;
              app.changeTextPreferences = NothingEnum.nothing;
              app.findTextPreferences.findWhat = "find";
              app.changeTextPreferences.changeTo = "replace";
              my_frame.parentStory.changeText()
              

               

               

              Shonky

              • 4. Re: Replace overset text
                [Jongware] Most Valuable Participant

                Of course

                Each story can have multiple text frames but each frame can only be associated with one single story ... (I should have checked the Help.)