Win Any way to kill xbmc process while watching videos with external player?
#1
hi guys, im using mpc-hc as an external video player in xbmc, when i start mpc-hc i want to be able to kill the xbmc process and when i stop or finish a movie (ctrl-alt-f4) i want to achieve xbmc to start again in the last screen i was using it, is it possible to make that happen? im despered 'cause it would be the only way to play videos smooth, xbmc uses 25% of my cpu and 25%-30% of ram most of the time, even when it's in the background and mpc-hc doing his thing. Any help would be awesome..
Reply
#2
You can write an autohotkey script to close xbmc when the external player is launched. I will just post the code to be used.

Code:
Process, Exist, xbmc.exe ; check to see if xbmc.exe is running
If (ErrorLevel >= 1) ; If it is running
Process, Close, %ErrorLevel%  ;close xbmc

There are two approaches to implement this - run the script in the background continuously and monitor the external application. As soon as the external player is loaded, kill xbmc. Another option is to start the script when you click the play menu in xbmc.

Reply
#3
(2012-09-26, 17:27)baijuxavior Wrote: You can write an autohotkey script to close xbmc when the external player is launched. I will just post the code to be used.

Code:
Process, Exist, xbmc.exe ; check to see if xbmc.exe is running
If (ErrorLevel >= 1) ; If it is running
Process, Close, %ErrorLevel%  ;close xbmc

There are two approaches to implement this - run the script in the background continuously and monitor the external application. As soon as the external player is loaded, kill xbmc. Another option is to start the script when you click the play menu in xbmc.

thanks again baijuxavior i knew you were the man when i choose to ask this in your thread too, lol, how can i create a autohotkey script im new to this, how can i achieve to close xbmc as soon as mpc starts and how to start again xbmc in the last screen i left it when i press crtl-alt-f4 to exit mpc video player,, thaks a lotttt!
Reply
#4
Download and install autohotkey from the link in my other post. Then right click any empty space in desktop or a folder and select New > Autohotkey script. A new .ahk file will be created. Right click it and select edit to open the script in notepad. To start xbmc use the code 'run C:\Program Files\XBMC\XBMC.exe'

Try this code:

Code:
SetTimer, Monitor, 1000 ; create a timer with interval 1000ms
Monitor:
{
Process, Exist, xbmc.exe ; check to see if xbmc.exe is running
If (ErrorLevel >= 1) ; If it is running
Process, Close, %ErrorLevel%  ;close xbmc
}

return

^!F4:: ; shortcut Ctrl+Alt+F4

Process, Exist, mpc-hc.exe
If (ErrorLevel >= 1) ; If it is running
Process, Close, %ErrorLevel%  ;close mpc-hc
run C:\Program Files\XBMC\XBMC.exe

To go to the last view when xbmc is restarted, you should save the view before closing xbmc and call it. I think there is a thread which describes this.

Reply
#5
(2012-09-26, 18:32)baijuxavior Wrote: Download and install autohotkey from the link in my other post. Then right click any empty space in desktop or a folder and select New > Autohotkey script. A new .ahk file will be created. Right click it and select edit to open the script in notepad. To start xbmc use the code 'run C:\Program Files\XBMC\XBMC.exe'

Try this code:

Code:
SetTimer, Monitor, 1000 ; create a timer with interval 1000ms
Monitor:
{
Process, Exist, xbmc.exe ; check to see if xbmc.exe is running
If (ErrorLevel >= 1) ; If it is running
Process, Close, %ErrorLevel%  ;close xbmc
}

return

^!F4:: ; shortcut Ctrl+Alt+F4

Process, Exist, mpc-hc.exe
If (ErrorLevel >= 1) ; If it is running
Process, Close, %ErrorLevel%  ;close mpc-hc
run C:\Program Files\XBMC\XBMC.exe

To go to the last view when xbmc is restarted, you should save the view before closing xbmc and call it. I think there is a thread which describes this.

thanks a lot baijuxavior, i did what you asked here but when the autohotkey is running xbmc refuses to load, i think the autohotkey keeps kiling it, but when i force to disable the autohotkey and then i double click in xbmc it starts as usual, does the autohotkey script needs to start as soon as windows 7 does?, i tried to start xbmc as normal and then double click in the script but again it closes xbmc as soon as it's running, it doesnt wait or look for mpc-hc to start to kill xbmc, what am i doing wrong here? sorry for my lack of knowledge
Reply
#6
My bad! We should be checking for mpc-hc and close xbmc.

Code:
SetTimer, Monitor, 1000 ; create a timer with interval 1000ms
Monitor:
{
Process, Exist, mpc-hc.exe ; check to see if mpc-hc is running
If (ErrorLevel >= 1) ; If it is running
Process, Close, xbmc.exe  ;close xbmc
}

return

^!F4:: ; shortcut Ctrl+Alt+F4

Process, Exist, mpc-hc.exe
If (ErrorLevel >= 1) ; If it is running
Process, Close, %ErrorLevel%  ;close mpc-hc
run C:\Program Files\XBMC\XBMC.exe

Remember to replace the mpc-hc.exe in the code with the correct process name. You can use task manager to know the process name.
Reply
#7
awesome! as soon as i get home from work im gong to try your code, do you recommend that i put the autohotkey script in windows 7 startup folder so it can be monitoring all the time? thanks a lot!
Reply
#8
Its a good idea to put the script in startup folder so that it works in the background.
Reply
#9
(2012-09-27, 19:02)baijuxavior Wrote: Its a good idea to put the script in startup folder so that it works in the background.

hey baijuxavior, i just got home and tried your new script, then i started xbmc as usual choose a movie: check, xbmc was killed: checked, mpc-hc started fine: checked, when i finished watching that video pushed my alt+f4 (i told you it was ctrl+alt+f4 my mistake) shortcut in my remote so i can exit mpc-hc, it exited o.k. but i was left in my lonely desktop and xbmc didn't started again ( i repeated that same procedure more than 10 times with the same results), so the script it's now kiliing xbmc fine when i start mpc-hc but when i exit it, it doesnt start xbmc, thanks so much for your help and patience bro!
P.D.: i already checked the mpc-hc.exe and XBMC.exe process name is exactly as you stated in your script code, the same applies to the XBMC. exe folder location (it's exacly the same as you have it in the script).
Reply
#10
modify the shortcut key which is ^!F4:: for Ctrl+Alt+F4. Replace it with !F4::

Remember ^ = Ctrl, ! = Alt, # = Win, + = Shift

If there is any problem with Alt+F4 code (!F4) then try $!F4
Reply
#11
(2012-09-28, 17:47)baijuxavior Wrote: modify the shortcut key which is ^!F4:: for Ctrl+Alt+F4. Replace it with !F4::

Remember ^ = Ctrl, ! = Alt, # = Win, + = Shift

If there is any problem with Alt+F4 code (!F4) then try $!F4

thanks a lot baijuxavior, the replacement with !F4:: did the trick everything is working as it should be, smooth playback and when i stop watching a movie with mpc-hc xbmc starts again in the last screen that was left,,awesome! thank you very much for your support!
Reply

Logout Mark Read Team Forum Stats Members Help
Any way to kill xbmc process while watching videos with external player?0