2012-12-15, 02:37
Here's something in Autohotkey that might work.
I don't have steam, so i can't really check.
I don't have steam, so i can't really check.
Code:
#NoEnv
#Singleinstance force
#persistent
DetectHiddenWindows, On
SendMode Input
#NoTrayIcon
SetWorkingDir %A_ScriptDir%
SetTitleMatchMode, 3
Autotrim, off
Process, Exist, steam.exe
steam_pid=%errorLevel%
If (steam_pid = 0)
{
{
If ! errorLevel
{
}
}
"C:\Program Files (x86)\Steam\Steam.exe" -shutdown
}
else
{
WinMinimize, XBMC
Process_Suspend("xbmc.exe")
Runwait, "C:\Program Files (x86)\Steam\Steam.exe" -bigpicture
Run, "C:\Program Files (x86)\Steam\Steam.exe" -shutdown
Process_Resume("xbmc.exe")
WinRestore, XBMC
}
exitapp
esc::
exit
ProcExist(PID_or_Name=""){
Process, Exist, % (PID_or_Name="") ? DllCall("GetCurrentProcessID") : PID_or_Name
Return Errorlevel
}
Process_Resume(PID_or_Name){
PID := (InStr(PID_or_Name,".")) ? ProcExist(PID_or_Name) : PID_or_Name
h:=DllCall("OpenProcess", "uInt", 0x1F0FFF, "Int", 0, "Int", pid)
If !h
Return -1
DllCall("ntdll.dll\NtResumeProcess", "Int", h)
DllCall("CloseHandle", "Int", h)
}
Process_Suspend(PID_or_Name){
PID := (InStr(PID_or_Name,".")) ? ProcExist(PID_or_Name) : PID_or_Name
h:=DllCall("OpenProcess", "uInt", 0x1F0FFF, "Int", 0, "Int", pid)
If !h
Return -1
DllCall("ntdll.dll\NtSuspendProcess", "Int", h)
DllCall("CloseHandle", "Int", h)
}