Link to home
Start Free TrialLog in
Avatar of rosado
rosado

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of lostcarpark
lostcarpark

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rosado
rosado

ASKER

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
Avatar of rosado

ASKER

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!