waiting for tweets...
RSS

SubtleStatus iTunes + Cog script

Thursday, March 13th, 2008 at 20:38 by Gauthier

I have been using ByteController on my Mac for quite a long time now, it controls well iTunes with both buttons in the menu bar and global shortcuts. It also supports Growl, but I lacked a permanent visual display of the song played, so I do not have to open iTunes to see the song name.

Yesterday I found a small program called SubtleStatus, it displays iTunes artist, song name and album in one of the corner of your screen. It supports transparency and is really unobtrusive. Default setup displays artist, song name and album one after each other, but it also supports AppleScript if you like to tweak things.

As I am also using Cog sometimes, I wanted Subtle to display Cog’s information instead of iTunes’ when it is paused or not running. I wrote a small AppleScript to handle the stuff :

(* Check if iTunes is running and grab current song / artist / album *)
tell application "System Events"
	if exists process "iTunes" then
		tell application "iTunes"
			(* Grab info only if iTunes is playing *)
			if player state is playing then
				set _title to name of current track
				set _artist to artist of current track
				set _album to album of current track
				set foo to _artist & " - " & _title
				return foo
			end if
		end tell
	end if
	(* Check if Cog is running and grab current song / artist / album *)
	if exists process "Cog" then
		(* Cog does not support player state for apple script *)
		tell application "Cog"
			(* Check if Cog is at least loaded with a file *)
			if (exists title of the currententry) then
				set _title to the title of the currententry
				set _artist to the artist of the currententry
				set _album to the album of the currententry
				set foo to _artist & " - " & _title
				return foo
			end if
		end tell
	end if
end tell
(* When returning an empty string, subtle status will disappear *)
return ""

Update: I added a check to see if Cog is running with a file or not.

Posted in Geek |
, , ,

Leave a Comment

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word