|
SageTV Software Discussion related to the SageTV application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the SageTV software application should be posted here. (Check the descriptions of the other forums; all hardware related questions go in the Hardware Support forum, etc. And, post in the customizations forum instead if any customizations are active.) |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
How do I know SageTV is up and running?
Pelase forgive me if my question doesn't belong here, I'm not sure where else to post it .
I need a way to send events to SageTV without having to care explicitly whether it is currently loaded or not, the message should just reach it, period. I wrote a program that searches for window SageWin/SageApp; if the window is found, event is sent, done. If the window is not there, the program automatically launches SageTV.exe and polls until the window is found so that the message can be sent. Sounds simple, but apparently it isn't that straightforward. I've noticed that the window gets created and consequently found by my program almost immediately after SageTV.exe is launched, but it takes a few more seconds before the UI actually appears and if I send my event right after I found the window, but before the init of SageTV is complete, my event is completely ignored... So, my question is, is there a way to determine that SageTV is ready to receive events? The reason for all this is I want to assign some of the buttons on my remote to do certain functions within SageTV, like Guide, Live TV, Music, etc... But SageTV may not be loaded at the moment. |
#2
|
|||
|
|||
Just bumping... Anybody any ideas?
Alex. |
#3
|
||||
|
||||
Are you saying you want to open sagetv and load guide/tv/music even if sagetv is not currently running? Why not just have a button for power on/off?
I use Keyspan Media Remote IR receiver (which is using a JVR VCR remote profile, which my Harmony 520 emulates, but that's besides the point). It detects SageTV.exe and uses custom key profile for it. I have a Power button programed on the remote such that if SageTV.exe is not running, it uses the default profile for that button, which is to launch SageTV.exe. If SageTV.exe IS running, it uses the custom profile for it, which is "Alt-F4", which closes SageTV. |
#4
|
|||
|
|||
Thanks for replying, morfinx.
I want a bit more then just turn SageTV on/off. As you mentioned, I want to be able to press guide/tv/music/etc button on my remote and have SageTV launched if it's not running and switch to the proper screen immediately after it is launched. It can be done by sending proper event to the running instance of SageTV, but I need a way to know when the instance is ready to receive events... Alex. |
#5
|
|||
|
|||
Found a solution!
In case anybody is interested, I found a solution .
It's a freeware opensource utility called AutoHotkey (http://www.autohotkey.com/). It is surprisingly powerful and easy to use scripting utility. Check it out. Here's my sample script I wrote for the task: Code:
; This function makes sure SageTV is loaded and is in focus. ActivateSageTV() { ; Main app window is not present? if WinActive("ahk_class sage.SpecialWindow") = 0 { ; Load app. Run "C:\Program Files\SageTV\SageTV\SageTV.exe" ; Wait until the main app window is active. Loop { if WinActive("ahk_class sage.SpecialWindow") { break } } } ; Make sure the window has focus. WinActivate ahk_class sage.SpecialWindow ; Locate the event window. DetectHiddenWindows, On WinExist("ahk_class SageApp") } ; Ctrl-Alt-F11 global hotkey handler. ^!F11:: ActivateSageTV() SendMessage, 0x4EA, 0, 18 return ; Ctrl-Alt-F12 global hotkey handler. ^!F12:: ActivateSageTV() SendMessage, 0x4EA, 0, 42 return |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|