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,

    Regards,
    Marcel de Haas
     
    Marcel de Haas, Oct 12, 2003
    #1
    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
    mshta.exe):

    HTML Applications (HTAs)
    http://msdn.microsoft.com/workshop/author/hta/hta_node_entry.asp


    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
    http://groups.google.com/groups?th=4f2f872fdab3e8a1


    Another HTA example:

    From: Michael Harris \(MVP\)
    Subject: Re: WSh and drive mappings
    Newsgroups: microsoft.public.scripting.wsh
    http://groups.google.com/groups?selm=#wIsRfZoCHA.2280@TK2MSFTNGP12



    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

    http://groups.google.com/groups?selm=


    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)...
    http://home.att.net/~wshvbs/wshLWForm_GenII_Page.htm
     
    Torgeir Bakken (MVP), Oct 12, 2003
    #2
    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.

    Regards,
    Marcel de Haas
     
    Marcel de Haas, Oct 12, 2003
    #3
  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
    variable!!!

    Set oIE = CreateObject("InternetExplorer.Application")
    SetupMSIE

    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
    .Navigate("about:blank")
    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

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

    With .ParentWindow.document.body
    .scroll="no"
    .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>"
    oTheEnd.scrollIntoView
    End Sub
     
    Torgeir Bakken (MVP), Oct 12, 2003
    #4
    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.