Skip to content

Instantly share code, notes, and snippets.

@kopiro
Last active July 25, 2017 09:58
Show Gist options
  • Select an option

  • Save kopiro/6347753 to your computer and use it in GitHub Desktop.

Select an option

Save kopiro/6347753 to your computer and use it in GitHub Desktop.
Alarm applescript for Spotify
set volume 5
set today to (date string of (current date))
set weather to do shell script "~/bin/weather"
set weatherc to do shell script "~/bin/weatherc"
set inboxcount to do shell script "~/bin/inbox-count"
set spotidelay to 1
tell application "Spotify"
set the sound volume to 0
set shuffling to true
set repeating to true
play
repeat while sound volume is less than 50
set sound volume to (sound volume + 2)
delay spotidelay
end repeat
end tell
say "Buongiorno, Flavio"
delay 1
say "oggi è " & today
delay 1
say "il tempo previsto per oggi indica " & weather
say "con una temperatura media di " & weatherc & "gradi celsius"
delay 1
say "Hai " & inboxcount & " email non lette nella tua casella postale"
tell application "Spotify"
repeat while sound volume is less than 90
set sound volume to (sound volume + 2)
delay spotidelay
end repeat
pause
end tell
tell application "SpeechRecognitionServer"
set resp to "no"
try
set resp to listen for {"si", "no"} with prompt "Vuoi che spenga la sveglia?" giving up after 10
end try
if resp is "yes" then
say "Va bene, spengo la sveglia, ma sbrìgati perchè devi andare a lavorare"
pause
else
tell application "Spotify"
play
repeat while sound volume is less than 100
set sound volume to ((sound volume) + 2)
delay spotidelay
end repeat
end tell
end if
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment