After almost giving up, I stumbled upon a great Unix feature: Control-V. Press that in the Terminal and then hit any fkey, and it will give you the magic code to use, even pasting it if you're using vi. Then, put these lines (or something similar) in your ~/.cshrc (if using tcsh):
#Key bindings for iTunes
bindkey -c "^[OP" "sh /Users/your_user/scripts/previous"
bindkey -c "^[OQ" "sh /Users/your_user/scripts/playpause"
bindkey -c "^[OR" "sh /Users/your_user/scripts/next"
bindkey -c "^[OS" "sh /Users/your_user/scripts/tuneinfo"
You can use a different path to the scripts if you want. After that, you need to make those scripts. A sample one is:
#!/bin/sh
echo "Play/Pause"
osascript <<ENDSCRIPT
tell application "iTunes"
playpause
set theCurrentTrack to the current track
set theBand to the artist of theCurrentTrack as string
set theSong to the name of theCurrentTrack as string
return (theSong & " - " & theBand)
end tell
ENDSCRIPT
For next and previous functions, just copy the first script and change playpause to next track and previous track, and the script must be named to match what you put in ~/.cshrc. Then log out, open a new terminal window, and voila! I am using these fkeys:- F1 - Previous Track
- F2 - Playpause
- F3 - Next Track
- F4 - Track Info
[robg adds: I tested this one and it works as described (remember to make the scripts executable with chmod 755 script_name), but I'll stick with Butler -- I like having access to the keys from apps other than the Terminal.]

