After March 2015 upgrade of Spotify the below hotkey no longer works to get next song in Spotify:
; Spotify next track
<^>!p::
DetectHiddenWindows, On
ControlSend, ahk_parent, ^{Right}, ahk_class SpotifyMainWindow
DetectHiddenWindows, Off
Return
The SpotifyMainWindow" appears to be the same when checking with spy, and Ctrl-Right also still works for next song in Spotify, but the hotkey don't.
How to make a hotkey for next song in the upgraded Spotify?
I managed to make it work using multimedia keycodes. Here's my script:
; "CTRL + LEFT" for previous
^Left::Media_Prev
; "CTRL + RIGHT" for next
^Right::Media_Next
; "CTRL + SPACE" for pause
^Space::Media_Play_Pause
It's working like a charm now.
For Windows 8 Users, I modified the previous script to one that will work for your OS! Will change to Previous song, Pause/Play, Next song
; "CTRL + LEFT" for previous
^Left::Send {Media_Prev}
; "CTRL + RIGHT" for next
^Right::Send {Media_Next}
; "CTRL + SPACE" for pause
^Space::Media_Play_Pause
A work around in the mean time is to bring the Spotify window to the front, send it a space and then minimise it again.
You may want to stop it minimising according to your own preference
Re-edit - got it working for skipping tracks as well, it's a bit hacky and may not work if you have UAC enabled (according to the docs) , YMMV. Works for me though
ScrollLock::
{
DetectHiddenWindows, On
WinActivate, ahk_class SpotifyMainWindow
SendInput, , ^{Right}, ahk_class SpotifyMainWindow
Sleep, 100
ControlSend, , {Space}, ahk_class SpotifyMainWindow
DetectHiddenWindows, Off
WinMinimize, ahk_class SpotifyMainWindow
return
}
PrintScreen::
{
DetectHiddenWindows, On
WinActivate, ahk_class SpotifyMainWindow
SendInput, , ^{Left}, ahk_class SpotifyMainWindow
Sleep, 100
ControlSend, , {Space}, ahk_class SpotifyMainWindow
DetectHiddenWindows, Off
WinMinimize, ahk_class SpotifyMainWindow
return
}
Pause::
{
DetectHiddenWindows, On
WinActivate, ahk_class SpotifyMainWindow
ControlSend, , {Space}, ahk_class SpotifyMainWindow
DetectHiddenWindows, Off
WinMinimize, ahk_class SpotifyMainWindow
return
}
Just tested this with latest spotify and Windows 10
; "CTRL + ALT + UP" for volume up
$^!Up::Volume_Up
; "CTRL + ALT + DOWN" for volume down
$^!Down::Volume_Down
; "CTRL + ALT + LEFT" for previous
^!Left::Media_Prev
; "CTRL + ALT + RIGHT" for next
^!Right::Media_Next
; "CTRL + ALT + SPACE" for pause
^!Space::Media_Play_Pause
I saw this working but not for the key I wanted
^Space::Media_Play_Pause
and decided to see if this would work
Numpad4::^Media_Prev
Numpad5::^Media_Next
Numpad6::^Media_Play_Pause
and it does! yay. I guess it works for whatever keys you want and not just the space key.