G
grep
I'm having a devil of a time getting a parsing script to work, and am
hoping desperately for some guidance.
Here's the script thusfar - please understand that there's actually more
to it, but I'm finding troubleshooting scripts run from a rule to be
terribly difficult to troubleshoot (breakpoints don't seem to work) and
have to break things up to figure out where the problems are:
Sub TestScript(objMessage As Outlook.MailItem)
Dim arrLabels, arrData
Dim arrBody() As String
Dim strReadLine, strLabel
Dim intLocLabel As Integer
Dim intLocCRLF As Integer
Dim intLenLabel As Integer
Dim i
arrLabels = Array("Username:", "BackupSet:")
'Get message body and put each line into an array
arrBody = Split(objMessage.Body, vbCrLf)
For i = 0 To UBound(arrBody)
strReadLine = arrBody(i)
For Each strLabel In arrLabels
intLocLabel = InStr(strReadLine, strLabel)
intLenLabel = Len(strLabel)
If intLocLabel > 0 Then
MsgBox strLabel & " " & inLocLabel
End If
Next
Next
End Sub
Now, all this should do is find the labels, and display them and their
locations, if found. This script, thusfar, produces absolutely no
results. If I take out the If clause, however, and just replace it with
something like, MsgBox strLabel & " " & intLocLabel, that will work. I
get results like,
Username: 0
BackupSet: 0
until it reaches one that actually works, where it might say,
Username: 6
BackupSet: 0
or something like that.
So two questions here:
1. Why is the current rendition not working?
2. Is there a better way to test this script?
hoping desperately for some guidance.
Here's the script thusfar - please understand that there's actually more
to it, but I'm finding troubleshooting scripts run from a rule to be
terribly difficult to troubleshoot (breakpoints don't seem to work) and
have to break things up to figure out where the problems are:
Sub TestScript(objMessage As Outlook.MailItem)
Dim arrLabels, arrData
Dim arrBody() As String
Dim strReadLine, strLabel
Dim intLocLabel As Integer
Dim intLocCRLF As Integer
Dim intLenLabel As Integer
Dim i
arrLabels = Array("Username:", "BackupSet:")
'Get message body and put each line into an array
arrBody = Split(objMessage.Body, vbCrLf)
For i = 0 To UBound(arrBody)
strReadLine = arrBody(i)
For Each strLabel In arrLabels
intLocLabel = InStr(strReadLine, strLabel)
intLenLabel = Len(strLabel)
If intLocLabel > 0 Then
MsgBox strLabel & " " & inLocLabel
End If
Next
Next
End Sub
Now, all this should do is find the labels, and display them and their
locations, if found. This script, thusfar, produces absolutely no
results. If I take out the If clause, however, and just replace it with
something like, MsgBox strLabel & " " & intLocLabel, that will work. I
get results like,
Username: 0
BackupSet: 0
until it reaches one that actually works, where it might say,
Username: 6
BackupSet: 0
or something like that.
So two questions here:
1. Why is the current rendition not working?
2. Is there a better way to test this script?