Lifehack:  Mac + TV = Wake up to Spotify & your newsfeed

Using Automator, Calendar and AppleScript, I’ve set up my Mac and TV to launch Spotify, TweetDeck and Feedly to kick start my mornings.

Preparation

Hardware

First you need to ensure you have the right equipment:

  • TV — ensure your TV has scheduling options (most should these days).
    I have a basic Samsung: Settings → Setup → Time → Set the Clock correctly; I have my Off Time to repeat “Mon-Fri” at 9:40am; and On Time to “Every Day” at 6:15am.
  • Mac — you’ll need to disable your login screen. I recommend using a spare computer that doesn’t contain sensitive data and lies around your home.
  • Connections — your Mac will need to have the Power Adapter connected for the scheduling to work. Also ensure your Mac and TV is connected via HDMI, VGA, etc.

Spotify & News Apps

I’m a Spotify user and use Feedly and TweetDeck as my newsfeed. I’ve downloaded the Mac App versions through the Map App Store. You can get them here:

Or use your own favourites.

How-to Tutorial

These steps are based on OSX El Capitan.

There are two parts to the “wake up” workflow — WakeUp and WakeUpEnd. WakeUp will exit all unnecessary applications, then launch the applications (at a time I should be waking up). WakeUpEnd will exit all applications (at a time I should be well out of the door).

Scheduling your Mac to Wake Up and Sleep

System Preferences → Energy Saver→ Schedule

Writing your Automator Script

Open up Automator: Applications → Automator → New Document

Make sure you choose “Calendar Alarm”. These are special kinds of Automator Workflows specifically integrated to Calendar.


Drag over “Quit All Applications” under Library → Utilities.
Feel free to adjust the “Do not quit” settings.


Now drag over “Run AppleScript”. Replace the sample code with:

delay 5
tell application "Spotify"
activate
tell
application "System Events"
keystroke "f" using {shift down, command down}
delay 5
keystroke space
end tell
end
tell
delay 3
tell application "feedly"
activate
tell
application "System Events"
keystroke "f" using {control down, command down}
end tell
end
tell
delay 3
tell application "TweetDeck"
activate
tell
application "System Events"
keystroke "f" using {control down, command down}
end tell
end
tell

Make your necessary edits to the application names. I’ve added delays (in seconds) between tasks to give the machine ample time to process.


Press Cmd⌘ + S to save the Automator Workflow then press the big ▶ Run button on the top right. The file will be saved under a special directory:

/Users/neilnand/Library/Workflows/Applications/Calendar

This will launch your Calendar and create a new “Automator” Calendar type under “On My Mac”. You can go ahead and edit the settings to repeat daily and activate at 6:30am (or a time that suits you).


You can now go ahead and create your WakeUpEnd workflow with simply the Quit All Applications function and then add it to the Calendar with the same process. I have the time set for this at 9:20am.

There you have it!

Go ahead and test it out for tomorrow.