2 Replies Latest reply on Jul 4, 2014 5:50 AM by bkf1

    Read a line from txt file

    bkf1

      Hello all,

      I need to know how to read whole lines from any txt file. E.g. I have this in txt file:

       

      testline1

      testline2

      testline3

       

      and I need to read only line 2 (text "testline2").

       

      I know how to read whole file:

       

      var file = File(app.activeScript.parent.fsName + '/test.txt');
      file.open("r");
      var str = file.read(); // whole content of "test.txt" is now in variable "str"
      file.close();
      

       

      but I don't know how to read ONLY e.g. line 2. Can you help me with this someone please?

       

      Thanks very much in advance