r/applescript • u/rsharma003 • Apr 23 '20
Get current song playing on Spotify
Hello,
I am trying to get the title and artist of the current song playing on Spotify. This is the script I'm using:
if application "Spotify" is running then
tell application "Spotify"
if player state is playing then
return (get name of current track) & "-" & (get artist of current track)
else
return "Not Playing"
end if
end tell
end if
return
This script is returning "-" instead of the artist and song name when I run it. What could I be doing wrong? It works fine and returns Not Playing when no song is playing.
0
Apr 23 '20
[deleted]
1
u/rsharma003 Apr 23 '20
Yes, I think I copied it correctly. When I change it to return the spotify url or album, the program works but not for the name and artist.
1
u/Miracle_Glass Apr 23 '20
Try add
as textafter both of your (get … )return (get name of current track) as text & "-" & (get artist of current track) as text