Any Spotify tweaks with keyboard shortcut to 'star' tracks?

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.


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.


Starred is no longer a thing.

Go here for the updated Q&A.


Old answer below here...

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
}