I am trying to parse logfiles that BlackBerry Enterprise Server has open, i am able to use the following code with .vbs and it works fine, however, when I try and perform the same thing in VB.NET using the System.IO i get errors saying the file is in use.. help ! I have tried everything, including using Microsoft Scripting Runtime and FSO (Which works)
.VBS
const forWriting = 2
strFileName = InputBox("Enter Filename", "Enter Filename")
strQuery = InputBox("What User", "What User")
strQuery = lcase(strquery)
Set fso = CreateObject("Scripting.FileSystemObject")
Set inFile = fs
penTextFile(strFileName, 1, False)
Set outFile = fs
penTextFile("BBLogParser" & strquery & ".txt", forWriting, true)
do while inFile.atEndOfStream = False
thisLine = lcase(inFile.readLine)
'WScript.Echo thisLine
If InStr(1, thisLine, strQuery) Then
'WScript.Echo thisLine
outFile.Write thisLine & vbNewLine
End If
Loop
wscript.echo("Complete Filtering Log " & strFileName)
.VBS
const forWriting = 2
strFileName = InputBox("Enter Filename", "Enter Filename")
strQuery = InputBox("What User", "What User")
strQuery = lcase(strquery)
Set fso = CreateObject("Scripting.FileSystemObject")
Set inFile = fs
Set outFile = fs
do while inFile.atEndOfStream = False
thisLine = lcase(inFile.readLine)
'WScript.Echo thisLine
If InStr(1, thisLine, strQuery) Then
'WScript.Echo thisLine
outFile.Write thisLine & vbNewLine
End If
Loop
wscript.echo("Complete Filtering Log " & strFileName)