Announcements

Help Wizard

Step 1

NEXT STEP

How to automatically resume playing playlist after logging back in

How to automatically resume playing playlist after logging back in

When I log in to my laptop (or unlock after a break), I want Spotify to automatically play - but only if it was running before I closed my laptop - and I don't like it starting halfway through a song, so I want it to always start a new track on my playlist.


I figured it out and just got it working with a VBScript and the Task Scheduler...  and I thought I'd share my solution.  🙂

 

(If you're not used to messin' with stuff like this, see Stack Overflow or ask your local neighborhood nerd.)

 

 

 

 

Open Notepad and paste in the following code:

 

 

Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
    ("Select Name from Win32_Process WHERE Name='Spotify.exe'")

If colProcessList.count>0 then
    Set WshShell = WScript.CreateObject("WScript.Shell")
    Comandline = "C:\Users\**YOUR PROFILE NAME**\AppData\Roaming\Spotify\Spotify.exe"
    WScript.sleep 500
    CreateObject("WScript.Shell").Run("spotify:user:johnsmith:playlist:0rDhbjtAgoLssBmFPaBDpN")
    WScript.sleep 2000
    WshShell.SendKeys "^{RIGHT}"
    Set WshShell = Nothing
else
    'do nothing
End if

Set objWMIService = Nothing
Set colProcessList = Nothing

 

 

 

 

  • replace **YOUR PROFILE NAME** with your windows login (or otherwise adjust the Spotify.exe path as requried)
  • replace spotify:user:johnsmith:playlist:0rDhbjtAgoLssBmFPaBDpN with your Spotify playlist URI.  (Right-click your playlist > Share > Copy Spotify URI)
  • Save with a filename extension of .VBS, somewhere with (you'll probably have to set the file type to *.* in the Save dialog for it to work)

 

 

  • Open Task Scheduler (Click `Start` and type `Task Scheduler`)
  • Click Create Task
  • On the General tab, give the task a name
  • On the Triggers tab, click NEW > Begin the task: On workstation unlock > Delay Task for 5 seconds, click OK. click NEW again > Begin the task: At Log On > Delay Task for 15 seconds, click OK.
  • On the Actions tab, click NEW > Start a program > under Program/Script, paste the path and filename where you saved the .VBS file. Click OK - OK.
TaskSchedScreenshot.png
Reply
3 Replies

Splendid! 🎉

Thank you very much for sharing it!

Do you know any way to set a time for the playlist to play daily? (Sort like an alarm). I've tried A LOT of different things on Task Scheduler, but nothing has worked so far.

Hey @laisnovaes,

 

Thanks for reaching out to us.

 

Currently there is no option to set a specific time for a playlist to play. You can have a look in our Idea Exchange to see if someone else has already made a similar suggestion.

 

If there isn't one, you can give these steps a go and submit your idea. That way other users can also support it. Rest assured that the higher the number of votes an idea gets, the more likely it is for the idea to be implemented.    

 

If you want to set your alarm clock to play a Spotify track, you can head here and check the steps.

 

Hope this was helpful for you. If you have more questions, we are here for you.


 
 

Ver Moderator
Help others find this answer and click "Accept as Solution".
If you appreciate an answer, maybe give it a Like.
Are you new to the Community? Take a moment to introduce yourself!

Suggested posts