Re: Message to Users
From: Torgeir Bakken \(MVP\) (Torgeir.Bakken-spam_at_hydro.com)
Date: 09/22/04
- Next message: Daryl: "help with reading popup"
- Previous message: Daniel Vojvoda: "How to programmatically get the size of public folders on Exchange Server"
- In reply to: Anthony: "Re: Message to Users"
- Next in thread: Anthony: "Re: Message to Users"
- Reply: Anthony: "Re: Message to Users"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 22 Sep 2004 16:17:28 +0200
Anthony wrote:
> Could you explin how to impletment these in a script?
>
> as an example:
>
> if HollyJollyChristmas = "The best time of the year" then
> objshell.run ("\\<server ip>\<file name> /q:a /r:n",1,True
> end if
>
> So if I wanted to show that their was progress during the install of
> <file name> how would I inject this into the IE progress bars code?
>
> TIA
Below is a modified version of the 3rd example by Joe Earnest in
this link:
http://groups.google.com/groups?selm=%23BDv%24av%24DHA.1288%40TK2MSFTNGP10.phx.gbl
'--------------------8<----------------------
HollyJollyChristmas = "The best time of the year"
if HollyJollyChristmas = "The best time of the year" then
sTitle= "Installing updates"
nScrW= createobject( _
"htmlfile").parentWindow.screen.availWidth
nScrHt= createobject( _
"htmlfile").parentWindow.screen.availHeight
showBar oIe, sTitle
wscript.sleep 50
oIe.document.parentWindow.document.script.listop "<br />"
sInsert = "Installing security update KB123456, please wait...<br />"
oIe.document.parentWindow.document.script.listop sInsert
'objshell.run "\\<server ip>\<file name> /q:a /r:n",1,True
wscript.sleep 2000 'demo dummy operation only
sInsert = "Finished installing security update KB123456<br />"
oIe.document.parentWindow.document.script.listop sInsert
sInsert = "Installing security update KB65432, please wait...<br />"
oIe.document.parentWindow.document.script.listop sInsert
' objshell.run "\\<server ip>\<file name 2> /q:a /r:n",1,True
wscript.sleep 2000 'demo dummy operation only
sInsert = "Finished installing security update KB65432<br />"
oIe.document.parentWindow.document.script.listop sInsert
wscript.sleep 1000
msgbox "Script is complete.", _
vbOkOnly +vbSystemModal, sTitle
on error resume Next
oIe.quit
on error goto 0
end if
function showBar (roIe, usTitle)
set roIe= createobject( _
"internetExplorer.application")
roIe.navigate("about:blank")
do
wscript.sleep 50
loop until roIe.readyState=4
with roIe
.fullScreen= true
.toolbar = false
.statusBar = false
.addressBar = false
.resizable= false
.width= 540
.height= 240
.left= (nScrW -520) \2
.top= (nScrHt -240) \2
with .document
.writeLn ("<!doctype html public>")
.writeLn ("<html style=""border-style:outset;" _
& "border-width:4px"" " _
& "onKeyDown=""vbscript:SuppressKeys"" " _
& "onHelp=""vbscript:SuppressIeFns"" " _
& "onContextMenu=""vbscript:SuppressIeFns"">")
.writeLn ("<head>")
.writeLn ("<title>" & usTitle & "</title>")
.writeLn ("<style type=""text/css"">")
.writeLn ("body {background-color:#ece9d8;" _
& "text-align:center;" _
& "vertical-align:middle}")
.writeLn ("</style>")
.writeLn ("<script language=""vbscript"">")
.writeLn ("function SuppressKeys ()")
.writeLn ("select case window.event.keyCode")
.writeLn ("case 112, 114, 116")
.writeLn ("case else: if NOT " _
& "cbool(window.event.ctrlKey) then " _
& "exit function")
.writeLn ("end select")
.writeLn ("window.event.keyCode= 0")
.writeLn ("window.event.cancelBubble= true")
.writeLn ("window.event.returnValue= false")
.writeLn ("end function")
.writeLn ("function SuppressIeFns ()")
.writeLn ("window.event.cancelBubble= true")
.writeLn ("window.event.returnValue= false")
.writeLn ("end function")
.writeLn ("function ListOp (usInsert)")
.writeln ("window.insertfile.insertAdjacentHtml " _
& """beforeBegin"", usInsert")
.writeln ("window.insertfile.scrollIntoView")
.writeLn ("end function")
.writeLn ("</script>")
.writeLn ("</head>")
.writeLn ("<body scroll=""no"">")
.writeLn ("<table>")
.writeLn ("<tr>")
.writeLn ("<td style=""text-align:center;" _
& "font-family:Arial;font-size:16pt;" _
& "font-weight:bold"">")
.writeLn ("Installing updates")
.writeLn ("</td>")
.writeLn ("</tr>")
.writeLn ("<tr>")
.writeLn ("</td>")
.writeLn ("</tr>")
.writeLn ("<tr>")
.writeLn ("<td style=""padding-top:15px"">")
.writeLn ("<div id=""progresslist"" " _
& "style=""height:150px;width:460px;" _
& "max-height:100%;max-width:100%;" _
& "padding-left:10px;text-align:left;" _
& "font-family:Arial;font-size:10pt;" _
& "font-weight:bold;border-style:inset;" _
& "border-width:thin;overflow:scroll"">")
.writeLn ("<span id=""insertfile""></span>")
.writeLn ("</div>")
.writeLn ("</td>")
.writeLn ("</tr>")
.writeLn ("<tr>")
.writeLn ("<td style=""padding-top:20px;" _
& "width:400px;font-family:Arial;" _
& "font-size:10pt;" _
& "font-weight:bold"">")
.writeLn ("</td>")
.writeLn ("</tr>")
.writeLn ("</table>")
.writeLn ("</body>")
.writeLn ("</html>")
end with
.visible= true
end with
wscript.sleep 100
createobject("wscript.shell").appActivate _
usTitle
'createobject("autoItX.control").winActivate _
' usTitle, ""
end function
'--------------------8<----------------------
-- 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/default.mspx
- Next message: Daryl: "help with reading popup"
- Previous message: Daniel Vojvoda: "How to programmatically get the size of public folders on Exchange Server"
- In reply to: Anthony: "Re: Message to Users"
- Next in thread: Anthony: "Re: Message to Users"
- Reply: Anthony: "Re: Message to Users"
- Messages sorted by: [ date ] [ thread ]