I have this part of a script I'm writing that I'd like use to find a bit of text in a results file and replace it with some other text. It is not working and I was hoping someone could tell me how to get it to work!
Thanks in advance!
[!]The AutoSavers![/!]
Thanks in advance!
Code:
Const ForReading = 1
Const ForWriting = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(%USERPROFILE% & "\Desktop\Systems.txt", ForReading)
strText = objFile.ReadAll
objFile.Close
strNewText = Replace(strText, "Error:", "System is blah - no information will be retrieved!")
Set objFile = objFSO.OpenTextFile(%USERPROFILE% & "\Desktop\Systems.txt", ForWriting)
objFile.WriteLine strNewText
objFile.Close
[!]The AutoSavers![/!]