| |
esnmb
Posts: 431
Score: 0
Joined: 1/11/2005
From: USA
Status: offline
|
If you ever need a status window for yourself or a user t let them know that a background process is running..... On Error Resume Next ''''''''''''''''''Creates an Internet Explorer instance to display script status ''''''''''''''''''' Set objExplorer = Wscript.CreateObject("InternetExplorer.Application", "IE_") objExplorer.Navigate "about:blank" objExplorer.ToolBar = 0 objExplorer.StatusBar = 0 objExplorer.Top = 180 objExplorer.Left = 200 objExplorer.Width = 630 objExplorer.Height = 320 objExplorer.Visible = 1 objExplorer.Resizable = 0 Do While (objExplorer.Busy) Wscript.Sleep 250 Loop 'Defines HTML code for status window Set objDocument = objExplorer.Document objDocument.Open objDocument.Writeln "<html><head><title>^^ Status Window^^</title></head>" objDocument.Writeln "<style type=""text/css"">body {background-color: #FFFFFF;}"_ & ".style2 {font-family: Arial, Helvetica, sans-serif;font-size: 10.5pt;color: "_ & "#CC6600;font-weight: bold;}.style3 {font-family: Arial, Helvetica, sans-serif}"_ & "body,td,th {font-family: Arial, Helvetica, sans-serif;}</style></head><body>" objDocument.Writeln "<img src=""file:///F|/Users/SHARED/IT/Procedures/New Hires/Content/Images/logo.gif"" width=""189"" height=""46"">" objDocument.body.style.cursor = "Wait" objDocument.Writeln "<p class=""style2""><B>Please wait while APPLICATION is loading...<br>" objDocument.Writeln "<br>Please be patient...<br></p>" ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Do Until colProcesses.Count = 0 objDocument.Writeln "*" Wscript.Sleep 250 Set colProcesses = objWMIService.ExecQuery _ ("SELECT * FROM Win32_Process WHERE Name = 'Notepad.exe'") ' ** Change this to the EXE of your choice ** Loop objDocument.Writeln "<p class=""style2"">Application is complete.</p>" objDocument.body.style.cursor = "Default" objDocument.Writeln "</body></html>" objDocument.Writeln() objDocument.Close call killProg("IExplore.exe") Sub killProg(prog) WScript.Sleep(2000) strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colProcessList = objWMIService.ExecQuery _ ("Select * from Win32_Process Where Name = '" & prog & "'") For Each objProcess in colProcessList objProcess.Terminate() Next End Sub
|
|