Play Random Track from specific Playlist
Perhaps others might find it useful. Change the value "xClassical" to whatever playlist you want.
Here's the script:
<--BEGIN SCRIPT---->
property required_version : "2.0.3"
tell application "iTunes"
activate
-- VERSION CHECK
set this_version to the version as string
if this_version is not greater than or equal to the required_version then
beep
display dialog "This script requires iTunes version: " & required_version & ?
return & return & ?
"Current version of iTunes: " & this_version buttons {"Update", "Cancel"} default button 2 with icon 2
if the button returned of the result is "Update" then
my access_website("http://www.apple.com/itunes/download/")
return "incorrect version"
end if
end if
tell source "Library"
tell playlist "xClassical"
set this_track to some track
set this_name to the name of this_track
set this_artist to the artist of this_track
set this_album to the album of this_track
play this_track
end tell
end tell
--display dialog "Now playing?" & return & return & ?
-- "Name: " & this_name & return & ?
-- "Artist: " & this_artist & return & ?
-- "Album: " & this_album buttons {"?"} default button 1 giving up after 10
end tell
on access_website(this_URL)
ignoring application responses
tell application "Internet Explorer"
GetURL this_URL
end tell
end ignoring
end access_website
<--END SCRIPT---->

