Login | |
|
 |
RE: search a text file and send email based on string - 5/1/2008 2:16:43 AM
|
|
 |
|
| |
ebgreen
Posts: 4595
Score: 29
Joined: 7/12/2005
Status: offline
|
What have you written so far? Search for these terms to get yourself started: FileSystemObject OpenTextFile Regular Expression Regex Regexp
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: search a text file and send email based on string - 5/1/2008 4:51:30 AM
|
|
 |
|
| |
ebgreen
Posts: 4595
Score: 29
Joined: 7/12/2005
Status: offline
|
Start small. Figure out how to get your matching working before you worry about the emailing. Here is an example of the matching that might help: Option Explicit 'The test file contains this: 'Line 1 'Line 2 'This is the first part that we care about 'Line 4 'Line 5 'Another line that we want to Get 'Line 6 'Line 7 Dim oFSO : Set oFSO = CreateObject("Scripting.FileSystemObject") Dim strFile : strFile = oFSO.OpenTextFile("C:\Temp\Test.txt").ReadAll() Dim oRE : Set oRE = New RegExp Dim colMatches Dim oMatch oRE.Global = True oRE.Pattern = "(\n.*This is.*\n)|(\n.*Another.*\n)" Set colMatches = oRE.Execute(strFile) WScript.Echo colMatches.Count For Each oMatch In colMatches WScript.Echo Replace(oMatch.Value, vbLf, "") Next
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
| |
|
|
 |
|
 |
|
|