Message box would display: Running program, Please wait!
Example:
Start Message box
oShell.Run "program.exe", 0, True
End Message box
Any help would be highly appericiated..
Thanks
Please note that any popup can be dismissed by the user by clicking [x] or
with Alt+F4.
If you have an older OS (at least pre-XP and maybe pre-2k, I can't recall
right now) you can popup a modeless keyless message box. Unfortunately,
this ability went away in later OS's.
CreateObject("WScript.Shell").Popup("message",, "title", 75)
If you know approximately how long the process takes, you can use a popup
with a timer and a single Ok button, but its modal, so you'd need to run it
from a spin-off script (i.e., write and run without waiting a secondary
script with the command in it).
CreateObject("WScript.Shell").Popup("message", timer, "title", 64)
These are the easiest ways. Otherwise, you can write an
InternetExplorer.Application DHTML window dialog. I've posted
DialogDemo6.vbs previously, which has a number of DHTML
controls. You don't need the controls, only a message. You could
strip it down, but many simpler versions have been included in prior
posts. If you want a copy of mine, post back or email me, and I'll
email it to you. Otherwise do a Google search of the newsgroup for
IntenetExplorer.Application and dialog, or similar keywords.
(watch for url wrap)
http://www.google.com/advanced_group_search?as_ugroup=microsoft.public.scrip
ting.*
Joe Earnest
"Sahas" <sah...@dlink.co.in> wrote in message
news:03b601c2de28$40db57d0$a501...@phx.gbl...
"Sahas" <sah...@dlink.co.in> wrote in message
news:03b601c2de28$40db57d0$a501...@phx.gbl...
No such thing... but WSH is flexible, and you can use Internet Explorer (among
other tools) as a workaround.
Here's a script demoing this, drawn from the System Administration Scripting
Guide:
Set ie = WScript.CreateObject("InternetExplorer.Application")
ie.Navigate "about:blank": ie.ToolBar = 0
ie.StatusBar = 0: ie.Width = 400
ie.Height = 200: ie.Left = 0: ie.Top = 0
Do While(ie.Busy)
Wscript.Sleep 200
Loop
ie.Visible = 1
ie.Document.Body.InnerHTML = "Retrieving service information. " _
& "This might take several minutes to complete."
strComputer = "."
Set colServices = GetObject("winmgmts:" _
&"{impersonationLevel=impersonate}!\\" & strComputer _
& "\root\cimv2").ExecQuery("Select * from Win32_Service")
For Each objService In colServices
Wscript.Sleep 200
Next
ie.Document.Body.InnerHTML = "Service information retrieved."
Wscript.Sleep 3000
Wscript.Quit
--
Please respond in the newsgroup so everyone may benefit.
http://dev.remotenetworktechnology.com
(email requests for support contract information welcomed)
----------
Subscribe to Microsoft's Security Bulletins:
http://www.microsoft.com/technet/security/bulletin/notify.asp
> (snip)
>
> ie.Document.Body.InnerHTML = "Service information retrieved."
> Wscript.Sleep 3000
> Wscript.Quit
and maybe a ie.Quit after Wscript.Sleep?
Some other examples of using IE from a vbscript 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
"Mythran" <kip_p...@hotmail.com> wrote in message news:uz5POMo3...@TK2MSFTNGP11.phx.gbl...In order for this to work, you have to RENAME the attached dialogWindow.html file
to dialogWindow.vbs so it can execute properly under wscript. If you don't, it
just won't work :P
Anywho, this may be what you are after.
Mythran
> "Paul Randall" <paul...@cableone.net> wrote in
> message news:uWr93qo3...@TK2MSFTNGP10.phx.gbl...
>
> Do you have any ideas on what to do about it?
Remove that line...
Mythran