Monday, June 13, 2011

XMBC starter

my AutoIT script that continuously runs
waiting for the global hotkey (Win+Alt+Enter)
sent from my remote


HotKeySet("#!{ENTER}", "StartXbmc")

While 1
    Sleep(100)
WEnd

Func StartXbmc()
 Opt("WinTitleMatchMode",2)
 If ProcessExists("xbmc.exe") Then
  If WinActive("[TITLE:XBMC]") Then
   Send("^!{F5}")
  Else
   WinActivate("[TITLE:XBMC]")
  EndIf
 Else
  ; check for winamp
  $PID = ProcessExists("winamp.exe") ; Will return the PID or 0 if the process isn't found.
  If $PID Then ProcessClose($PID)

  Run("C:\Program Files (x86)\XBMC\XBMC.exe", "", @SW_MAXIMIZE);
 EndIf
EndFunc