'========================================================================== ' ' VBScript Source File -- Created with SAPIEN Technologies PrimalScript 2009 ' '========================================================================== Function RegExReplace(strString,strPattern,strReplace) On Error Resume Next Dim RegEx Set RegEx = New RegExp ' Create regular expression. RegEx.IgnoreCase = True ' Make case insensitive. RegEx.Global=True 'Search the entire String RegEx.Pattern=strPattern If RegEx.Test(strString) Then 'Test if match is made RegExReplace = regEx.Replace(strString, strReplace) ' Make replacement. Else 'return original string RegExReplace=strString End If End Function Function RegExMatch(strString,strPattern) Dim RegEx RegExMatch=False Set RegEx = New RegExp RegEx.IgnoreCase = True RegEx.Global=True RegEx.Pattern=strPattern If RegEx.Test(strString) Then RegExMatch=True End Function Function GetMatch(strString,strPattern) Dim RegEx,arrMatches Set RegEx = New RegExp RegEx.IgnoreCase = True RegEx.Global=True RegEx.Pattern=strPattern Set colMatches=RegEx.Execute(strString) Set GetMatch=colMatches End Function Set objfso=CreateObject("Scripting.FileSystemObject") Set objFile=objfso.OpenTextFile("c:\test\drives.html") Do While objFile.AtEndOfStream <> True html=objFile.ReadAll() Loop objFile.Close 'get just the table If RegExMatch(html,"]*>([\S\s]*?)") Then Set matches=GetMatch(html,"]*>([\S\s]*?)") For Each match In matches tableText=Trim(match.value) Next End If 'strip off tags tableText = RegexReplace(tableText,"]*>","") 'convert to "," tableText = RegexReplace(tableText,"",CHR(34) & "," & CHR(34)) 'convert or to " tableText = RegexReplace(tableText,"|",CHR(34)) 'convert to "," tableText = RegexReplace(tableText,"",CHR(34) & "," & CHR(34)) 'convert or to " tableText = RegexReplace(tableText,"|",CHR(34)) 'strip off any remaining tags tableText = RegexReplace(tableText,"<(?![!/]?[ABIU][>\s])[^>]*>","") 'turn remaining text into an array arrText=Split(tabletext,VbCrLf) 'strip out blank lines For i=0 To UBound(arrText) -1 if Len(arrText(i)) >0 Then 'or send output to a text file WScript.Echo arrText(i) End if Next