Last active
November 29, 2019 09:48
-
-
Save Pendrokar/d80840baa06699945cce30ea4ada528e to your computer and use it in GitHub Desktop.
Spotify playlist play using Vbscript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
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
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