Update: This has been made obsolete by the much-improved plugin.

Courtesy of Joey Brooks, a.k.a. tunicwriter, here is an AppleScript script for X-Chat Aqua that you can use to show your currently playing iTunes song to the rest of the IRC chatroom. Of course, if iTunes isn’t running, a message is shown to that effect.

I want to make it clear that none of it is my code — all Joey’s. Direct all complaints to him1.

tell application "System Events"
    if exists process "iTunes" then
        tell application "iTunes"
            set theCurrentState to player state
            if theCurrentState is paused then
                "Now Playing: Nothing, iTunes is currently paused."
            else if theCurrentState is stopped then
                "Now Playing: Nothing, iTunes is currently stopped."
                "Now Playing: " & artist of current track & " - " & name of current track & " (Album: " & album of current track & ")"
            end if
        end tell
        "Now Playing: Nothing, iTunes is not open."
    end if
end tell

Here are some brief instructions:

  1. Open up Script Editor (Applications — AppleScript — Script Editor). Paste that code in there, and save it someplace safe.
  2. In X-Chat Aqua, open up the User Commands preference list (X-Chat Aqua — Preference Lists — User Commands…).
  3. Click the “+” button, and change the command name to NP and set the area for text on the right to something like exec -o osascript /Users/yourusername/path/to/xchat/script.scpt. Of course, change the path to where you saved the script file in step 1.
  4. Press Ok, go to a channel window, type /np and press enter. It should output something simliar to Now Playing: Hoobastank - The Reason (Album: The Reason).


An area where this script could be improved is to use an action (the /me command), which makes a lot more sense. Unfortunately neither Joey or I have been able to find a way to use AppleScript to get X-Chat Aqua to use the /me command, but if you do find a way, please do let me know as I’ve been searching for a while.

And, no, putting “/me” in the command itself doesn’t work. Already tried that. Would be nice if that worked, though.

  1. Sort of kidding… 


  • abt the “/me” command,u gotta put it in Preferances List>User List Popup

    Add a new one,and rename the name to whatever u like.In the command box,i put something like this “me sticks a nuke up %s’s ass and waits for a response!” u dont need “/me” instead u put “me”

    on mirc,the nick represent by $$1,$$2 but on x-chat aqua it will be %s.

  • go to pref list>Userlist popup.Add a new one,rename it to whatever u the command box put something like this “me sticks a nuke up %s’s ass and waits for a response!”

    You dont have to put “/me” but instead put “me”

  • it gives me this ” /Users/MyUser/Applications/X-Chat :Unknown command” I’m no expert in scripting at all but I did all whats you’ve told and it shows that error msg above

    but to be honest I didn’t quite understood the /me part in Userlist popup I hope you may provide me with a clear 101 version :$


  • I would use the Perl X-Chat Aqua plugin instead (see the link at the top of the post). It works a lot better, and to be honest I have no idea what I’m doing in AppleScript, so I doubt I can help you debug it.