All,
I want to run a program and write the result to a Blank IE window, I have the following code but it always overwrites and I would rather keep adding to the window I.E.
Process Started
Stopped Process Notepad
Started Process Notepad
Process Finished
Instead all I get is the windows flashing by and it ending up with Process Finished.
CODE:
Set objExplorer = Wsript.CreateObject
"InternetExplorer.Application"
objExplorer.Navigate "about:blank"
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Width=400
objExplorer.Height = 200
objExplorer.Left = 0
objExplorer.Top = 0
Do While (objExplorer.Busy)
Wscript.Sleep 200
Loop
objExplorer.Visible = 1
objExplorer.Document.Body.InnerHTML = "Retrieving service information. " _
& "This might take several minutes to complete."
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2"
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'Notepad.exe'"
For Each objProcess in colProcessList
objProcess.Terminate()
objExplorer.Document.Body.InnerHTML = objProcess.Name & " Terminated"
Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2:Win32_Process"
Error = objWMIService.Create("notepad.exe", null, null, intProcessID)
If Error = 0 Then
objExplorer.Document.Body.InnerHTML = "Notepad was started with a process ID of " _
& intProcessID & "."
Else
objExplorer.Document.Body.InnerHTML = "Notepad could not be started due to error " & _
Error & "."
End If
objexplorer.Document.Writeln "Finished"
Wscript.Sleep 3000
Wscript.Quit
I want to run a program and write the result to a Blank IE window, I have the following code but it always overwrites and I would rather keep adding to the window I.E.
Process Started
Stopped Process Notepad
Started Process Notepad
Process Finished
Instead all I get is the windows flashing by and it ending up with Process Finished.
CODE:
Set objExplorer = Wsript.CreateObject
"InternetExplorer.Application"
objExplorer.Navigate "about:blank"
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Width=400
objExplorer.Height = 200
objExplorer.Left = 0
objExplorer.Top = 0
Do While (objExplorer.Busy)
Wscript.Sleep 200
Loop
objExplorer.Visible = 1
objExplorer.Document.Body.InnerHTML = "Retrieving service information. " _
& "This might take several minutes to complete."
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2"
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'Notepad.exe'"
For Each objProcess in colProcessList
objProcess.Terminate()
objExplorer.Document.Body.InnerHTML = objProcess.Name & " Terminated"
Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2:Win32_Process"
Error = objWMIService.Create("notepad.exe", null, null, intProcessID)
If Error = 0 Then
objExplorer.Document.Body.InnerHTML = "Notepad was started with a process ID of " _
& intProcessID & "."
Else
objExplorer.Document.Body.InnerHTML = "Notepad could not be started due to error " & _
Error & "."
End If
objexplorer.Document.Writeln "Finished"
Wscript.Sleep 3000
Wscript.Quit