9 Replies Latest reply on May 7, 2014 3:23 PM by Jump_Over

    How do I select a specific word inside a TextFrame?

    supersorensen

      I want to highlight a word inside a TextFrame, but I'm only able to select the entire frame.

       

      I have tried something (and several related version) like this:

       

      var textFrames:com.adobe.indesign.TextFrames = activeDocument.textFrames;

        for(var i:int = 0; i < textFrames.length; i++){

        var t:com.adobe.indesign.TextFrame = textFrames.item(i);

        var texts:com.adobe.indesign.Texts = t.texts;

       

          for(var j:int = 0; j < texts.length; j++){

            var text:com.adobe.indesign.Text = texts.item(j);

            app.select(text);

          }

      }

       

      This selects the entire content of the area, instead of just a specific word.

      How do I proceed? Thanks