Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tell application "System Events"
- set myList to (name of every process)
- end tell
- if myList contains "iTunes" then
- tell application "iTunes"
- try
- set trackname to name of current track
- set artistname to artist of current track
- set albumname to album of current track
- set timetofinish to player position
- set hourstofinish to timetofinish div 3600
- set secondstofinish to timetofinish mod 3600
- set minutostofinish to secondstofinish div 60
- set secondstofinish to secondstofinish mod 60
- if hourstofinish < 10 then set hourstofinish to "0" & hourstofinish
- if minutostofinish < 10 then set minutostofinish to "0" & minutostofinish
- if secondstofinish < 10 then set secondstofinish to "0" & secondstofinish
- if hourstofinish = "00" then
- set timetofinish to (minutostofinish as text) & ":" & secondstofinish
- else
- set timetofinish to (hourstofinish as text) & ":" & minutostofinish & ":" & secondstofinish
- end if
- if player state is paused then
- set output to "" & trackname & " | " & artistname & " | " & albumname & " | " & "paused at " & timetofinish & ""
- else
- set output to "" & trackname & " | " & artistname & " | " & albumname & " | " & timetofinish & ""
- end if
- on error
- set timetofinish to "No song playing"
- end try
- end tell
- else
- set output to "..."
- end if
Add Comment
Please, Sign In to add comment