Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm a premium subscriber of Spotify and an obsessive productivity geek.

One thing that really annoys me is that there isn't a keyboard shortcut to 'star' a track (I.e add a track to favourites). I like to leave Spotify radio on while I'm working and every now and again I have to tab over and right click on the track then select 'Star' whenever I hear a song I really like.

Are there any Spotify tweaks/plugins out there that will allow me to 'star' tracks with a keyboard shortcut?

share|improve this question
    
Are ou using Windows Media player? –  Diogo Aug 17 '11 at 17:26
    
Nope, just Spotify –  Eddy Aug 19 '11 at 11:46
add comment

5 Answers

Sure, use AutoHotkey!

Once you've got it installed, put this in your AutoHotkey.ahk file:

#*::
WinWait, Spotify, 
IfWinNotActive, Spotify, , WinActivate, Spotify, 
WinWaitActive, Spotify, 
MouseClick, left,  79,  90
Sleep, 100
MouseClick, left,  256,  152
Sleep, 100
return

This adds a Win+Asterisk hotkey that'll star the track that's playing.

You may also be interested in other Spotify shortcuts for AutoHotkey.

share|improve this answer
1  
problem is that spotify also has same location when clicking to UNSTAR a track. so got to becareful incase you unstar a starred track using ahk method –  ms. mann Aug 10 '12 at 1:51
add comment

I tried the other Autohotkey shortcut and it didn't work for me (just switched to spotify and clicked in two dead spots). I devised the following, which works so long as you have "Large Now Playing Artwork" selected:

CoordMode, Mouse, Relative
;star currently playing
+^l::
SpotifyWinHeight = 1050 ;set to 1080 - 30 for small taskbar size, just in case WinGetPos doesn't work for some reason
WinGetActiveTitle, CurWindow
WinActivate Spotify
WinWaitActive Spotify
WinGetPos,  ,  ,  , SpotifyWinHeight, Spotify
;          X  Y  W  H, we don't care about anything but height
RightClickTarget := SpotifyWinHeight - 250
ContextMenuTarget := RightClickTarget + 110
MouseMove, 100, %RightClickTarget%
Click Right
Sleep, 50
MouseMove, 180, %ContextMenuTarget%
Sleep, 50
Click
WinActivate %CurWindow%
return

It does the following:

  • Stores currently active window
  • Activates Spotify
  • Calculates the offsets for clicking on the album artwork relative to spotify window
  • Stars what's currently playing (via right-click artwork, left click Star)
  • Restores whatever window was active before all of this

It's not perfect (will probably not be happy if for some reason you have spotify hanging mostly off your screen to the right), but gets the job done in most cases.

share|improve this answer
    
This is great! Thanks. An improvement would be to read the last context menu item to see if it reads Unstar, and if so don't click it. If I get to it I'll come back and post. –  GollyJer Dec 20 '12 at 20:22
add comment

Here's another AutoHotkey solution. There are liberal comments. Also, the AutoHotkey documentation and forums are great places to learn if desired.

Pressing Control+Shift+* will star the active song.
A key feature of this script is that it checks to see if the song is already starred and leaves it alone if so.

^+*::
spotify = ahk_class SpotifyMainWindow
IfWinExist, %spotify%
{
;Store active window and mouse position.
WinGetActiveTitle, activeWindow
MouseGetPos x, y, winID

;Activate Spotify.
WinActivate %spotify%
WinWaitActive %spotify%

;Right click near the song title in the "Now Playing" box.
WinGetPos,  ,  ,  , spotifyHeight, %spotify%
MouseClick, Right, 100, spotifyHeight - 70, 1, 0

;Get the contents of the context menu.
WinWait, ahk_class #32768
SendMessage, 0x1E1      ; MN_GETHMENU
allContextMenuInfo := ErrorLevel

;The "Star" command is the 5th menu item.
;If the song is Unstarred the text is Star, and vice versa. But sometimes some wierd characters are included.
;The only reliable way I found is to check if the first letter is S.
menuText_StarUnstar := GetContextMenuItemText(allContextMenuInfo, 5)
StringGetPos, positionOfS, menuText_StarUnstar, S

;If S is the first letter, star the song.
notStarred := (%positionOfS% = 0)
If notStarred {
    ;Arrow down to the Star menu item and press enter.
    Send {Down}{Down}{Down}{Down}{Down}{Enter}
} Else {
    ;Just close the context menu.
    Send {Escape}
}

;Restore original window and mouse position.
WinActivate ahk_id %winID%
MouseMove %x%, %y%
}

