Saturday, May 06, 2006

Using EyeTV 2.1 to Orient a Roof Antenna

[Update: check out Signal GH, an iPhone utility for monitoring the signal quality of an HDHomerun].


[Update: also works with the 2.2 update]
If you own an EyeTV, you should know that the Preferences dialog, of all places, displays the signal strength and signal quality.

EyeTV signal strength Dialog

There's even a nice little check box to speak the signal quality with the Mac's text to speech service. It occurred to me that I could put a phone next to my computer, call my cell phone and listen to the signal quality change as I adjusted my antenna on the roof.


EyeTV Tuning Tools

Unfortunately, in my setup, signal quality is useless. When I tune into a marginal channel, the signal quality bounces between 0% and 100% with nothing in between. The signal strength, on the other hand, oscillates in a meaningful range. But there is no check box for speaking the signal strength. If only I could have the computer speak the value of the signal strength indicator. There must be a way.


First, I looked into Apple's Voice Over universal access software. Command-f5 starts the computer speaking the text for everything the mouse rolls over. Unfortunately, I wouldn't be there to roll the mouse back and forth.


Second, I looked at AppleScript. Perhaps, El Gato had made the signal strength property part of its AppleScript dictionary. No luck, but in looking in my AppleScript folder, I stumbled on the solution.

AppleScript Utility

I accidently launched the AppleScript Utility application, and was struck by the checkbox "Enable GUI Scripting" What was that? There were sample scripts under "UI ELement Scripts" in the global scripting menu, and they appeared to enable scriptors to access widgets buried in otherwise unscripted applications.


I launched EyeTV 2.1, and brought up the Preferences Dialog, and through trial and error, came up with this script:

[UPDATE: I've posted a slight modification of this script that works with EyeTV 2.2.1]

repeat
tell application "System Events"
if UI elements enabled then
tell process "EyeTV"
tell progress indicator 1 of UI element 1 of group 1 of tab group 1 of UI element 1 of UI element 1 of UI element 6 of window "EyeTV Preferences"
set mySignal to get value
set mySignal to mySignal * 100
set mySignalInt to mySignal as integer
end tell
end tell
else
display alert "Enable GUI scripting in the AppleScript Utility"
end if
end tell
say mySignalInt
delay 5
end repeat




Running this script in the AppleScript Editor will cause the signal strength to be spoken once every 5 seconds until you tell it to stop. I set EyeTV to display a marginal channel (in my case the Boston Fox affiliate) and started my script. Then I connected two cell phones together, leaving one next to my computer's speakers, and attaching a head set to the other. I listened to it as I made my way to the roof "58, 58, 56, 58, 54, 58, ..." always an even number for some reason. Then I adjusted my antenna until I was satisfied it wasn't going to get any better "62, 64, 64, 66, 62, 64, 64...". I had improved my antenna orientation just enough that EyeTV could now watch Fox consistently as it was over the magic 60 level. Success.


I would not be surprised if the script breaks with a different version of EyeTV. It depends on the window hierarchy being just so.
 
Google+