i have streamlined and moved blocks around, but it’s little better than pseudocode;
each and every attempt to “set blahBlah to tracks of playlist” results in "iTunes got an error: descriptor type mismatch occurred."
I’m stymied, and the Google is no help. Presented here for perusal; I will continue after today’s location scout.
--Get Current Calendar Event via iCalBuddy hasseg.org/icalBuddy
set PlaylistTVShow to {first item of my text_to_list((do shell script "/usr/local/bin/icalbuddy -eed -nc -b \"\" eventsNow"), return) as string}
tell application "iTunes"
--Shuffle based on "CK's Evenly-shuffled Playlists v0.6" by Charles Kelly http://www.manythings.org/mac/
set MergedPlayList to "Now Playing"
set PlaylistInterstitials to "[ID-D]" -- Intersitials for the [D]aytime broadcast
if (every playlist whose name is MergedPlayList) is {} then
set MergedPlayList to make new user playlist with properties {name:MergedPlayList} -- if no playlist, make it
else
set MergedPlayList to user playlist MergedPlayList -- if playlist, clean it out
repeat
set tr to tracks of playlist MergedPlayList
if tr is {} then exit repeat
repeat with t in tr
delete t
end repeat
end repeat
end if
set x to (count of tracks of user playlist PlaylistTVShow) -- length based on requested TV Show
repeat with i from 1 to x
set theTrack to some item of playlist PlaylistInterstitials
set theTrackID to database ID of theTrack
set enabled of (duplicate theTrack to MergedPlayList) to true
set MergedTracks to MergedTracks & (theTrackID)
set theTrack to item i of playlist PlaylistTVShow
set theTrackID to database ID of theTrack
set enabled of (duplicate theTrack to MergedPlayList) to true
set MergedTracks to MergedTracks & (theTrackID)
end repeat
set full screen to true
play the playlist named "Now Playing"
end tell
set nextUp to (POSIX file "/Users/chadwick/Movies/TV Up Next Loop (City).mp4")
--wait for playlist to finish
on idle
tell application "iTunes"
try
if player state is not stopped then return 5
on error
return 5
end try
end tell
tell application "QuickTime Player"
activate
delay 1
open file nextUp
set looping of document 1 to true
set presenting of document 1 to true
play document 1
end tell
return 5
end idle
on text_to_list(txt, delim)
set saveD to AppleScript's text item delimiters
try
set AppleScript's text item delimiters to {delim}
set theList to every text item of txt
on error errStr number errNum
set AppleScript's text item delimiters to saveD
error errStr number errNum
end try
set AppleScript's text item delimiters to saveD
return (theList)
end text_to_list