Thank you - these switches was the missing part.
Now my script kills MP after resuming, and then restarts MP
Steen.
The script is here:
Set colMonitoredEvents = GetObject("winmgmts:").ExecNotificationQuery("Select * from Win32_PowerManagementEvent")
Set WshShell = WScript.CreateObject("WScript.Shell")
Do
Set strLatestEvent = colMonitoredEvents.NextEvent
Select Case strLatestEvent.EventType
case 4
' Entering Suspend. uses the XP command taskkill to end a process.
case 7
' Resume from Suspend. Indicates that a ResumeSuspend message has been sent, enabling the computer to return to its regular power state.
WshShell.Run "c:\windows\system32\taskkill /F /IM Mediaportal.exe", 0,1
WshShell.Run """c:\programmer\Team Mediaportal\Mediaportal\Mediaportal.exe""", 1
case 18
'Resume Automatic. Indicates that the computer has awakened in response to an event.
WshShell.Run "c:\windows\system32\taskkill /F /IM MediaPortal.exe", 0,1
WshShell.Run """c:\programmer\Team Mediaportal\Mediaportal\Mediaportal.exe""", 1
End Select
Loop
Now my script kills MP after resuming, and then restarts MP
Steen.
The script is here:
Set colMonitoredEvents = GetObject("winmgmts:").ExecNotificationQuery("Select * from Win32_PowerManagementEvent")
Set WshShell = WScript.CreateObject("WScript.Shell")
Do
Set strLatestEvent = colMonitoredEvents.NextEvent
Select Case strLatestEvent.EventType
case 4
' Entering Suspend. uses the XP command taskkill to end a process.
case 7
' Resume from Suspend. Indicates that a ResumeSuspend message has been sent, enabling the computer to return to its regular power state.
WshShell.Run "c:\windows\system32\taskkill /F /IM Mediaportal.exe", 0,1
WshShell.Run """c:\programmer\Team Mediaportal\Mediaportal\Mediaportal.exe""", 1
case 18
'Resume Automatic. Indicates that the computer has awakened in response to an event.
WshShell.Run "c:\windows\system32\taskkill /F /IM MediaPortal.exe", 0,1
WshShell.Run """c:\programmer\Team Mediaportal\Mediaportal\Mediaportal.exe""", 1
End Select
Loop
Denmark