Skype and iTunes, a modification of Sean’s code

I found Sean’s entry on setting his Skype status to the current iTunes track and immediately implemented it. Love it! But I had one problem, Sometimes I fire off iTunes to listen to a song in the music store before downloading, or am listenning to (or watching) a podcast and don’t care to have that sent over the intertubes, and more than that, don’t care to have Proxi launch Skype so it can update my status, when I don’t care to have skype running.

This minor mod doesn’t solve all situations, but if Skype isn’t running, and you’re using iTunes, Skype won’t be launched just so it update your status (which for me, happens a lot, so if nothing else, this helps me A LOT).

Here’s the entire piece of code, I’ve bolded my additions.

set messageText to ""
set SkypeIsRunning to 0
try
    tell application "iTunes"
        set trackName to name of current track
        set trackArtist to artist of current track
        set trackAlbum to album of current track
    end tell
    if not trackArtist = "" then
        set trackArtist to " by " & trackArtist
    end if
    if not trackAlbum = "" then
        set trackAlbum to " from " & trackAlbum
    end if
    set messageText to trackName & trackArtist & trackAlbum
end try
set commandText to "SET PROFILE MOOD_TEXT " & messageText
tell application "System Events"
    set SkypeIsRunning to count (every process whose name is "Skype")
end tell

if SkypeIsRunning > 0 then
    tell application "Skype"
        send command commandText script name "test"
    end tell
end if

If Skype isn’t running, SkypeIsRunning will be 0. If it’s 0 then I don’t want to update my status.

5 thoughts on “Skype and iTunes, a modification of Sean’s code

  1. John Wilker Post author

    @marcus,

    So you’ll still follow Sean’s basic setup instructions, but where his applescript is, you could use mine. I use Proxi (mentioned in sean’s comments). It has a built in itunes watcher. Which will fire this script off. Sean’s will cause Skype to open if it isn’t, mine simply checks to see if it’s open before setting the status.

  2. John Wilker

    @marcus,

    So you'll still follow Sean's basic setup instructions, but where his applescript is, you could use mine. I use Proxi (mentioned in sean's comments). It has a built in itunes watcher. Which will fire this script off. Sean's will cause Skype to open if it isn't, mine simply checks to see if it's open before setting the status.

Comments are closed.