The goal
Every morning at 6am run Doug’s excellent Block Party script to create a playlist of 4 and 5 star songs from random albums.
Start playback of the playlist at a certain time of day using Doug’s Daypart app.
NB: iTunes will play over whatever Airplay speakers you had last selected, which in my case is usually my kitchen speakers. There doesn’t seem to be any way to control the Airplay speaker selection.
The problem
At 6am my Mac will be idling with screensaver running, with a password lock. Unless I do something about it the lock will prevent Automator actions from running.
The password lock is mandatory. I once discovered my 3-year-old waking up at 4am to go and play on the computer.
The Automator action
1. Launch Application
Block Party.app
2. Pause
5 seconds
3. Run Applescript
tell application "System Events" to set require password to wake of security preferences to false
4. Run Applescript
tell application "ScreenSaverEngine" quit end tell
5. Run Applescript
tell application "Block Party" activate end tell
6. Watch Me Do
Click the ‘Proceed…’ button, playback speed x10
7. Pause
10 seconds
8. Quit Application
Block Party.app
9. Run Applescript
set the visible of process "iTunes" to false
10. Run Applescript
tell application "System Events" to set require password to wake of security preferences to true
11. Start Screen Saver
Screenshots
Extras
When you run this for the first time it won’t work. This is because your Mac’s privacy settings don’t allow your newly created script to control your Mac. You’ll need to open System Preferences / Security & Privacy /Accessibility and put checkmarks next to your newly created Automator script. If you’ve tried to run the script and it failed due to privacy settings it should appear in this list automatically. If it’s not there you can either drag it into the list, or add it using the “+” button.
If it isn’t already there you will also need to add Automator to the list of allowed apps. While setting up and testing you will probably also want to add Script Editor to the list.