on run arg tell application "System Events" if (application processes whose name is "iTunes") is not {} then tell application "iTunes" if item 1 of arg is equal to "l" then set lib to library playlist 1 set libName to name of library playlist 1 if lib is not "" then set mysize to my printSize(size of lib) set runtime to my printTime(time of lib) return "[iTunes] Version: " & (version as string) & ¬ " Songs: " & (count tracks in lib) & ¬ " Size: " & mysize & ¬ " Duration: " & time of lib end if end if if item 1 of arg is equal to "s" then set art to artist of current track set tit to name of current track set alb to album of current track set btr to bit rate of current track set len to time of current track if (player state) is not playing then if (player state) is paused then set state to " [" & (ASCII character 31) & "paused" & (ASCII character 31) & "]" else set state to " [" & (ASCII character 31) & "stopped" & (ASCII character 31) & "]" end if else set state to "" end if return "[iTunes] " & art & " - " & tit & state & " (" & alb & "/" & btr & "kbps/" & len & "m)" end if end tell end if end tell end run to printSize(theSize) if theSize < 1.0E+9 then return (round (theSize) / (2 ^ 20) * 100 ¬ as string) / 100 & "MB" else return ((round (theSize) / (2 ^ 30) * 100) ¬ / 100 as string) & "GB" end if end printSize to printTime(theTime) set AppleScript's text item delimiters to ":" set timeList to theTime's words set AppleScript's text item delimiters to {""} return item 1 of timeList & "days " & ¬ item 2 of timeList & "hrs " & item 3 of timeList & ¬ "min " & item 4 of timeList & "sec" end printTime