tell application "Finder"
set myLocation to (((path to desktop folder) as text) & "iTunes_PlayCount.html")
if file myLocation exists then
delete file myLocation
end if
set myFileRef to (open for access file myLocation with write permission)
write "<HTML><HEAD><TITLE>my Play Counts </TITLE></HEAD><BODY>" & return to myFileRef
write "<p>My playcounts for all my songs...</p>" & return to myFileRef
write "<TABLE width=500 border=1>" & return to myFileRef
tell application "iTunes"
set myPlaylist to every playlist
set x to the first item of myPlaylist
set myTrackList to every track of x
repeat with y in myTrackList
set myTrackName to name of y
set myPlayedCount to played count of y
tell application "Finder"
write "<tr><td>" & myTrackName & "</td>" & "<td width=15%>" & myPlayedCount & "</td></tr>" & return to myFileRef
end tell
end repeat
end tell
write "</TABLE>" & return to myFileRef
write "</BODY></HTML>" & return to myFileRef
close access myFileRef
display dialog ("Finished Summary")
end tell