Type in your question below and we'll check to see what answers we can find...
Loading article...
Submitting...
If you couldn't find any answers in the previous step then we need to post your question in the community and wait for someone to respond. You'll be notified when that happens.
Simply add some detail to your question and refine the title if needed, choose the relevant category, then post.
Before we can post your question we need you to quickly make an account (or sign in if you already have one).
Don't worry - it's quick and painless! Just click below, and once you're logged in we'll bring you right back here and post your question. We'll remember what you've already typed in so you won't have to do it again.
Please see below the most popular frequently asked questions.
Loading article...
Loading faqs...
Please see below the current ongoing issues which are under investigation.
Loading issue...
Loading ongoing issues...
Hi,
I want to fall asleep and wake up to music on Spotify. I'm making a batch file to do this but I still need a command to play a playlist on Spotify. If you know how to do this can you please help. Thanks.
This is what I have so far -
@echo off
ping 1.1.1.1 -n 1 -w 10000 >nul
c:\windows\system32\taskkill.exe /f /im spotify.exe
ping 1.1.1.1 -n 1 -w 20000 >nul
C:\Users\User\AppData\Roaming\Spotify\spotify.exe
The easiest way is to have a vbs file that does this
I have one that plays music atomatically(paste this into notepad):
Set WshShell = WScript.CreateObject("WScript.Shell")
Comandline = "C:\Users\Max\AppData\Roaming\Spotify\Spotify.exe"
WScript.sleep 500
CreateObject("WScript.Shell").Run("spotify:user:8aller:playlist:4aoBDuMJnk4Oza13a8Fnbo")
WScript.sleep 3000
WshShell.SendKeys " "
Change the path to your spotify app location on your pc.
change the my url to the "Spotify Url" of your playlist.
click file>save as then save as something.vbs and save as all files
click on the vbs script - it should open and play your playlist
if you go to bed at the same time every day you can use task scheduler for it to autoplay at the same time every day
it is also possible to have the music fade(for sleeping) via vbs and get gradually louder as well(think an alarm).
Hey mate, thank you for writting this because that just worked nearly perfectly.
The script opened spotify, and directed it to that playlist, but it didn't start. I was wondering if you could help me out with that part.
Thanks in advance,
Jay
p.s. I know nothing about scripts, or code.
I had the same problem as you. But after playing around a bit, I realised it was just that the final 'spacebar' command is executed before my slow system could open spotify and navigate to the playlist. Just changing that 3 second delay to 8 second delay fixed it.
Change "Wscript.sleep 3000" to "Wscript.sleep <something long enough for your computer>"
This doesn't work for me. Always starts with the last played track. Have played around with the pauses but still doesn't work.
Try replacing the last line that executes 'space' to this, which executes ENTER
WshShell.SendKeys "{ENTER}"
This might help you. If not, try using a track's spotify URL in the place of a playlist's url and try with ENTER. Just play around - eventually will play a song you want 😉
A bit late, but if you add:
WScript.sleep 100 WshShell.SendKeys "^{RIGHT}"
to the end, with shuffle play configured, a random track will be selected for playback.
For context, the entire script:
Set WshShell = WScript.CreateObject("WScript.Shell") Comandline = ":\Users\Rando\AppData\Roaming\Spotify\Spotify.exe" WScript.sleep 500 CreateObject("WScript.Shell").Run("spotify:user:saurabhmenon:playlist:4SKzklVn82CszokiizmJHc") WScript.sleep 10000 WshShell.SendKeys " " WScript.sleep 100 WshShell.SendKeys "^{RIGHT}"
This still seems to play whatever traick I had open previously, it doesn't play the album or playlist it opens to.
Set WshShell = WScript.CreateObject("WScript.Shell") Comandline = ":\Users\Rando\AppData\Roaming\Spotify\Spotify.exe" WScript.sleep 500 CreateObject("WScript.Shell").Run("spotify:user:saurabhmenon:playlist:4SKzklVn82CszokiizmJHc") WScript.sleep 10000 WshShell.SendKeys "{ENTER}"
Here, try this.
But only work wen spotify is in first. How do it with spotify minimized.
Thanks
I tried the following code to start a playlist:
Set WshShell = WScript.CreateObject("WScript.Shell") Comandline = "C:\Users\lenovo\AppData\Roaming\Spotify\Spotify.exe" WScript.sleep 500 CreateObject("WScript.Shell").Run("spotify:user:21fa7f2euodm5se7wfmjmysfa:playlist:37dwq4kMEpQVqdXBfbaPid") WScript.sleep 1000 WshShell.SendKeys " "
It managed to open spotify snd start playing, but not from the specified playlist.
My playlist URL is:
https://open.spotify.com/user/21fa7f2euodm5se7wfmjmysfa/playlist/37dwq4kMEpQVqdXBfbaPid
Can you tell me where I am going wrong?
Thank you in advance
I used the solutions here to Launch a playlist with Smartthings. Here is a viideo of it . Any of you know the command line to "Connect a device? I would love to be able to switch to another device automaticaly. Thanks for the info https://www.youtube.com/watch?v=5LNVrFHCKkA&t=266s
Hi Nate, your video and explanation are excellent. I'm using your solution to play a song at a specific time each day. Did you ever find out how to make it play on a specific device? I can make Spotify beam music to my Soundbar by selecting it manually but would like to make this part of the automatic playback script.
So I realized that if you press tab 4 times, then press enter, then your desired playlist will play, so here is the same, but modified code that worked:
Set WshShell = WScript.CreateObject("WScript.Shell") Comandline = "C:\Users\Max\AppData\Roaming\Spotify\Spotify.exe" WScript.sleep 500 CreateObject("WScript.Shell").Run("spotify:user:spotify:playlist:37i9dQZEVXcX5xSSJR3tfB") WScript.sleep 8000 WshShell.SendKeys "{tab}" WScript.sleep 100 WshShell.SendKeys "{tab}" WScript.sleep 100 WshShell.SendKeys "{tab}" WScript.sleep 100 WshShell.SendKeys "{tab}" WScript.sleep 100 WshShell.SendKeys "{enter}"
This .vbs file is awesome! TAB 4 TIMES WORKED!!!!!! 🙂 🙂 🙂 It starts spotify, my playlist, switches to the main device, and skips to the second song.... (I may add the random song option code again)
Set WshShell = WScript.CreateObject("WScript.Shell")
Comandline = ":\Users\Marilinda\AppData\Roaming\Spotify\Spotify.exe"
CreateObject("WScript.Shell").Run("spotify:")
WScript.sleep 5000
WshShell.SendKeys "^{d}"
WScript.sleep 1000
WshShell.SendKeys "{TAB 2}", True
WScript.sleep 1000
WshShell.SendKeys " "
WScript.sleep 1000
CreateObject("WScript.Shell").Run("spotify:user:1269640531:playlist:1XnmxabGVccgBOCpgRxTnL")
WScript.sleep 3000
WshShell.SendKeys "{tab}"
WScript.sleep 100
WshShell.SendKeys "{tab}"
WScript.sleep 100
WshShell.SendKeys "{tab}"
WScript.sleep 100
WshShell.SendKeys "{tab}"
WScript.sleep 100
WshShell.SendKeys "{ENTER}"
WScript.sleep 2000
WshShell.SendKeys "^{RIGHT}"
yes my default is my windos 10 pc because I have it hooked as the main sound source for my monoprice 6 zone amp. I have a modified my code (5 seperate commands "Alexa turn on Device 3" to toggle through all 5 devices... sometimes they change order but my computer always stays in position 1.
Hey there you, Yeah, you! 😁 Welcome - we're glad you joined the Spotify Community! While you here, let's have a fun game and get…