Micro Focus QTP (UFT) Forums
Grab multiple line data from log file - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Grab multiple line data from log file (/Thread-Grab-multiple-line-data-from-log-file)



Grab multiple line data from log file - haziqwebs - 10-19-2016

Actually I am doing automation on PuttY which it will login to putty and grab a certain data for me. But it only grab the first line output of the command. Can you please help me out?The data are grab from the log file of the putty. My current code :
Quote:Function GrabShSNMP
Const ForReading = 1
Set objRegEx = CreateObject("VBScript.RegExp")
objRegEx.Pattern = "show snmp community"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(Environment("logfile"), ForReading)
Do Until objFile.AtEndOfStream

    strSearchString = objFile.ReadLine

    Set colMatches = objRegEx.Execute(strSearchString)

    If colMatches.Count > 0 Then
    strSearchString = objFile.ReadLine
    Datatable.value("SNMP_Mode",dtGlobalsheet) = strSearchString

    End If
Loop
objFile.Close
Set objRegEx = Nothing
Set objFSO = Nothing
Set objFile = Nothing
End Function