6 Replies Latest reply on Feb 19, 2015 10:42 AM by machipotHocine

    last nextTextFrame

    machipotHocine

      Hi,

       

      I am tying to locate the last textFrame in my document to add a '\r' , I know that there are only three Text Frames.

       

      //the second text frame

      if(leftTF.nextTextFrame != null){

      var leftTF2 = leftTF.nextTextFrame;

      var lastChar2 = leftTF2.characters.item(leftTF2.characters.length - 1);

        if(lastChar2.contents !== "\r" || lastChar2.contents !== "\n")

      leftTF2.paragraphs[-1].insertionPoints[-1].contents = "\r";

       

      //the third  text frame

       

      if(lefTF2.nextTextFrame){

      var leftTF3 = leftTF2.nextTextFrame;

      var lastChar3 = lefthandTF3.characters.item(leftTF3.characters.length - 1);

        if(lastChar3.contents !== "\r" || lastChar3.contents !== "\n")

      leftTF3.paragraphs[-1].insertionPoints[-1].contents = "\r";

       

       

      and when I try to reach the fourth ---> error:  undefined is not an object

       

       

      if(leftTF3.nextTextFrame){

       

      alert(" - 4 -" ); 

      }else{

      alert("- 5 -");

       

      I want to use a while to reach the last text Frame what ever the amount?

      Thank you,