(VBScript) Convert HTML to Plain Text
Demonstrates how to convert HTML to plain text.
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)
' This example requires the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.HtmlToText")
set h2t = CreateObject("Chilkat.HtmlToText")
html = h2t.ReadFileToString("c:/temp/test.html","utf-8")
If (h2t.LastMethodSuccess = 0) Then
outFile.WriteLine(h2t.LastErrorText)
WScript.Quit
End If
plainText = h2t.ToText(html)
If (h2t.LastMethodSuccess = 0) Then
outFile.WriteLine(h2t.LastErrorText)
WScript.Quit
End If
outFile.WriteLine(plainText)
outFile.Close
|