SageTV Community  

Go Back   SageTV Community > SageTV Products > SageTV Software
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

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.)

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-21-2006, 12:04 PM
jvfff jvfff is offline
Sage User
 
Join Date: Dec 2006
Posts: 30
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.
Reply With Quote
  #2  
Old 12-26-2006, 05:58 PM
jvfff jvfff is offline
Sage User
 
Join Date: Dec 2006
Posts: 30
Just bumping... Anybody any ideas?
Alex.
Reply With Quote
  #3  
Old 12-26-2006, 08:07 PM
morfinx's Avatar
morfinx morfinx is offline
Sage Advanced User
 
Join Date: Sep 2006
Posts: 147
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.
Reply With Quote
  #4  
Old 12-27-2006, 07:25 PM
jvfff jvfff is offline
Sage User
 
Join Date: Dec 2006
Posts: 30
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.
Reply With Quote
  #5  
Old 12-28-2006, 03:48 PM
jvfff jvfff is offline
Sage User
 
Join Date: Dec 2006
Posts: 30
Thumbs up 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
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 08:04 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.