macOS Spotify client (link to current track)

Linking opening background music to particular documents :slight_smile:

Note that the scripts below are for the macOS Spotify app, and capture a link to the track which is current playing (rather than simply selected in the GUI).

(The links they create are, likewise, for the macOS Spotify client. They could be edited to capture instead https links for the Spotify web client.)

Get Name

tell application "Spotify" to name of current track

Get Address

tell application "Spotify"
    tell current track
        "spotify://track/" & (text 15 thru -1 of (its id as string))
    end tell
end tell

Open Item
(Also specifying spotify in the scheme field below the code in the Hook GUI)

tell application "Spotify"
    play track "spotify:track:" & ¬
        text (1 + (length of "spotify://track/")) thru -1 of "$0"
end tell
1 Like