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

Newbie Help, please!

164 views
Skip to first unread message

Shawn Bertin

unread,
Apr 19, 2003, 10:36:29 PM4/19/03
to
I am trying to run a script that executes a message window while the script
runs and then closes automatically at the end.

Any help would be much appreciated.

Thanks

Shawn bertin
sbe...@basics.com


Chris Allen

unread,
Apr 19, 2003, 10:56:26 PM4/19/03
to
User the following

msg = Shell.Popup("Type message here", 2, "Title Here", 0 + 48)

2 is the Timer. Set to how long you want the popup to be displayed for. Look
it up in the WSH reference for more information.

Thanks,
Chris Allen (ScriptJunkie)


"Shawn Bertin" <sbe...@basics.com> wrote in message
news:Op2VnWuB...@TK2MSFTNGP10.phx.gbl...

Atrax _

unread,
Apr 19, 2003, 10:59:46 PM4/19/03
to
um... tried using HTAs?

________________________________________
I got bored with my old signature,
so I changed it

Atrax. MVP, IIS
http://rtfm.atrax.co.uk/

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Chris Allen

unread,
Apr 19, 2003, 11:00:41 PM4/19/03
to
HTA's?
little more specific please

Thanks,
Chris Allen

"Atrax _" <anon...@devdex.com> wrote in message
news:ebjOnjuB...@TK2MSFTNGP12.phx.gbl...

Robert Cohen

unread,
Apr 20, 2003, 7:55:32 AM4/20/03
to
hta's are hypertext applications. It is like a client side ASP.


"Chris Allen" <Krazy...@hotmail.com> wrote in message
news:#iD6pkuB...@TK2MSFTNGP11.phx.gbl...

Shawn Bertin

unread,
Apr 20, 2003, 12:39:39 PM4/20/03
to

That seems to work, although it seems when I start to run the message
box, it will wait there until which time as the user clicks the ok
button, I wanted it to run along with the script.

Any help would be appreciated.

Thanks again.
Shawn

Robert Cohen

unread,
Apr 20, 2003, 1:03:34 PM4/20/03
to
clicks which okay button? What is your script now? If you are running it
as a HTA you have to change the extension to HTA.

"Shawn Bertin" <sbe...@basics.com> wrote in message

news:OjzDxt1...@TK2MSFTNGP10.phx.gbl...

Shawn Bertin

unread,
Apr 20, 2003, 4:19:39 PM4/20/03
to

Sorry I don't have much knowledge of HTA's, my script is rather simple
right now, I can e-mail it to you if you'd like.

All I want to do is have a popup message that says "Please wait while
your login script executes" run while the login script is executing, and
then automatically close once it has finished.

Any help on this operation would be much appreciated.

I was thinking of something like a do while ???

Torgeir Bakken (MVP)

unread,
Apr 20, 2003, 4:28:21 PM4/20/03
to
Shawn Bertin wrote:

> I am trying to run a script that executes a message window while the script
> runs and then closes automatically at the end.

Hi

Some examples of using IE from a vbscript (WSH) to create a progress "dialog":


Using ms Internet Explorer for Scripting Dialogs
http://home.att.net/~wshvbs/#UsingIEforDialogs


From: Christoph Basedau (cebit_...@gmx.net)
Newsgroups: microsoft.public.scripting.wsh
Date: 2003-02-20 03:01:10 PST
http://groups.google.com/groups?selm=uz6xz7M2CHA.1640%40TK2MSFTNGP10.phx.gbl


Subject: Showing progress of VB script execution.
Newsgroups: microsoft.public.scripting.vbscript
Date: 2002-07-25 23:29:21 PST
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=1dc201c2346d%240743aaf0%243aef2ecf%40TKMSFTNGXA09&rnum=1&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26selm%3D1dc201c2346d%25240743aaf0%25243aef2ecf%2540TKMSFTNGXA09


Here is an example on using IE to give the user status while the script is
progressing:


Set oIE = CreateObject("InternetExplorer.Application")
Set oShell = CreateObject("WScript.Shell")

sTitle = "Message dialog" ' used by AppActivate

With oIE

' .FullScreen = True with a resize will give a very
' "clean" window (kiosk mode).
' The only way for the user to close the window is using Alt+F4
' (or terminate iexplore.exe)

' Doesn't work very good with IE6 SP1 anymore
'.FullScreen = True

' Here is a workaround:

' For a more "normal" window with a title bar with close cross,
' disable the line line ".FullScreen = True" and enable the 4 lines
' below. The script will handle that the user closes the window

.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 * .25
SHeightW = .Screen.AvailHeight * .1

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

End With

' Joe Earnest's "refresh" protection
.WriteLn ("<html>")
.WriteLn ("<head>")

' If concatenating VBScript, concatenate
' vbCr's or vbCrLf's after each line.
' This script is placed in the head by
' convention; it can be placed in the body.

