Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Show current iTunes song in X-Chat Aqua Apps
Ever wanted to have X-Chat Aqua automatically print the song iTunes is playing at the moment? Here's how to do it. Fire up the Script Editor (in /Applications: AppleScript), and type in or copy and paste the following small script:

tell application "iTunes"
  "Now playing: " & artist of current track ¬
  & " - " & name of current track
end tell
Execute it to see if it shows what you want, and maybe edit it to your needs. Save it somwhere; in my case I called it iTunes_np.scpt, and saved it to my user's bin folder. Start XChat-Aqua and, in the menu, go to X-Chat Aqua: Preferences Lists > User Commands. Click the Add button and choose a name for the command to show the song -- NP (for "now playing"), for example. In the box to the right, enter exec -o osascript /path/to/script. In my case, this was exec -o osascript /Users/zottel/bin/iTunes_np.scpt.

Voila, you're done. From now on, whenever you type /np (or whatever you chose for the command name), your currently playing song will be posted to the current channel.
    •    
  • Currently 2.75 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (4 votes cast)
 
[12,863 views]  

Show current iTunes song in X-Chat Aqua | 6 comments | Create New Account
Click here to return to the 'Show current iTunes song in X-Chat Aqua' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Show current iTunes song in X-Chat Aqua
Authored by: durin42 on Nov 08, '05 08:29:21AM
if you want a generic shell version of the above, use this quick hack:

#!/bin/sh

echo 'tell application "iTunes"
  "Now playing: " & artist of current track & " - " & name of current track
end tell' | osascript
Note the single quotes surrounding the Applescript segment. I'm sure there's a better way to make a command-line script to return this, but this works just fine.

[ Reply to This | # ]
Show current iTunes song in X-Chat Aqua
Authored by: anaxamander on Nov 08, '05 01:37:07PM
Get the filename of the currently playing song in iTunes:
basename "`osascript -e 'tell application "iTunes" to set thePath to location of current track' -e 'POSIX path of thePath'`"
Soul Mekanik - Robots.mp3
basename "`osascript -e 'tell application "iTunes" to set thePath to location of current track' -e 'POSIX path of thePath'`" | awk -F '.m[4p][a3]$' '{print $1}' 
Soul Mekanik - Robots

[ Reply to This | # ]
Show current iTunes song in X-Chat Aqua
Authored by: merosen on Nov 08, '05 04:49:11PM

is there a command suntax so the result isnt broadcaast to all users
but shows up only as local result ?



[ Reply to This | # ]
Show current iTunes song in X-Chat Aqua
Authored by: zottel on Nov 16, '05 01:20:18PM
To just show the song locally, use
exec
instead of
exec -o
when defining your xchat command.

[ Reply to This | # ]
Show current iTunes song in X-Chat Aqua
Authored by: timhaigh on Nov 08, '05 06:58:10PM

This script also works for me in the X11 version of xchat that I compiled using Fink.



[ Reply to This | # ]
Show current iTunes song in X-Chat Aqua
Authored by: Anrky on Mar 16, '06 06:29:56PM

is there any way to modify the running of this script so it can show up as a "/me" command?



[ Reply to This | # ]