Display current iTunes track information

Sharing and discussing custom actions for LaunchBar
capcrime
Posts: 9
Joined: Wed Oct 14, 2009 12:59 am

Display current iTunes track information

Postby capcrime » Tue Oct 16, 2018 7:51 pm

Made this handy action that briefly displays a notification with current track name and album/artist in the subtitle of the notification.

I tried to upload the action, but I am told it is too large. Huh. Well then, here is the AppleScript which you tell LB to execute:

Code: Select all

tell application "System Events"
   set iTunesisRunning to ((count of (every process whose name is "iTunes")) > 0)
end tell

set isTrackPlaying to false
if iTunesisRunning then
   tell application "iTunes"
      if current track exists then set isTrackPlaying to true
   end tell
end if

if isTrackPlaying then
   tell application "iTunes"
      set CurrentTrack to name of current track
      set CurrentAlbum to album of current track
      set CurrentArtist to artist of current track
      
      if (count of artwork of current track) > 0 then
         set Art to (data of artwork 1) of current track
      else
         set Art to "DEFAULT"
      end if
      
   end tell
   
   ¬
      display notification with title ¬
         CurrentTrack subtitle CurrentAlbum & " – " & CurrentArtist
   
else
   display notification "iTunes isn't playing a song." with title "Failed!"
end if

Return to “LaunchBar Actions”

Who is online

Users browsing this forum: No registered users and 1 guest