Return

;Conext menu helper function.
GetContextMenuItemText(hMenu, nPos)
{
length := DllCall("GetMenuString"
        , "UInt", hMenu
        , "UInt", nPos
        , "UInt", 0 ; NULL
        , "Int", 0  ; Get length
        , "UInt", 0x0400)   ; MF_BYPOSITION
    VarSetCapacity(lpString, length + 1)
    length := DllCall("GetMenuString"
        , "UInt", hMenu
        , "UInt", nPos
        , "Str", lpString
        , "Int", length + 1
        , "UInt", 0x0400)
return lpString
}
share|improve this answer
add comment

I don't have the rep to put this in a comment to GollyJer's answer, but I noticed when trying to use that script that there was an issue with the {down} keystrokes that would somehow make it move the highlighted song in the playlist down, instead of moving down on the menu. I modified it to do a mouse click at the "Star" menu entry instead of using the keys, it seems to work quite well. I also edited it to minimize Spotify before it flips back to the window you were using if it was minimized to begin with.

^+*::
spotify = ahk_class SpotifyMainWindow
IfWinExist, %spotify%
{
WinGet, MMX, MinMax, %spotify%
;Store active window and mouse position.
WinGetActiveTitle, activeWindow
MouseGetPos x, y, winID

;Activate Spotify.
WinActivate %spotify%
WinWaitActive %spotify%

;Right click near the song title in the "Now Playing" box.
WinGetPos,  ,  ,  , spotifyHeight, %spotify%
MouseClick, Right, 100, spotifyHeight - 70, 1, 0

;Get the contents of the context menu.
WinWait, ahk_class #32768
SendMessage, 0x1E1      ; MN_GETHMENU
allContextMenuInfo := ErrorLevel

;The "Star" command is the 5th menu item.
;If the song is Unstarred the text is Star, and vice versa. But sometimes some wierd characters are included.
;The only reliable way I found is to check if the first letter is S.
menuText_StarUnstar := GetContextMenuItemText(allContextMenuInfo, 5)
StringGetPos, positionOfS, menuText_StarUnstar, S

;If S is the first letter, star the song.
notStarred := (%positionOfS% = 0)
If notStarred {
    ;Arrow down to the Star menu item and press enter.
    MouseClick, Left, 20, -120, 1, 0,, R
} Else {
    ;Just close the context menu.
    Send {Escape}
}

;Restore original window and mouse position.
IfEqual MMX, -1, WinMinimize, %spotify%
WinActivate ahk_id %winID%
MouseMove %x%, %y%
}

Return

;Context menu helper function.
GetContextMenuItemText(hMenu, nPos)
{
length := DllCall("GetMenuString"
        , "UInt", hMenu
        , "UInt", nPos
        , "UInt", 0 ; NULL
        , "Int", 0  ; Get length
        , "UInt", 0x0400)   ; MF_BYPOSITION
    VarSetCapacity(lpString, length + 1)
    length := DllCall("GetMenuString"
        , "UInt", hMenu
        , "UInt", nPos
        , "Str", lpString
        , "Int", length + 1
        , "UInt", 0x0400)
return lpString
}
share|improve this answer
add comment

You could also try my Spotify App, Twinkle, which is a platform and GUI layout independent solution for staring Spotify songs with a single click.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.