ffemtoncall
Programmer
What I have below is the script to find a server name, when the backup completed, how many files it was, and how many bytes it was.
When I run the script I get the first server name to catch and then the script exits. I think my logic is pretty sound. Anyone shed some light?
Thank you!
When I run the script I get the first server name to catch and then the script exits. I think my logic is pretty sound. Anyone shed some light?
Thank you!
Code:
Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Open("C:\temp\BEX_USDC01BK01_01406.txt")
Set objSelection = objWord.Selection
objSelection.Find.Forward = True
objSelection.Find.MatchWildcards = True
Do While True
'==========================================================
'Find server name
'==========================================================
preFind = "Backup of ""\\"
postFind = "\C:"
objSelection.Find.Text = preFind & "*" & postFind
objSelection.Find.Execute
If objSelection.Find.Found Then
strWord = objSelection.Text
strWord = Replace(strWord, preFind, "")
strWord = Replace(strWord, postFind, "")
strBody = strBody & strWord & vbCrLf
Else
Exit Do
End If
'==========================================================
'Find Time Ended
'==========================================================
preFind = "completed on 2/7/2008 at "
postFind = "\."
objSelection.Find.Text = preFind & "*" & postFind
objSelection.Find.Execute
If objSelection.Find.Found Then
strWord = objSelection.Text
strWord = Replace(strWord, preFind, "")
strWord = Replace(strWord, postFind, "")
strBody = strBody & strWord & vbCrLf
Else
Exit Do
End If
'==========================================================
'Find # Of Files
'==========================================================
preFind = "Backed up "
postFind = " files in"
objSelection.Find.Text = preFind & "*" & postFind
objSelection.Find.Execute
If objSelection.Find.Found Then
strWord = objSelection.Text
strWord = Replace(strWord, preFind, "")
strWord = Replace(strWord, postFind, "")
strBody = strBody & strWord & vbCrLf
Else
Exit Do
End If
'==========================================================
'Find Size
'==========================================================
preFind = "Processed "
postFind = " bytes in"
objSelection.Find.Text = preFind & "*" & postFind
objSelection.Find.Execute
If objSelection.Find.Found Then
strWord = objSelection.Text
strWord = Replace(strWord, preFind, "")
strWord = Replace(strWord, postFind, "")
strBody = strBody & strWord & vbCrLf
Else
Exit Do
End If
Loop
Wscript.Echo strBody
objDoc.close
objWord.quit