I would like to stop Spotify from playing when I start my TV to watch a video but the problem is that {Media_Stop} doesn’t work. If the music is not playing and I use {Media_Play_Pause} command the music starts when it should stop.
Another way would be to recognise if the music is playing and send the pause command only then but I guess that would be too complicated if even possible.
I have run out of ideas how to achieve something so simple. Help would be appreciated.
How to STOP music (if playing) Topic is solved
Re: How to STOP music (if playing)
Did you ever find a solution for this? I'd like the same thing.
Re: How to STOP music (if playing) Topic is solved
In fact, I did! I found a program named Toastify which had this functionality and spoke with its developer and found a way to send media commands straight to Spotify. It requires that you assign the right Spotify window id to a variable with this code (run in auto-execute section):
Then use this command to stop the music:
Code: Select all
DetectHiddenWindows, On
If WinExist("ahk_exe Spotify.exe ahk_class Chrome_WidgetWin_0")
{
SetTitleMatchMode, RegEx
WinGet, SpotifyId, ID, .+ ahk_exe Spotify\.exe ahk_class Chrome_WidgetWin_0
SetTitleMatchMode, 1
}
DetectHiddenWindows, Off
Return
Code: Select all
DetectHiddenWindows, On
If WinExist("ahk_id " SpotifyId)
PostMessage, 0x0319,, 0x002F0000,, ahk_id %SpotifyId%
DetectHiddenWindows, Off
Return
- Masonjar13
- Posts: 1555
- Joined: 20 Jul 2014, 10:16
- Location: Не Россия
- Contact:
Re: How to STOP music (if playing)
I'd like to post this as an alternative. It uses the Spotify API, which affects your entire Spotify account. Meaning, it can pause/play/change music/volume/etc. on any device that your account is currently streaming to.
Re: How to STOP music (if playing)
Thanks, that seems really interesting! I will test it out.Masonjar13 wrote: ↑23 Apr 2019, 14:46I'd like to post this as an alternative. It uses the Spotify API, which affects your entire Spotify account. Meaning, it can pause/play/change music/volume/etc. on any device that your account is currently streaming to.
Who is online
Users browsing this forum: Frogrammer, gongnl and 285 guests