When I run it, it tells me that it "cannot get every track" of the playlist.
The error message is iTunes' attempt to tell you that whatever value or object is in the blockpartyplaylist
variable, it isn't a playlist. Let's assume that the block party playlist name is "Block Party"; what the error message is really saying is Can't complete the command get every track of "Block Party", because "Block Party" doesn't represent a playlist object.
(If the first line in your sample code was display dialog class of blockpartyplaylist as text
, I'm guessing you'd p'bly see "text", meaning that your variable holds a string instead of a playlist.)
So all you have to do is get a playlist object for "tracks of" to work on. Again using "Block Party" as a playlist name, you could:
set blockpartyplaylist to playlist "Block Party"
. . .
set trax to tracks of blockpartyplaylist
set blockpartyplaylist to "Block Party"
. . .
set trax to tracks of playlist blockpartyplaylist
For speaking, something like this:
tell application "iTunes"
set trak to current track
set trak_name to name of trak
set trak_artist to artist of trak
set trak_year to year of trak
say ("The current track is: " & trak_name & ", by: " & trak_artist & ", released in: " & trak_year)
(The "say" line could go inside the "tell" block, but it doesn't have to.) Lottsa sample code on the net.