• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 670
  • 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")
ActivateIE
Set IEWindow = objIE.Document.all("cont")
log("teste1")
log("teste2")
wscript.sleep 3000
objIE.quit

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
      loop
      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
0
rosado
Asked:
rosado
  • 2
1 Solution
 
lostcarparkCommented:
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!
0
 
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
loop

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  
next

 
wscript.sleep 2000
MYie.QUIT
0
 
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.

Rgds!

0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

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