Wake up in the morning, brew your coffee and bring it over to the TV. Open the DO button app on your iPhone, tap a button and have your computer automatically connect to Apple TV and start up your favourite news stream. Here's how it works:

On your phone's DO-button app, make a new action to create a file in a specified Dropbox folder with the content "Al Jazeera"

On your computer, have Hazel monitor that Dropbox folder and run the applescript below when it sees a file with content "Al Jazeera" and then delete the file.

https://www.dropbox.com/s/0tt8z481f2lhcdj/Morning%20News.scpt?dl=0

It requires two terminal-based applications: sleepdisplay (to wake the display from sleep) and cliclick (to emulate a mouse click to enter full screen)

--wake display delay 5 do shell script "/usr/local/bin/SleepDisplay --wake" delay 5 tell application "System Events" to keystroke "enter your password here" delay 5 tell application "System Events" to keystroke return delay 5 --pause iTunes (to prevent blaring music) tell application "iTunes" pause end tell --mute the volume (so you don't hear the news before it's connected to the TV) set volume output volume 0 --open Al Jazeera News tell application "Safari" launch set theURL to "http://www.aljazeera.com/watch_now/" open location theURL activate end tell delay 15 --turn on Apple TV tell application "System Events" tell process "SystemUIServer" click ( menu bar item 1 of menu bar 1 whose description contains "Displays, AirPlay Off" ) click menu item "Apple TV" of menu 1 of result delay 5 end tell end tell delay 10 tell application "Safari" activate activate end tell --full screen Safari using SizeUp tell application "System Events" to keystroke "m" using { command down , control down , option down } delay 5 --up arrow key to make sure screen is lined up for next button click tell application "System Events" to keystroke ( key code 126 ) delay 5 --move the mouse and click on full-screen button do shell script "/usr/local/bin/cliclick m:1078,800" delay 0.5 do shell script "/usr/local/bin/cliclick c:1078,800" --raise the volume set volume output volume 90

Advertisements