10-19-2016, 01:28 PM
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