Hi all
I need to change a vbs script so it first search for a line and change it. But I also need to make a check to see if the line exist else it has to create it. In other words, the script has to check if the line names is in the file and change it and if the line doesn't exist it has to create it.
Here's the script that just changes the line
Set TF=FSO.OpenTextFile(notesini,1)
inp=TF.ReadAll
out=Replace(inp,"Names=Names.nsf","NAMES=C:\Documents and Settings\"+struser+"\Application Data\Notes\Names.nsf",1,-1,vbTextCompare)
TF.close
Set TF=FSO.CreateTextFile(notesini,True)
TF.Writeline out
TF.Close
I need to change a vbs script so it first search for a line and change it. But I also need to make a check to see if the line exist else it has to create it. In other words, the script has to check if the line names is in the file and change it and if the line doesn't exist it has to create it.
Here's the script that just changes the line
Set TF=FSO.OpenTextFile(notesini,1)
inp=TF.ReadAll
out=Replace(inp,"Names=Names.nsf","NAMES=C:\Documents and Settings\"+struser+"\Application Data\Notes\Names.nsf",1,-1,vbTextCompare)
TF.close
Set TF=FSO.CreateTextFile(notesini,True)
TF.Writeline out
TF.Close