답변1
아래 스크립트는 원하는 대로 수행되어야 합니다.팝업이 나타나면 닫고 다른 프로세스를 다시 시작하세요.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
i = x
Do While i = x
Set colProcesses = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'notepad.exe'")
'("Select * from Win32_Process Where Name = 'Name of Your process you are waiting for to start'")
If colProcesses.Count = 0 Then
'It does not exist do nothing
Else
For Each objProcess in colProcesses
'this will close the process you were watching, as soon as it starts
objProcess.Terminate()
'Closing the process you want to restart
Set colProcesses = objWMIService.ExecQuery _
("SELECT * FROM Win32_Process WHERE Name = 'winword.exe'")
'("SELECT * FROM Win32_Process WHERE Name = 'name of the process you want to terminate'")
For Each objProcess2 in colProcesses
objProcess2.Terminate()
Next
Dim objShell
Set objShell = WScript.CreateObject( "WScript.Shell" )
objShell.Run("""C:\Program Files (x86)\Internet Explorer\iexplore.exe""")
'objShell.Run("""process or application you want to start""")
Set objShell = Nothing
Next
End If
Loop