Skip to content

Instantly share code, notes, and snippets.

@Pendrokar
Last active November 29, 2019 09:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pendrokar/d80840baa06699945cce30ea4ada528e to your computer and use it in GitHub Desktop.
Save Pendrokar/d80840baa06699945cce30ea4ada528e to your computer and use it in GitHub Desktop.
Spotify playlist play using Vbscript
Set WshShell = WScript.CreateObject("WScript.Shell")
' spotify or user_id_number if playlist is private. ID can be found by using Spotify's Share button
WshShell.Run "spotify:user:<spotify/user_id_number>:playlist:<playlist_code>", 3, false
WScript.sleep 20000
' Change active Window
WshShell.AppActivate "Spotify"
' Start playing selected queue
WshShell.SendKeys " "
' Focus?
WshShell.SendKeys "{ENTER}"
WScript.sleep 100
' Shuffle play next track
WshShell.SendKeys "^{RIGHT}"
WScript.Quit 0
@Pendrokar
Copy link
Author

Usage with Task Scheduler(e.g. morning alarm).
Action: cscript
Arguments: //I "C:\Users%username%\spotify.vbs"

//I for interactive mode so that a user window can be set to active and keys be sent

@Pendrokar
Copy link
Author

Pendrokar commented Jul 15, 2017

Late note: It doesn't work when waking up as the user has to be logged in for the shell to work, unless Windows is set not to lock on sleep.
:(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment