Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

GUI in VBScript

152 views
Skip to first unread message

Marcel de Haas

unread,
Oct 12, 2003, 10:10:26 AM10/12/03
to
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


Torgeir Bakken (MVP)

unread,
Oct 12, 2003, 11:52:58 AM10/12/03
to
Marcel de Haas wrote:

> 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.

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=%23wIsRfZoCHA.2280%40TK2MSFTNGP12

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=3DC99A88.9AC15A90%40hydro.com


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
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter


Marcel de Haas

unread,
Oct 12, 2003, 1:26:38 PM10/12/03
to
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


"Torgeir Bakken (MVP)" <Torgeir.B...@hydro.com> wrote in message
news:3F8978D9...@hydro.com...

Torgeir Bakken (MVP)

unread,
Oct 12, 2003, 2:14:01 PM10/12/03
to
Marcel de Haas wrote:

> 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.

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

0 new messages