Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- on ApplicationIsRunning(appName)
- tell application "System Events" to set appNameIsRunning to exists (processes where name is appName)
- return appNameIsRunning
- end ApplicationIsRunning
- if ApplicationIsRunning("Spotify") then
- tell application "Spotify"
- set currentArtist to artist of current track as string
- set currentTrack to name of current track as string
- set totalLength to duration of current track as integer
- set totalLengthInSeconds to totalLength / 1000 as integer
- set playerPosition to player position as integer
- set timeLeft to totalLengthInSeconds - playerPosition
- set minutes to timeLeft div 60 as integer
- set secondsString to timeLeft mod 60 as string
- if the length of secondsString is 1 then
- set secondsString to "0" & secondsString as string
- end if
- set timeLeftMMSS to minutes & ":" & secondsString
- return currentArtist & " - " & currentTrack & " - " & timeLeftMMSS
- end tell
- else
- return "Spotify"
- end if
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement