Viewing By Entry / Main
August 9, 2006
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

Comments

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?


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.


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.


Using Proxi and your script, my Skype now knows what I'm playing. Thanks Sean!


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

next step, find how to do the same with last.fm ;)


I just tried this out and it works well. This is great! Thanks!


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.


@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!


Post Your Comments
Name:
Email Address:
Comments
*** Please note that all comments require moderation so it may be some time before your comment posts to this blog! ***
Remember My Information:
 



Hosting provided by