Forums » Tips & Tricks »
Currently playing song
Added by Yann BIZEUL 413 days ago
Type : Shell
#!/usr/bin/osascript
tell application "System Events"
set powerCheck to ((application processes whose (name is equal to "iTunes")) count)
if powerCheck = 0 then
return "'Listen to the music'"
end if
end tell
tell application "iTunes"
try
set playerstate to (get player state)
end try
if playerstate = paused then
set trackPaused to "'Listen to the music'"
else
set trackPaused to "'Listen to the music'"
end if
if playerstate = stopped then
return "'Listen to the music'"
end if
set who to artist of current track as string
set what to name of current track as string
set onwhat to album of current track as string
set lenth to time of current track as string
set totalData to "\"" & what & "\" " & return & "" & who & "" & return & onwhat & return & lenth
return totalData
end tell
Courtesy of Chris Ferrara