• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 697
  • Last Modified:

VBScript - Script Showing Results on an Internet Explorer Window

Hi All,

I want my logon script to open an IE window (with a page with a company logo on the top) and show the script results  (like "Mapping Network Drives", "Checking Disk Space", etc...) scrooling on it.

I can successfully open IE and show the results scrooling on a blank page but I cant figure out how to do that with a pre-created page since I need the company logo to stick to the top of the page and not scroll up as the results shows up.

Does anyone have any idea on how to do that or any refference that might help me? Thanks!
Here is the code I have so far. Basically "AcivateIE" opens IE and "Log" show the result on the IE Screen.

Thanks to ALL!

Set objIE = CreateObject("InternetExplorer.Application")
Set IEWindow = objIE.Document.all("cont")
wscript.sleep 3000

sub Log(var)                                                       
      set doc = objIE.document
      report = doc.documentelement.innerhtml             ' Need to keep adding the new results
      Report= Report & var & "<br>"               ' or old ones will be erased...
      IEWindow.INNERHTML = Report
      objIE.document.body.createtextrange.scrollIntoView False  
end sub

sub ActivateIE
      objIE.Navigate "about:blank"
      objIE.ToolBar = false:objIE.StatusBar = False:objIE.Resizable = True
      Do While objIE.Busy
      set doc = objIE.document
      objIE.Width = 600:objIE.Height = 400
      objIE.Left = 50:objIE.Top = 50
      objIE.Visible = True
      objIE.document.writeln("<html><title>Titulo</title><body><DIV id='cont'></DIV></body></html>")
      Set IEWindow = objIE.Document.all("cont")                                                                                                     
end sub
  • 2
1 Solution
Looks to me like you're most of the way there. Why not create a document with the company logo and an IFRAME container for the content?

You can create it in your document with:

     <iframe src="" id="report" name="report" style="position: absolute; top: 100px; right: 10px; bottom: 10px; left: 10px;"></iframe>

This creates an empty frame filling the page with a ten pixel margin around the it, and a gap of 100 pixels for your logo.

You can then access the contents of the IFRAME with code like:

     objIE.document.all("report").innerHTML = Report

Hope this helps!
rosadoAuthor Commented:
lostcarpark, this is really a great ideia! I am getting, however, a "Permission Denied" error on the "IEWindow.INNERHTML = Report" line... I cant figure out what it is or how to resolve it... and dont think that the browser security settings has anything to do with that. I isolated and reduced the code to facilitate the test (see below). Would you be able to give me some guidance again? Thanks!

Set myIE = CreateObject("InternetExplorer.Application")
myIE.Navigate "c:\scripttests\htmtest.htm"
'myIE.ToolBar = True:myIE.StatusBar = False:myIE.Resizable = True
Do While myIE.Busy

myIE.Visible = True
Set IEWindow = myIE.Document.all("report")
for t = 1 to 3
    Report= Report &"Test Line" &t & "<br>"
    IEWindow.INNERHTML = Report
    MyIE.document.body.createtextrange.scrollIntoView False  

wscript.sleep 2000
rosadoAuthor Commented:
lostcarpark, after some research, I was able to do that.

The frame tag wont accept bjIE.document.all("report").innerHTML. I had to use
objIE.Document.frames("report").document.body.innerHTML instead and its working. Now I need to figure out how to make the new results scroll the old ones up but I should raise another question for that.


Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now