Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

searching for text in a reflection session.

Status
Not open for further replies.

agough

Technical User
Aug 29, 2003
1
AU

Hi,
This is probably as basic as it gets,but not being a programmer I am stumped, I searched the web in vain.

I used reflection X ,to create a visual basic macro to connect to a unix box,
The last part of the script reading:

.Transmit "more wls.log | grep error" & CR

What would be the vb code to search for instances of the text "error" in the reflection session and display a msgbox to indicate that the text "error" had been found ?

I apologise if this is trivial but would really appreciate any help.


 
This will work in VB6:


Private Sub Form_Load()
If InStr(1, ReadFile("wlr.log"), "error", vbTextCompare) > 0 Then
MsgBox "Error found", vbOKOnly
End If
End Sub

Public Function ReadFile(ByVal FileName As String) As String
'Read an entire file in one gulp.
Dim hFile As Long
Dim bBuf() As Byte

hFile = FreeFile
Open FileName For Binary Access Read As #hFile
If LOF(hFile) > 0 Then
ReDim bBuf(1 To LOF(hFile)) As Byte
Get #hFile, , bBuf
Close #hFile
ReadFile = StrConv(bBuf, vbUnicode)
End If
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top