May 25, 2003 #1 Smithsco Technical User Mar 30, 2003 89 AU I have a file that will contain Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Minimum = 40ms, Maximum = 0ms, Average = 0ms I want to just get the actual numbers out of each line and place them into a variable eg: oMin would be 40 etc Any idea's
I have a file that will contain Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Minimum = 40ms, Maximum = 0ms, Average = 0ms I want to just get the actual numbers out of each line and place them into a variable eg: oMin would be 40 etc Any idea's
May 26, 2003 1 #2 BDC2 Programmer Mar 14, 2002 435 GB Open the file and read each line. If the line contains "Minimum" then extract the number. I assume your familiar with the filesystemobject. so... If InStr(fso.ReadLine,"Minimum">0 then TextStr = fso.ReadLine StartNo = InStr(TextStr,"Minimum" + 10 EndNo = InStr(TextStr,"ms" oMin = Mid(TextStr,StartNo,EndNo-StartNo) TextStr = RIGHT(TextStr,len(TextStr)-(EndNo+2)) StartNo = InStr(TextStr,"Maximum" + 10 EndNo = InStr(TextStr,"ms" oMax = Mid(TextStr,StartNo,EndNo-StartNo) TextStr = RIGHT(TextStr,len(TextStr)-(EndNo+2)) StartNo = InStr(TextStr,"Average" + 10 EndNo = InStr(TextStr,"ms" oAve = Mid(TextStr,StartNo,EndNo-StartNo) End If BDC. Upvote 0 Downvote
Open the file and read each line. If the line contains "Minimum" then extract the number. I assume your familiar with the filesystemobject. so... If InStr(fso.ReadLine,"Minimum">0 then TextStr = fso.ReadLine StartNo = InStr(TextStr,"Minimum" + 10 EndNo = InStr(TextStr,"ms" oMin = Mid(TextStr,StartNo,EndNo-StartNo) TextStr = RIGHT(TextStr,len(TextStr)-(EndNo+2)) StartNo = InStr(TextStr,"Maximum" + 10 EndNo = InStr(TextStr,"ms" oMax = Mid(TextStr,StartNo,EndNo-StartNo) TextStr = RIGHT(TextStr,len(TextStr)-(EndNo+2)) StartNo = InStr(TextStr,"Average" + 10 EndNo = InStr(TextStr,"ms" oAve = Mid(TextStr,StartNo,EndNo-StartNo) End If BDC.
May 26, 2003 1 #3 Bullschmidt Programmer May 20, 2003 331 US One thing you could do is Split() on the comma and then split each part on the =. And here is the language reference for more info on Split(): http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vbscripttoc.asp Best regards, J. Paul Schmidt - Freelance ASP Web Developer http://www.Bullschmidt.com - Creating "dynamic" Web pages that read and write from databases... Upvote 0 Downvote
One thing you could do is Split() on the comma and then split each part on the =. And here is the language reference for more info on Split(): http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vbscripttoc.asp Best regards, J. Paul Schmidt - Freelance ASP Web Developer http://www.Bullschmidt.com - Creating "dynamic" Web pages that read and write from databases...