I have 3 scripts wherein they all must be run in the right order repeatedly.
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.
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.
Thanks in advance for any help.
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 & file.ReadAll() & vbCrLf
file.Close
Set file=fso.OpenTextFile(secondfile)
fileText=filetext & file.ReadAll()
file.Close
set file=fso.CreateTextFile(secondfile,true)
file.Write fileText
file.close
To correct this errorUse the EOF function immediately before the Input statement to detect the end of the file. If the file is opened for binary access, use Seek and Loc .
Follow the below troubleshooting steps to address this error: Delete all files in the folder located in C:\Program Files\Juris2\bin\JRQ or C:\Program Files (x86)\Juris\bin\JRQ. Confirm user has full read write control over C:\Program Files\Juris2\bin or C:\Program Files (x86)\Juris\bin. Preview or print the report.
You get that error when you call ReadAll
on an empty file. Check the AtEndOfStream
property and read the content only if it's false:
If Not file.AtEndOfStream Then fileText = fileText & file.ReadAll
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With