VBScript - Script Showing Results on an Internet Explorer Window

Posted on 2006-05-24
Last Modified: 2009-03-16
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
Question by:rosado
    LVL 5

    Accepted 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!

    Author Comment

    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

    Author Comment

    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.



    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    This article is filled with multiple code samples and explanations for mathematical calculations. They are as follows: 1. General tips 2. Quadratic formula 3. Object collision 4. Projectile path General Tips       Here are some of my tips f…
    A short article about problems I had with the new location API and permissions in Marshmallow
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now