Skip to content

Instantly share code, notes, and snippets.

@mlhaufe
Created January 6, 2012 00:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mlhaufe/1568244 to your computer and use it in GitHub Desktop.
Save mlhaufe/1568244 to your computer and use it in GitHub Desktop.
Getting html details (VBScript)
'Reference: <http://www.visualbasicscript.com/tm.aspx?high=&m=95638&mpage=1>
Option Explicit
Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")
Dim files : Set files = fso.GetFolder("C:\test\").Files
Dim file
For Each file In files
If file.Type = "Firefox Document" Then '<-- update for your system
Dim doc : Set doc = CreateObject("htmlfile")
doc.write fso.OpenTextFile(file.Path).ReadAll()
WScript.Echo doc.title
doc.title = doc.title & " (Modified)"
WScript.Echo doc.documentElement.outerHTML
End If
Next
@iisboy
Copy link

iisboy commented Dec 14, 2020

@iisboy I believe "htmlfile" is equivalent to Internet Explorer 6, and therefore supports ECMAScript version 3. Which means no JSON object.

Perhaps using a 3rd party library would help?

@mlhaufe:thanks for your help ,i just make a test .the result:in win7+IE10,or in 2012+,my code run all in well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment