Elgato EyeTV Change Aspect Ratio

The Following script is found in Geniecommands and on the website.
This script works like a macro and uses apple UI to tell EyeTV to rotate through the available aspect ratios. As there is no command to find out what aspect ratio the machine is in, each time this script changes the aspect ratio it writes that data to “int.txt”, which is read each time this script runs. This is then interfaced to a remote control button using Keyspan or Sailing Clicker.

on run
tell application "EyeTV"
activate
end tell
set intTxt to the path to the applications folder as text
set intTxt to (intTxt & "GenieCommands:KeyspanMRScripts:int")
set rotateRes to (read file intTxt)
RunRotation(rotateRes, intTxt)
end run
on RunRotation(rotateRes, intTxt)
tell application "System Events"
if UI elements enabled then
tell process "EyeTV"
set frontmost to true
end tell
if rotateRes is "4" then
key down {option, command}
keystroke "4"
key up {option, command}
set rotateRes to "1" as text
write rotateRes to file intTxt
end if
if rotateRes is "3" then
key down {option, command}
keystroke "3"
key up {option, command}
set rotateRes to "4" as text
write rotateRes to file intTxt
end if
if rotateRes is "2" then
key down {option, command}
keystroke "2"
key up {option, command}
set rotateRes to "3" as text
write rotateRes to file intTxt
end if
if rotateRes is "1" then
key down {option, command}
keystroke "1"
key up {option, command}
set rotateRes to "2" as text
write rotateRes to file intTxt
end if
else
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.universalaccess"
display dialog "UI element scripting is not enabled. Check \"Enable access for assistive devices\""
end tell
end if
end tell
end RunRotation

Martyn Ford
www.geniecommands.com