Skip to content

Instantly share code, notes, and snippets.

@jacobsalmela
Created January 30, 2015 15:33
Show Gist options
  • Save jacobsalmela/ab01e15d42fb118243fd to your computer and use it in GitHub Desktop.
Save jacobsalmela/ab01e15d42fb118243fd to your computer and use it in GitHub Desktop.
April fool's Spotify script
repeat
tell application "System Events" to delay 3.0
tell application "System Events" to set currentApp to name of first process where frontmost is true
if currentApp is "Spotify" then
try
-- Create a random number to do one of three things
set randomNum to random number from 1 to 3
if randomNum is 1 then
tell application "Spotify" to pause
say "You call that music? I do not want to listen to that." using "Samantha"
else if randomNum is 2 then
say "I do not like this song." using "Samantha"
tell application "Spotify" to play (next track)
else if randomNum is 3 then
tell application "Spotify" to play
say "I love this song. Crank it up." using "Samantha"
set volume 4
else
--do nothing
end if
--delay 10 seconds before doing something different
delay 10.0
end try
end if
end repeat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment