Okay, I give up. I thought I had a decent handle on scripting, but apparently not. Before I post the code that I have, let me explain what I’m trying to do. I like to have entire albums on my iPod. As of yet, you can not auto-fill an iPod by album. So I figured I would make a playlist once a week consisting of random albums. The albums will be determined by a random selection of songs which meet certain criteria (basically making a smart playlist, and then grabbing the albums that those songs come from). Then, once a week I will simply drag that playlist to my iPod. So, here’s what I have so far:
set theAlbum to getAlbum()
set ID_list to getIDs()
make_playlist out of ID_list
on getAlbum()
tell application "iTunes"
get album of some track of playlist "Library"
end tell
end getAlbum
on getIDs()
global theAlbum
tell application "iTunes"
set ID_list to (database ID of file tracks of library playlist 1 whose album is theAlbum)
return {}
end tell
end getIDs
on get_location for tune_ID
global library_ref
tell application "iTunes"
return first file track of library_ref whose database ID is tune_ID
end tell
end get_location
on make_playlist out of ID_list
tell application "iTunes"
activate
set new_playlist to make new playlist with properties {name:("iPod Mix " & (current date))}
repeat with tune_ID in ID_list
tell me to get_location for tune_ID
duplicate {result} to new_playlist
end repeat
end tell
end make_playlist
This runs with no errors. If I follow the results I can see that it makes a list of database IDs for an entire album (only one at this point). It also creates a playlist successfully. But it won’t add (or duplicate) the tracks into the playlist. So thats where I am.
Also, if subroutines are not the answer here (or are overkill) I apologize. I’m going thru Sal’s book, and well… yeah.
Thanks in advance!