GUI in VBScript

Discussion in 'Scripting' started by Marcel de Haas, Oct 12, 2003.

  1. Hi everyone,

    I would like to know if it is possible to add a GUI window to my BVScript.
    It needs to be something like the Windows you get after installing IE. So it
    needs to be able to contain some labels which can be set to a bold font. And
    it needs to have a Bitmap which can be shown and hidden from the script.

    Many tahnks in advance,

    Marcel de Haas
    Marcel de Haas, Oct 12, 2003
    1. Advertisements

  2. Hi

    WSH/VBScript has nothing built-in for this (see further down for some
    workarounds that can be used from WSH/VBScript).

    You could consider using HTA (HTML Application) instead (*.HTA files hosted by

    HTML Applications (HTAs)

    A HTA/WMI example can be found here:

    Subject: Re: FileNotify is not working for me (Windows XP SP1). Also:
    DOS script execution problems
    Newsgroups: microsoft.public.scripting.wsh

    Another HTA example:

    From: Michael Harris \(MVP\)
    Subject: Re: WSh and drive mappings
    Newsgroups: microsoft.public.scripting.wsh[email protected]

    If you want to use WSH/VBScript:

    You can do it from a vbscript using the Internet Explorer instance as a GUI,
    here is an example

    You can also take a look at the free wshLWForm.ocx (you will need to register it
    on the computer with regsvr32.exe (/s for silent)) .

    wsh Lite Weight Form, (Generation II)...
    Torgeir Bakken (MVP), Oct 12, 2003
    1. Advertisements

  3. Torgeir,

    Thanks for the reply, Now I will just have to find a way to present the data
    in a manner that suits login script functionality.

    Marcel de Haas
    Marcel de Haas, Oct 12, 2003
  4. Hi

    Here is roughly what I use in the logon script:

    Dim oTheEnd Dim oTheEnd ' Do NOT remove, must be dimmed as a global

    Set oIE = CreateObject("InternetExplorer.Application")

    MsgMSIE "<BR>Processing Logon Script..."
    MsgMSIE "<HR><BR>"

    ' rest of logon script here

    'some dummy demo messages:

    MsgMSIE "Starting to map drives...<BR>"

    sDrvLetter = "J:"
    sSharePath = "\\server\share"
    MsgMSIE "Mapping Drive " & sDrvLetter & " to " & sSharePath & "<BR>"
    WScript.Sleep 3000

    MsgMSIE "<BR><HR>Logon Script Finished..."

    Sub SetupMSIE
    Dim sTitle, SWidth,SHeight, SWidthW, SHeightW

    sTitle = "AD Logon"

    With oIE

    ' Not an option with IE 6 SP1
    '.FullScreen = True

    .AddressBar = False
    .ToolBar = False
    .StatusBar = False
    .Resizable = False
    Do Until .readyState = 4: wscript.sleep 100: Loop

    With .document
    With .ParentWindow
    SWidth = .Screen.AvailWidth
    SHeight = .Screen.AvailHeight

    SWidthW = .Screen.AvailWidth / 2
    SHeightW = .Screen.AvailHeight / 1.5

    .resizeto SWidthW, SHeightW
    .moveto (SWidth - SWidthW)/2, (SHeight - SHeightW)/2

    End With

    .Write "<span id='theEnd'></span>"
    Set oTheEnd = .all.theEnd
    .Title = sTitle

    With .ParentWindow.document.body
    .style.backgroundcolor = "LightBlue"
    .style.Font = "10pt 'Arial'"
    '.style.borderStyle = "outset"
    '.style.borderWidth = "4px"
    End With
    oIE.Visible = True

    End With ' document
    End With ' oIE
    End Sub

    Sub MsgMSIE(sMsg)
    On Error Resume Next
    oTheEnd.insertAdjacentHtml "beforeBegin", sMsg & "<BR>"
    End Sub
    Torgeir Bakken (MVP), Oct 12, 2003
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.