An Architect's View

ColdFusion, Software Design, Frameworks and more...

An Architect's View

Skype and iTunes

August 9, 2006 · 8 Comments

I like the fact that Skype has a mood message but I didn't like the fact that there is no integration with iTunes to let you show the "now playing" song... I mean, Skype knows to pause iTunes when a call comes in so why not allow the mood message to be updated? A bit of Googling discovered that Skype has an API that can be driven by AppleScript (and I knew iTunes could be driven by AppleScript) so all I needed was a way to run a script automatically every minute or so. I found Script Timer ($12) which can schedule scripts of all sorts, either by time or by interval or by certain events. Very nice. And the AppleScript I wrote?
set messageText to ""
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 "Skype"
   send command commandText script name "test"
end tell

Tags: osx

8 responses so far ↓

  • 1 DanielD // Aug 9, 2006 at 7:24 PM

    Does OSX not have a existing CRON command that you could use. It should having BSD under the hood. Or can you not run applescript items?
  • 2 Sean Corfield // Aug 9, 2006 at 11:01 PM

    Daniel, yes, OS X has cron. You might want to read the product comparison on the Apps & More site that shows the functional differences between Script Timer and cron - cron has a lot of limitations that Script Timer does not.
  • 3 cyprian.pl // Nov 15, 2006 at 5:15 PM

    Try Proxi trigger to run this script, it warks just perfect: http://proxi.griffintechnology.com/wiki/index.php/AppleScript_(trigger).
    It can trigger AppleScript everytime a track is changed.
  • 4 John Wilker // Dec 18, 2006 at 10:14 AM

    Using Proxi and your script, my Skype now knows what I'm playing. Thanks Sean!
  • 5 mortimer // Jan 17, 2007 at 9:14 AM

    Great script, I am using it with Proxi, it's a treat!

    next step, find how to do the same with last.fm ;)
  • 6 Kelly // Jan 30, 2007 at 11:02 AM

    I just tried this out and it works well. This is great! Thanks!
  • 7 Marco van Lienen // Dec 2, 2007 at 12:19 PM

    I downloaded Proxi 1.5.1 and have configured 1 AppleScript trigger in Proxi with 1 AppleScript task to run the custom AppleScript and pasted in the supplied script.
    I gave Proxy permission to 'talk' to the Skype API (Proxi is showing as a Skype API Client).
    should that be enough to show which iTunes song is playing from within Skype (on Mac version 2.6.0.151) cuz im not seeing it.
  • 8 Sean Corfield // Dec 2, 2007 at 4:01 PM

    @Marco, with Skype 2.6, all you need to do is go to Preferences > Advanced and check the box to Show iTunes song in my mood message and Skype does it automatically for you! This blog entry is nearly 18 months old!

Leave a Comment

Leave this field empty: