X-Chat Aqua “Now Playing” Script
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."
else
"Now Playing: " & artist of current track & " - " & name of current track & " (Album: " & album of current track & ")"
end if
end tell
else
"Now Playing: Nothing, iTunes is not open."
end if
end tell
Here are some brief instructions:
- Open up Script Editor (Applications — AppleScript — Script Editor). Paste that code in there, and save it someplace safe.
- In X-Chat Aqua, open up the User Commands preference list (X-Chat Aqua — Preference Lists — User Commands…).
- Click the “+” button, and change the command name to
NPand set the area for text on the right to something likeexec -o osascript /Users/yourusername/path/to/xchat/script.scpt. Of course, change the path to where you saved the script file in step 1. - Press Ok, go to a channel window, type
/npand press enter. It should output something simliar toNow Playing: Hoobastank - The Reason (Album: The Reason).
Notes
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.
- Sort of kidding… ↩
5 Comments, Comment or Ping
C4
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.
Nov 4th, 2007
C4
go to pref list>Userlist popup.Add a new one,rename it to whatever u want.in 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”
Nov 4th, 2007
Robin
@C4: I got it to work but I had to redo it as a Perl plugin.
See the project page for more information.
Nov 4th, 2007
ige
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 :$
thanks
Jan 21st, 2008
Robin
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.
Jan 22nd, 2008
Reply to “X-Chat Aqua “Now Playing” Script”