2 Replies Latest reply on Jun 16, 2008 10:25 AM by (Bharathi_Raja)

    Indesign CS3-JS - Problem in reading text from a text file

    Level 1
      Can anyone help me...

      I have an problem with reading text from an txt file. By "readln" methot I can read only the first line of the text, is there any method to read the consecutive lines from the text file.

      Currently I am using Indesign CS3 with Java Script (for PC).

      My Java Script is as follows........

      var myNewLinksFile = myFindFile("/Links/NewLinks.txt")
      var myNewLinks = File(myNewLinksFile);
      var a = myNewLinks.open("r", undefined, undefined);
      myLine = myNewLinks.readln();

      function myFindFile(myFilePath){
      var myScriptFile = myGetScriptPath();
      var myScriptFile = File(myScriptFile);
      var myScriptFolder = myScriptFile.path;
      myFilePath = myScriptFolder + myFilePath;
      if(File(myFilePath).exists == false){
      //Display a dialog.
      myFilePath = File.openDialog("Choose the file containing your find/change list");
      return myFilePath;

      function myGetScriptPath(){
      myFile = app.activeScript;
      myFile = myError.fileName;
      return myFile;

      Bharath Raja G