I have this vbscript that I copied from an online source. It starts the Spotify application on my desktop and begins playing the specified playlist. I can double-click the vbs file from Windows Explorer and it works just fine. I created a scheduled task to run the script. When I attempt to run the scheduled task a Windows dialog appears asking How do you want to open this file?
Here's the vbscript code with my comments added:
Set WshShell = WScript.CreateObject("WScript.Shell")
'This is the path to the Windows Spotify application. (I realize that they've misspelled CommandLine, but it works spelled this way for some reason)
Comandline = "C:\Users\Tod\AppData\Local\Microsoft\WindowsApps\Spotify.exe"
WScript.sleep 500
'The argument to the Run method is the playlist within the Spotify application to run
CreateObject("WScript.Shell").Run("spotify:user:todtownlaylist:4zFrHtT8bSgXIltkkiScMk")
WScript.sleep 3000
WshShell.SendKeys " "
My scheduled task simply says:
"C:\Users\Tod\Load Spotify.vbs"
With no arguments
Can anyone suggest changes to either the script or the scheduled task, or other suggestions that I can try?
tod
Here's the vbscript code with my comments added:
Set WshShell = WScript.CreateObject("WScript.Shell")
'This is the path to the Windows Spotify application. (I realize that they've misspelled CommandLine, but it works spelled this way for some reason)
Comandline = "C:\Users\Tod\AppData\Local\Microsoft\WindowsApps\Spotify.exe"
WScript.sleep 500
'The argument to the Run method is the playlist within the Spotify application to run
CreateObject("WScript.Shell").Run("spotify:user:todtownlaylist:4zFrHtT8bSgXIltkkiScMk")
WScript.sleep 3000
WshShell.SendKeys " "
My scheduled task simply says:
"C:\Users\Tod\Load Spotify.vbs"
With no arguments
Can anyone suggest changes to either the script or the scheduled task, or other suggestions that I can try?
tod