Read the rest of the hint for the script...
--Script created by Elliott Hoffman 2004
-- Thanks to Jonn of http://homepage.mac.com/jonn8/as/
-- for debugging help!
-- "dir" must be set to the directory of your iTunes Music Library
set dir to "Path/to/my/iTunes/Library" as string
set shell_script to "readout= lsof +D" & " " & dir & " | ¬
grep [mp3,m4p,m4a]; echo -n $readout;"
set song_list to paragraphs of (do shell script shell_script)
try
set message to "Songs people are listening to:" as string
repeat with song_list_index from 1 to (count of song_list)
set item song_list_index of song_list to ¬
(trim_path(item song_list_index of song_list) & ¬
(return)) as string
song_list_index = song_list_index + 1
end repeat
set message to "Songs being listened to:" & return ¬
& song_list
on error
set message to ¬
"There are no songs being listened to right now." as string
end try
display dialog ¬
message ¬
buttons {"OK"} default button 1 with icon 1
on trim_path(song_string)
my set_delim("/")
set song to (text item -1 of song_string)
set artist to (text item -3 of song_string)
my set_delim(".")
set song to (text item -2 of song)
set song_string to ("•" & song & " by " & artist)
my set_delim("")
if song_string's length is greater than 36 then
set song_string to (get text 1 thru 36 of song_string) & "..."
end if
return song_string
end trim_path
on set_delim(the_delim)
set AppleScript's text item delimiters to the_delim
end set_delim
If you'd prefer to skip the typing, you can download a formatted version.
P.S.: This can be added to the iTunes scripts menu by saving the script as an Application and putting it in the ~/Library -> iTunes -> Scripts folder (you can create it if you don't have it).

