2012-10-11, 17:59
Yes, it will work. The code will be:
Code:
1::
Shutdown 2 ; 2 for restart
global DVBViewerPath := GetSettings("DVBViewer_Path", ProgFiles . "\DVBViewer\dvbviewer.exe")
global DVBViewerRunning = 0
global DVBViewerGetStatus := GetSettings("DVBViewerGetStatus", 0)
global DVBViewerSize = 0
global DVBViewerActive = 0
Menu, Tray, add, Set DVBViewer Path (for focus disable), MenuSetDVBViewerHandler
Menu, Tray, add, Ignore if DVBViewer is minimized, MenuCheckDVBViewerGetStatusHandler
Menu, Tray, UnCheck, Ignore if DVBViewer is minimized
Menu, Tray, add
if (DVBViewerGetStatus = 1)
Menu, Tray, Check, Ignore if DVBViewer is minimized
SetTimer, MonitorEvents, 500
MonitorEvents:
KeepFocus()
CheckDVBViewerRunning()
GetDVBViewerSize()
StartExplorer()
MonitorCustomShutdown()
DisableFocusOnExternalPlayer()
DisableFocusOnDVBViewer()
return
MenuSetDVBViewerHandler:
DVBViewerPath := SaveApplicationPath("DVBViewer", DVBViewerPath)
return
MenuCheckDVBViewerGetStatusHandler:
CheckDVBViewerGetStatus()
return
KeepFocus()
{
if (FocusDelay = 0 or DisableFocusTemporarily = 1 or ExternalPlayerRunning = 1 or DVBViewerActive = 1) ; <----------- add "DVBViewerActive = 1"
; >>>>>>>>>>>> DVBViewer FUNCTIONS <<<<<<<<<<<<<<<<<<<<<<<<<
CheckDVBViewerGetStatus()
{
menu, tray, ToggleCheck, Ignore if DVBViewer is minimized
if (DVBViewerGetStatus = 0)
DVBViewerGetStatus = 1 ;enable. check DVBViewer window size
else
DVBViewerGetStatus = 0 ;disable. dont check DVBViewer window size
IniWrite, %DVBViewerGetStatus%, %SettingsPath%, Settings, DVBViewerGetStatus
return
}
GetDVBViewerSize()
{
WinGet, DVBViewerPresentSize, MinMax, ahk_class TfrmMain
if DVBViewerPresentSize < 0
DVBViewerSize = 0
if DVBViewerPresentSize = 0
DVBViewerSize = 1
if DVBViewerPresentSize = 1
DVBViewerSize = 2
}
CheckDVBViewerRunning()
{
SplitPath, DVBViewerPath, viewername
Process, exist, %viewername%
If (ErrorLevel >= 1)
DVBViewerRunning = 1
Else
DVBViewerRunning = 0
}
DisableFocusOnDVBViewer()
{
IF (DVBViewerRunning = 1 and DVBViewerGetStatus = 0)
DVBViewerActive = 1
Else If (DVBViewerRunning = 1 and DVBViewerGetStatus = 1)
{
If (DVBViewerSize > 0)
DVBViewerActive = 1
Else
DVBViewerActive = 0
}
Else
DVBViewerActive = 0
}
(2012-09-06, 16:11)baijuxavior Wrote: Yes you can change it. But remember to change the mce remote code for green start button also if you use mce remote. Because if you change Win+Alt+Enter in ahk code, this shortcut will start windows media center. But if you don't have an mce remote then it is ok to set the shortcut of your choice. The symbols to use are:
!: Sends an ALT keystroke.
+: Sends a SHIFT keystroke.
^: Sends a CONTROL keystroke
#: Sends a WIN keystroke
#!Enter:: ; Win+Alt+Enter
WinGetActiveStats, Title, Width, Height, X, Y
if Title = XBMC
WinActivate, ahk_class eHome Render Window
else if Title = Windows Media Center
WinActivate, ahk_class XBMC