-
-
Save ngopal/3344086 to your computer and use it in GitHub Desktop.
# In order to use this script, you must replace 'YOURUSERNAMEHERE' with your Spotify username. | |
# Execute this script like so: 'osascript alarm_clock_spotify.scpt' (without single-quotes obviously) | |
# Full explanation here: http://www.nikhilgopal.com/2011/08/show-and-tell-applescript-spotify-alarm.html | |
# If you would like to specify a playlist, please refer to this gist: https://gist.github.com/3344118 | |
set volume 2 | |
open location "spotify:user:YOURUSERNAMEHERE:playlist:muzic" | |
tell application "Spotify" | |
set the sound volume to 0 | |
play | |
repeat 10 times | |
if sound volume is less than 80 then | |
set sound volume to (sound volume + 10) | |
delay 3 | |
end if | |
end repeat | |
end tell |
Kudos man! Exactly what I was looking for.
line 7 did not really work for me but I solved it doing the following:
In the Spotify app, right click on the playlist you want to listen to --> Share --> Copy Spotify URI
substitute the string between quotes after open location
(line 7) with the copied Spotify URI
When I paste this snippet in terminal I get "zsh: parse error near `end'"
First, big kudos for the explanation!
I try setting it up right now, but on your website (https://nikhilgopal.com/2011/08/03/show-and-tell-applescript-a-spotify-alarm-clock-on-mac/) I cannot see the pic with the code for the VI editor. Could you post the code line here?
Open a terminal window and type EDITOR=nano crontab -e
to enter cron editor.
Then add this line of code 55 6 * * * osascript /path-to-file/alarm_clock_spotify.scpt
Click ctrl+x to exit, then click y to save. It should run automatically at this time now
The numbers 55 refer to the minute it will run, and the number 6 refers to the hour it will be run. Change these however you would like.
If you want to learn more about cron and how to set the time, there is a good guide here
The URL to the full explanation is now: http://nikhilgopal.com/applescript/utility/2011/08/03/show-and-tell-applescript-a-spotify-alarm-clock-on-mac.html