Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hotkey for next song in Spotify

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?

like image 799
EquipDev Avatar asked Mar 10 '15 06:03

EquipDev


3 Answers

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.

like image 198
Manuel Ruiz de Quintanilla Avatar answered Oct 18 '22 07:10

Manuel Ruiz de Quintanilla


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
like image 30
Joseph Stephen Avatar answered Oct 18 '22 05:10

Joseph Stephen


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
}
like image 4
Wil Avatar answered Oct 18 '22 06:10

Wil