Browse the docs

currentTrack

Returns a detail of the track playing in Music.

Keyboard Maestro: CurrentTrack

Details #

currentTrack() and currentTrack(field) take zero or one argument and return text about the current track in the Music app.

field is one of name, artist, album, composer, genre, year, time, rating, comment, grouping, category, track number, disc number or played count. Leave it out, or use any other word, for the track name.

The special field ratingstars returns a number from 0 to 5 instead of text (Music keeps ratings as 0 to 100; this divides by 20 and rounds).

Parameters #

Takes 0 to 1 argument. {{ currentTrack(text?) }}

Examples #

currentTrack("artist")
→
currentTrack("ratingstars")
→ 0

Gotchas #

  • It returns empty text when Music isn't running, and also when Music has no current track. It does not launch Music.

  • It reads Music through Automation, so Switchboard needs permission to control Music.

  • ratingstars gives 0, not empty text, when there is no rating.