#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. Process, Exist, xbmc.exe ; check to see if xbmc.exe is running If (ErrorLevel = 0) ; If it is not running { Run, C:\Program Files (x86)\XBMC\xbmc.exe } WinWait,XBMC,,10 ;wait for 5 seconds for it WinActivate ;Activate the window, in case the it's in the background. WinShow ;Bring it to front. return SetTitleMatchMode 2 ;Search string #IfWinActive XBMC ahk_class XBMC ; Detect when XBMC is active Return #IfWinActive ;