# macOS Spotify client (link to current track)

**URL:** https://discourse.hookproductivity.com/t/macos-spotify-client-link-to-current-track/559
**Category:** Share Hookmark automation
**Created:** [July 15, 2019, 8:18pm UTC](https://discourse.hookproductivity.com/t/macos-spotify-client-link-to-current-track/559 "2019-07-15T20:18:31Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![RobTrew](https://discourse.hookproductivity.com/user_avatar/discourse.hookproductivity.com/robtrew/32/212_2.png) [@RobTrew](https://discourse.hookproductivity.com/u/RobTrew)
#### Post date: [July 15, 2019, 8:18pm UTC](https://discourse.hookproductivity.com/t/macos-spotify-client-link-to-current-track/559/1 "2019-07-15T20:18:31Z")

</div>

Linking opening background music to particular documents 🙂

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`

```auto
tell application "Spotify" to name of current track

```

`Get Address`

```auto
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)

 ![44](https://discourse.hookproductivity.com/uploads/default/original/1X/075f96f8d0128fc0cb0c428224c1f000cef3f3c9.png)

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

```

---

<div class="post-metadata">

### Author: ![LucB](https://discourse.hookproductivity.com/user_avatar/discourse.hookproductivity.com/lucb/32/2228_2.png) [@LucB](https://discourse.hookproductivity.com/u/LucB)
#### Post date: [August 30, 2019, 9:45pm UTC](https://discourse.hookproductivity.com/t/macos-spotify-client-link-to-current-track/559/2 "2019-08-30T21:45:00Z")

</div>

Thanks again, @RobTrew

Support added in [integration scripts v. 73](https://discourse.hookproductivity.com/t/hook-integration-scripts-v-73-support-for-spotify/723).
