Hi All,
I'm using a script to analyze a file to get a reference from the text, this is what ive got so far
************************************************************
'script to find OGI ref in a file
dim colmatches
Const ForReading = 1
Const ForWriting = 2
Set objRegEx = CreateObject("VBScript.RegExp")
objRegEx.Pattern = "([a-z][a-z][a-z][a-z][0-9][0-9])"
objRegEx.Global = True
objRegEx.ignoreCase = True
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("d:\archive\temp\test.prn", ForReading)
Do Until objFile.AtEndOfStream
strSearchString = objFile.ReadLine
Set colMatches = objRegEx.Execute(strSearchString)
loop
If colMatches.Count > 0 Then
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("D:\archive\temp\output\test.txt", ForWriting)
objFile.Write colMatches(0).value
objFile.Close
DocumentName = "00-"&colMatches(0).value&" unknown file"
End If
objFile.Close
*******************************************************
my problem is this seems to work only itermitantly.
any ideas why sometime it doesnt work.
p.s. the pattern can appear anywhere within the file
I'm using a script to analyze a file to get a reference from the text, this is what ive got so far
************************************************************
'script to find OGI ref in a file
dim colmatches
Const ForReading = 1
Const ForWriting = 2
Set objRegEx = CreateObject("VBScript.RegExp")
objRegEx.Pattern = "([a-z][a-z][a-z][a-z][0-9][0-9])"
objRegEx.Global = True
objRegEx.ignoreCase = True
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("d:\archive\temp\test.prn", ForReading)
Do Until objFile.AtEndOfStream
strSearchString = objFile.ReadLine
Set colMatches = objRegEx.Execute(strSearchString)
loop
If colMatches.Count > 0 Then
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("D:\archive\temp\output\test.txt", ForWriting)
objFile.Write colMatches(0).value
objFile.Close
DocumentName = "00-"&colMatches(0).value&" unknown file"
End If
objFile.Close
*******************************************************
my problem is this seems to work only itermitantly.
any ideas why sometime it doesnt work.
p.s. the pattern can appear anywhere within the file