• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
TRIGGERcmd
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

Play spotify song with cmd in a particular minute. (Code and Help to Fix)

Windows
5
11
5.5k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S
    Santiago
    last edited by May 22, 2021, 8:36 AM

    Hi everybody.
    Searching the internet, I have achieved that through cmd I can run spotify and then play a specific song in a specific minute.

    The VB Script code is:

    Set WshShell = WScript.CreateObject("WScript.Shell")
    Comandline = "C:...\Spotify.exe"
    WScript.sleep 50
    CreateObject("WScript.Shell").Run("spotify:track:09mEdoA6zrmBPgTEN5qXmN#0:52")
    WScript.sleep 50

    This (#0:52) is what specified when in the song to start playing it. But now that the spotify interface has been updated it doesn't work anymore.
    Still open spotify and plays the selected song, but not in the minute that I specify.

    Does anyone know how I can fix it?

    (PS: I hope the code helps someone to be able to play songs from spotify)

    R 1 Reply Last reply May 22, 2021, 2:24 PM Reply Quote 0
    • R
      Russ @Santiago
      last edited by May 22, 2021, 2:24 PM

      @Santiago, I researched and found the same thing - they apparently stopped supporting that #0:52 parameter to jump to a specific part of the song. That's a bummer.

      In my testing I found another way to play a specific song. You can just run start spotify:track:1aICPClDGoZGvxAv8g5lmS but if Spotify is already open, it doesn't work, so I made this .bat file that closes Spotify then re-opens it by playing a specific song.

      taskkill /im spotify.exe
      start spotify:track:1aICPClDGoZGvxAv8g5lmS
      

      Russell VanderMey

      S J J 3 Replies Last reply Jun 8, 2021, 2:53 AM Reply Quote 1
      • S
        Santiago
        last edited by Jun 8, 2021, 2:48 AM

        This post is deleted!
        1 Reply Last reply Reply Quote 0
        • S
          Santiago @Russ
          last edited by Jun 8, 2021, 2:53 AM

          @Russ Thanks for your reply!! Yes, its really a bummer. I dont know why they change that. Im going to test your .bat, thanks you again.

          1 Reply Last reply Reply Quote 0
          • J
            José Parra @Russ
            last edited by Feb 15, 2022, 1:54 AM

            @russ Excuse me, is it possible to make it play a playlist automatically?

            Edit your bat like this:
            "taskkill /im spotify.exe
            start spotify:playlist:39aWYh4Pq3xjPwOUChkO4a?si=f262d16984cd44b8"
            (replace music by playlist)

            1 Reply Last reply Reply Quote 0
            • U
              UchechiThomas
              last edited by Feb 20, 2023, 6:44 PM

              I can't automate music playback either. Have you found the problem yet?

              R 1 Reply Last reply Feb 20, 2023, 11:20 PM Reply Quote 0
              • R
                Russ @UchechiThomas
                last edited by Russ Feb 20, 2023, 11:21 PM Feb 20, 2023, 11:20 PM

                @UchechiThomas, I found this post where people have solved it:

                https://community.spotify.com/t5/Desktop-Windows/Is-there-a-command-to-play-a-playlist-using-command-line/td-p/952251

                I found that this command switches to the playlist by ID:

                start spotify:user:anything:playlist:22nGVo4QFZcfTAXcsl67kD
                

                The trick is to get it to start playing. This batch file worked for me:

                taskkill /im spotify.exe
                start spotify:user:anything:playlist:22nGVo4QFZcfTAXcsl67kD
                ping localhost
                nircmd sendkeypress spc
                

                The ping localhost command just makes it wait long enough to start Spotify. The nircmd command presses the space bar to start playing the playlist.

                Russell VanderMey

                1 Reply Last reply Reply Quote 1
                • U
                  UchechiThomas
                  last edited by UchechiThomas Feb 21, 2023, 7:24 AM Feb 21, 2023, 7:02 AM

                  Thanks for the advice. I'll try to check it out today with the spotify promotion.

                  1 Reply Last reply Reply Quote 0
                  • J
                    John Paul @Russ
                    last edited by Feb 28, 2023, 9:37 PM

                    @Russ Thank you Russ. I am currently looking to create a hotkey to open a specific track in Spotify and this is exactly what I needed.

                    1 Reply Last reply Reply Quote 0
                    • J
                      John Paul
                      last edited by Feb 28, 2023, 9:55 PM

                      I am currently trying to play a podcast episode in this manner. I am able to pull up the episode in question with this code, however, it does not play automatically which I would definitely like it to do:

                      start spotify:episode:0yAefXW3oX7WbliU0DU8QB
                      
                      R 1 Reply Last reply Feb 28, 2023, 10:06 PM Reply Quote 0
                      • R
                        Russ @John Paul
                        last edited by Russ Feb 28, 2023, 10:06 PM Feb 28, 2023, 10:06 PM

                        @John-Paul, please try this in a .bat script:

                        taskkill /im spotify.exe
                        start spotify:episode:0yAefXW3oX7WbliU0DU8QB
                        ping localhost
                        nircmd sendkeypress spc
                        

                        Russell VanderMey

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post