DevGuru VBScript Method: FileSystemObject.OpenTextFile

METHOD: FileSystemObject.OpenTextFile Implemented in version 2.0 object.OpenTextFile (filename [, iomode[, create[, format]]]) This method is used to open a text file and returns a TextStreamObject that can then be used to write to, append to, and read from the file. The optional iomode argument can have one of the following Constants as its value: CONSTANT VALUE DESCRIPTION ForReading 1 Opens a file for reading only ForWriting 2 Opens a file for writing. If the file already exists, the contents are overwritten. ForAppending 8 Opens a file and starts writing at the end (appends). Contents are not overwritten. The optional create […]

Read more

Fix: Input past end of file

  Error: Input past end of file     Error Causing Code:   <script type="text/javascript">     function readfile(){         var line         var fso = new ActiveXObject("Scripting.FileSystemObject");         file = fso.OpenTextFile("C:\Temp\File1.txt", 1);         var User = getuserName();         while (!file.AtEndOfStream) {             line = file.ReadLine();             return line         }         file.Close();     }     function getuserName() {         var line         var fso = new ActiveXObject("Scripting.FileSystemObject");         file = fso.OpenTextFile("C:\Temp\users.txt", 1, false);         line = file.ReadLine();         return line         file.Close();     } </script>   Fixed Code:   <script type="text/javascript">     function readfile(){         var line        var User […]

Read more