Interesting play Issue with MiniPlayer
As I mentioned below, I had to fix a script to workaround a problem playing a playlist when only one track had as yet been copied to it, which prevented the rest of the subsequently added tracks from being recognized by MiniPlayer and Up Next; thus, only the first track would play. Similarly, if you were to play (the AppleScript command) any track in a playlist, the following tracks will not play because they haven't been recognized by MiniPlayer and Up Next ("No upcoming songs").
Doesn't go good when Mini Player is empty:
You can play the playlist and everything's OK. You just can't initiate play of the entire playlist by playing one of its tracks with AppleScript.
Goes good and loads in MiniPlayer:
Additionally, I found that if the MiniPlayer was already loaded up with tracks, playing a track (via AppleScript) from anywhere would play that track and then resume with whatever is next in MiniPlayer.
iTunes 11 Loses playlist window
Technically, you can't open a playlist in its own window in iTunes 11, so the playlist window element is moot.
UPDATED: Play Random Album v3.1
Play Random Album scans your library, creates a playlist of a complete single album choosen at random and begins playback of the playlist created. Works great when assigned a keyboard shortcut.
This version works around a problem with iTunes 11 whereby after starting to play the first track of the new playlist no additional tracks appear in the MiniPlayer/Up Next and only the first track ever plays. The script now waits until the playlist is completely assembled before starting to play it.
iTunes 11 Loses Gapless Track Feature
You can no longer designate an album of tracks as gapless. Thus, a track's gapless property is now moot.
ERRATA: My title for this post is misleading. The gapless feature has not been lost. But the ability to manually change a track's gapless setting has been removed.
iTunes 11 AppleScript bug
iTunes 11 breaks the AppleScript command to shuffle a playlist. The value of shuffle can still be read with get, it just can't be set.
Update: song repeat is broken in the same way.
Update 2: shuffle and song repeat will only return a value of false and off, respectively. Thus, in addition to being unable to change these values for a playlist, a script cannot detect the actual state of these settings.
iTunes 11 Released
Apple has released iTunes 11. Apple originally previewed iTunes 11 at its September Special Event, announced a vague October release date, and then later postponed release to November.
This updated version features some iOS-inspired GUI changes, re-designed MiniPlayer, improved iCloud integration, improved search, and a revamped design of the iTunes Store.
NEW: Dual-Pass Search
Dual-Pass Search conducts a two-pass search for tracks in the currently selected playlist. On the first pass, the search query behaves like iTunes' own searchbox. Then the track results from the first pass are processed with a second search query.

The track results can be displayed in a Results Window and optionally sent to Results Playlist in iTunes.
Find Truncated Tracks
So there's this problem with iTunes Match whereby a downloaded file is unable to be played all the way through. My friend Kirk McElhearn describes the problem in great detail here. Essentially, the iTunes Match file is downloaded but some kind of corruption in the file prevents audio data from being read/played all the way through to the end even though all the data is very likely extant. If a truncated track and associated file are deleted it can be re-downloaded intact successfully. But it is difficult to hunt these tracks down since the reported duration, start, finish, size and time values of the tracks are correct and there is otherwise nothing detectably unusual about them.
The only way to discover if a track is truncated is to play it and hear it end abruptly. Since it appears that less than half the audio data of these tracks is playable, I found that by starting to play the track after positioning the cursor very close to the end of the track in the iTunes LED window the next track would play immediately if the clicked-on track was truncated.
So I've written a script, Find Truncated Tracks, that automates this process for a playlist of tracks and copies the varmints to a discrete playlist for later recycling. Find Truncated Tracks will go through the tracks in the current playlist starting with a single selected track. It will position the play head at ten seconds from the end of the track. Then, it will play the track and immediately check the player position. If the track is truncated, the player position will be the last playable second of the track which will be much sooner than the ten-seconds-from-the-end play position at which the track was just set to start. Thus detected, this truncated track will be copied to a new playlist named "_Truncated Tracks". And so on for each track in the playlist from the selected starting track.
Unfortunately, it's not terrifically fast. Each track must be played in real time so that the script can detect if it can play all the way through. Fortunately, a track only needs to play for a fraction of a second to get its current player position. But still, the script's not going to finish up instantaneously. Average running times at my house were about three minutes per thousand tracks.
Play counts are not affected.
You may run into a dialog that will popup for unauthorized purchased tracks (if you have any of those). AppleScript can't prevent this, so that may put the kibosh on unattended use. Otherwise, just let it run and go out for a sandwich.
I Hate GUI Scripting Except When I Don't
Sometimes the only way to script anything that isn't explicitly in an app's scripting definition is to use GUI Scripting. I always look for some other way before resorting to GUI Scripting since it can get pretty oogly and is dependent on the app's GUI; if the developer changes the GUI then the script can be rendered useless. With that said, a Correspondent writes:
"In iTunes, I utilize checkboxes to determine what songs are synced to my iPhone. I do not utilize playlists because I want to keep complete playlists in my iTunes library while still syncing them to my iPhone, minus any unchecked songs. The problem is that iTunes will not play unchecked songs continuously, which annoys me. I recently discovered, however, a preference called "Show list checkboxes". Unchecking this will hide the checkboxes column and allow me to play my songs uninterrupted, but when I want to sync my iPhone I have to show the checkboxes again so that it won't try to sync my entire huge library.
I was wondering if there was any way that you could create a script that toggles this preference on & off, in order to reduce the number of clicks required to switch between playing all of my music and syncing my iPhone. This would be much appreciated."
There's no explicit command to toggle this behavior, but this bit of GUI Scripting'll do it:
tell application "iTunes" to activate
tell application "System Events"
tell process "iTunes"
click menu item 3 of menu 2 of menu bar 1
click button 1 of UI element 5 of window 1
click UI element 25 of group 1 of window 1
click UI element 1 of window 1
end tell
end tell
You must have set up GUI Scripting using the instructions found here. And be warned that if the Preferences panel of iTunes changes in the future this script may no longer work.
As usual, works best with a keyboard shortcut.
Emulate Drag Playlist Folder to Make New Playlist
You can use the "Duplicate" option in a playlist's contextual menu to make an exact copy of the selected playlist. This works for regular and Smart playlists. You can also select a playlist and drag it in the Playlists section of the Source list to duplicate it as a regular playlist. Using this method will duplicate any kind of playlist as a regular playlist. This is especially useful for making a playlist from a Playlist Folder, which does not have "Duplicate" in its contextual menu.
But you may find it easier to run a script on a selected playlist to duplicate it, especially if you aren't wild about the drag-and-duplicate method which can be slippery. The script below will duplicate any selected playlist as a regular playlist. The new playlist will have the same name as the selected playlist, but you can edit this to include " copy" or something if you wish:
tell application "iTunes"
set selectedPlaylist to view of front window
set newPlaylist to (make new playlist with properties {name:(get name of selectedPlaylist)})
duplicate tracks of selectedPlaylist to newPlaylist
reveal newPlaylist
end tell
(The last command to reveal selects the new playlist; you may not want this.) Name it whatever you like and Save it as a compiled script in ~Library/iTunes/Scripts/. I've found this very handy for making playlists from Playlist Folders that contain several playlists (or sub-Playlist Folders of playlists). Works great with a keyboard shortcut.

