Thursday, August 7, 2008

iTunes track names to Skype - version 1.1

Update of my little Applescript application to display iTunes track names.
Original is here: http://blog.lonaday.com/2008/06/itunes-track-names-to-skype.html
  • No more error alerts if iTunes or Skype has issues. Now safe to put in your startup items.
  • Minor code cleanups.
  • Crappy little icon :)
Download it here.

Or look at the code if you must:

global latest_song, moodprefix, qChar
on run
set moodprefix to ""

set latest_song to "iTunes2Skype for Mac: http//blog.lonaday.com/2008/06/itunes-track-names-to-skype.html"
set qChar to ASCII character 34

end run
on idle
try
set aplist to my running_apps()
if aplist contains "iTunes" and aplist contains "Skype" then
try

tell application "iTunes"
if player state is playing then
set current_tracks_name to moodprefix & qChar & the name of the current track & qChar & " by " & the artist of the current track as string
else
set current_tracks_name to ""
end if
end tell
on error
-- error silently
end try
try
if (current_tracks_name is not latest_song) then
copy current_tracks_name to latest_song
tell application "Skype"
send command "SET PROFILE MOOD_TEXT " & latest_song script name "iTunes2Skype"
end tell
end if

on error
-- error silently
end try
end if
on error
-- error silently
end try
return 10
end idle
on reopen
tell me to run
end reopen
on running_apps()
tell application "System Events"
return (get name of every process)
end tell
end running_apps

Technorati Tags: , , , ,

2 comments:

  1. respect mistah :)
    too little given nowadays, even 4 scripting something little (or big 4 that matter) katz just wanna download & plugin; skrew the source.. but there are still those [from the old skool] that appreciate the time & effort, so big up 2 u!! keep it up! 4t4r1.)

    ReplyDelete
  2. Thanks for the kind words. Glad to hear that my little toy is of benefit to others.
    And the "old school" ethics require that I explain the magic so that others can do this on their own.

    I was able to create this little script because there were examples out there for me to learn from.

    So next time I'll be able to download the program and someone else can write it.

    If everyone contributes, it all keeps going.

    ReplyDelete

Please leave your comment here.