.WriteLn ("<script language=""vbscript"">")

' NOTE: The following code uses a hidden value to
' avoid external pushbutton subs.
' GetRef references to external subs in the script
' may also be used for pushbuttons.
' A hidden value provides better [x] or [Alt]+[F4] error
' trapping for a dialog with pushbuttons only, where no
' other controls are being polled.
' While this routine parses an exit button id in a specific manner,
' the entire exit buttion id could be placed the value,
' a string value could be polled, and the button id could be parsed
' later for specific operation.

.WriteLn ("Sub ExitButton ()")
.WriteLn ("ExitButtonID= LCase(Trim(window.event.srcelement.id))")
.WriteLn ("If Left(ExitButtonID, 4)=""xbtn"" Then")
.WriteLn ("window.exitbtn.value= Mid(ExitButtonID, 5)")
.WriteLn ("End If")
.WriteLn ("End Sub")

' NOTE: The following code traps refresh and context
' menu keys to avoid dialog corruption by refreshing.

.WriteLn ("Sub NoRefreshKey ()")
.WriteLn ("Select Case window.event.keycode")
.WriteLn ("Case 82: SuppressKey= window.event.ctrlkey")
.WriteLn ("Case 116: SuppressKey= True")
.WriteLn ("End Select")
.WriteLn ("If SuppressKey Then")
.WriteLn ("window.event.keycode= 0")
.WriteLn ("window.event.cancelbubble= True")
.WriteLn ("window.event.returnvalue= False")
.WriteLn ("End If")
.WriteLn ("End Sub")
.WriteLn ("Sub NoContextMenu ()")
.WriteLn ("window.event.cancelbubble= True")
.WriteLn ("window.event.returnvalue= False")
.WriteLn ("End Sub")

' NOTE: The following code implements the above subroutines.

.WriteLn ("Set document.onclick= GetRef(""ExitButton"")")
.WriteLn ("Set document.onkeydown= GetRef(""NoRefreshKey"")")
.WriteLn ("Set document.oncontextmenu= GetRef(""NoContextMenu"")")

.WriteLn ("</script>")
.WriteLn ("</head>")
.WriteLn ("<body>")

.WriteLn ("Script is Executing....")

.WriteLn ("</body>")
.WriteLn ("</html>")

With .ParentWindow.document.body
.style.backgroundcolor = "LightBlue"
.scroll="no"
.style.Font = "12pt 'Arial'"
'.style.borderStyle = "outset"
'.style.borderWidth = "2px"
End With

.Title = sTitle
oIE.Visible = True
WScript.Sleep 100
oShell.AppActivate sTitle
End With ' document
End With ' oIE

For i = 1 to 3
wscript.sleep 1500
MsgIE("Doing someting!" & vbCrLf & "New line # " & i)
Next

wscript.sleep 2000
MsgIE(" Script Complete!")

wscript.sleep 2000
MsgIE("IE_Quit")


Sub MsgIE(sMsg)
On Error Resume Next ' Just in case the IE window is closed
If sMsg = "IE_Quit" Then
oIE.Quit
Else
oIE.Document.Body.InnerText = sMsg
oShell.AppActivate sTitle
End If
End Sub

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


Michael Dunn

unread,
Apr 20, 2003, 4:46:35 PM4/20/03
to

"Shawn Bertin" <sbe...@basics.com> wrote in message news:etmhso3B...@TK2MSFTNGP10.phx.gbl...
:
: Sorry I don't have much knowledge of HTA's, my script is rather simple

: right now, I can e-mail it to you if you'd like.
:
: All I want to do is have a popup message that says "Please wait while
: your login script executes" run while the login script is executing, and
: then automatically close once it has finished.
:
: Any help on this operation would be much appreciated.
:
: I was thinking of something like a do while ???

Play around with something like this


for i = 1 to 1000000
if i = 1 then
set ie = createobject("internetexplorer.application")
ie.navigate "about:blank"
ie.height = 250
ie.width = 500
ie.visible = true
ie.document.body.innertext = "Please wait while your login script executes"

do until ie.readystate = 4
wscript.sleep 100
loop
end if

i = i+1

if i = 1000000 then ie.quit
next

wscript.sleep 1000
msgbox "i = " & i

set ie = nothing


Robert Cohen

unread,
Apr 21, 2003, 7:56:48 AM4/21/03
to
at a more basic level though, make sure your web page's extension is HTA
instead of HTM or ASP or such. Using the HTA extension calls on a different
program to open the page.

"Michael Dunn" <m_o...@yahoo.com> wrote in message
news:#rBU233B...@TK2MSFTNGP12.phx.gbl...

Shawn Bertin

unread,
Apr 21, 2003, 9:09:50 AM4/21/03
to
Thanks for all your help, I think I have a solution. Once it is
finished I will post my code on this page so everyone can learn from.
0 new messages