Last active
September 2, 2016 13:44
-
-
Save marciogranzotto/5aab27d148e61d8b256d3cead08908b8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 application "Spotify" is running 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 | |
tell application "Finder" to say "You call that music? I do not want to listen to that." | |
else if randomNum is 2 then | |
tell application "Finder" to say "I do not like this song." | |
tell application "Spotify" to play (next track) | |
else if randomNum is 3 then | |
tell application "Spotify" to play | |
tell application "Finder" to say "I love this song. Crank it up." | |
set volume 5 | |
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