Xchat::register("playing","0.4", "Simple iTunes Now Playing Script",""); Xchat::hook_command("playing", "nowplaying"); Xchat::hook_command("playing2", "longplaying"); sub nowplaying { my $announcer_script = "tell application \"iTunes\" set the_announcer to [\"np: \" & name of current track & \" - \" & artist of current track & \" - \" & album of current track] end tell return the_announcer as string"; Xchat::command("applescript -o $announcer_script"); } sub longplaying { my $announcer_script = "tell application \"iTunes\" set the_announcer to [\"np: \" & name of current track & \" by \" & artist of current track & \" from the album \" & album of current track] end tell return the_announcer as string"; Xchat::command("applescript -o $announcer_script"); }