title: VBscript error input past end of file
body: <p>I have 3 scripts wherein they all must be run in the right order repeatedly.</p>
  
  <ol>
  <li>1st script - performs a process on a list of PCs (listed on a textfile input) depending if they are online/offline. It outputs a list of the PCs which were online and another list of the offline ones</li>
  <li>2nd script - gets the PC difference from the original list and the output of the 1st script to know which machines have run the process from the 1st script</li>
  <li>3rd script - using the differences, updates the input list</li>
  </ol>
  
  <p>The script below is the 3rd script. Whenever I run it, it ends with an error "input past end of file". I've tried several modifications and it always ends that way.</p>
  
  <p>My idea for the 3rd script is that the Differences.txt output from the 2nd file are the ones that still need to run the process form the first script, so I simply delete the original input file and rename this one into the new output file. However, I have to also keep track of the ones that were already done with the process so I have to list/append them to another text file.</p>
  
  <p>Thanks in advance for any help.</p>
  
  <pre><code>Option Explicit
  Dim objFso
  Dim Fso
  Dim firstfile,secondfile,file,fileText
  
  Set objFSO = CreateObject("Scripting.FileSystemObject")
  If objFSO.FileExists("Machines.ini") Then objFSO.DeleteFile("Machines.ini")
  
  Set Fso = WScript.CreateObject("Scripting.FileSystemObject")
  Fso.MoveFile "Differences.txt", "Machines.ini"
  
  firstfile="Notified.txt"
  secondfile="Notified-all.txt"
  
  Set fso=CreateObject("Scripting.FileSystemObject")
  Set file=fso.OpenTextFile(firstfile)
  fileText = fileText &amp; file.ReadAll() &amp; vbCrLf
  file.Close
  
  Set file=fso.OpenTextFile(secondfile)
  fileText=filetext &amp; file.ReadAll()
  file.Close
  
  set file=fso.CreateTextFile(secondfile,true)
  file.Write fileText
  file.close
  </code></pre>