SAPIEN Solutions

SAPIEN homepage
PrimalScript script editor+ide
PrimalScope script debugger
Free Tools script utilities
SAPIEN Press tech books
ScriptingAnswers.com learn+share
ScriptingOutpost.com online store
Blog.Sapien.com official blog
Contact Us

 

Automating Internet Explorer

 This quick example shows how to automate Internet Explorer. In this example, I just pop up IE and navigate to a particular page, and then write the page’s HTML content out to a local file.

  1. '
  2. ' ScriptingAnswers.com Essentials - by Don Jones
  3. '
  4. ' Automate IE example
  5. ' This shows how to automate IE to navigate to a Web
  6. ' page and then save the body of the page into an HTML
  7. ' file

  8. Dim objIE, objFSO, objTS
  9. Set objIE = CreateObject("InternetExplorer.Application")
  10. Set objFSO = CreateObject("Scripting.FileSystemObject")

  11. objIE.Navigate("http://www.scriptinganswers.com")
  12. Do While objIE.Busy
  13. WScript.Sleep 500
  14. Loop

  15. Set objTS = objFSO.CreateTextFile("C:\WebPage.html")
  16. objTS.Write objIE.Document.Body.InnerHTML
  17. objTS.Close
[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Tags: , , , , ,

Leave a Reply


Entries (RSS) and Comments (RSS).