Cool tricks with AT codes

Slight return: The unholy power of Perl

$music_player, kindly play the next track.

applescript

 try
   tell application "iTunes"
     try
       set the current_track to get current track
     on error
       error "No current track."
     end try
     set the track_count to (the count of tracks of the current playlist) as string
     next track
     try
       set this_track to get current track
     on error
       play current_track
       set this_track to the current_track
       play track 1 of current playlist
       set this_track to get current track
     end try
     set the track_index to (the index of this_track) as string
     set this_title to the name of this_track as string
     return (track_index & "/" & track_count & "  " & this_title)
   end tell
 on error error_message
   return error_message
 end try

Perl

 use Xmms::Remote;
 my $xmms = Xmms::Remote->new;
 $xmms->playlist_next;