Guest User

Untitled

a guest
May 13th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. tell application "System Events"
  2.     set myList to (name of every process)
  3. end tell
  4.  
  5. if myList contains "iTunes" then
  6.     tell application "iTunes"
  7.         try
  8.             set trackname to name of current track
  9.             set artistname to artist of current track
  10.             set albumname to album of current track
  11.            
  12.             set timetofinish to player position
  13.             set hourstofinish to timetofinish div 3600
  14.             set secondstofinish to timetofinish mod 3600
  15.             set minutostofinish to secondstofinish div 60
  16.             set secondstofinish to secondstofinish mod 60
  17.            
  18.             if hourstofinish < 10 then set hourstofinish to "0" & hourstofinish
  19.             if minutostofinish < 10 then set minutostofinish to "0" & minutostofinish
  20.             if secondstofinish < 10 then set secondstofinish to "0" & secondstofinish
  21.            
  22.             if hourstofinish = "00" then
  23.                 set timetofinish to (minutostofinish as text) & ":" & secondstofinish
  24.             else
  25.                 set timetofinish to (hourstofinish as text) & ":" & minutostofinish & ":" & secondstofinish
  26.             end if
  27.            
  28.             if player state is paused then
  29.                 set output to "" & trackname & " | " & artistname & " | " & albumname & " | " & "paused at " & timetofinish & ""
  30.             else
  31.                 set output to "" & trackname & " | " & artistname & " | " & albumname & " | " & timetofinish & ""
  32.             end if
  33.            
  34.         on error
  35.             set timetofinish to "No song playing"
  36.         end try
  37.        
  38.     end tell
  39.    
  40. else
  41.     set output to "..."
  42.    
  43. end if
Add Comment
Please, Sign In to add comment