iTunes 12.4
Tidbit on minimized
The browser window property minimized has been removed ("is the small player visible?"). This was related to the old behavior when minimizing the main window would switch to the miniplayer. Good times. I seem to recall this mechanism had different behaviors in various versions of iTunes. Anyway, not needed since the "small player" can be detected using the new miniplayer window class.
Slight Growing Pains Continue
The podcast value for media kind will confuse older scripts that look for the podcast property of track. The podcast property for track ("is this track a podcast episode?") was removed in iTunes 12.4. Similarly, the iTunes U property of track has also been removed and is now a value for media kind.
Reset Plays MIA
[UPDATE: iTunes 12.4.1, released June 2, 2016, restores the Reset Plays feature. The "Reset" button is located in the track's Get Info window's "Details" tab adjacent to the play count entry.
Of course, the script below is still serviceable.]
Looks like the "Reset Plays" command is MIA in iTunes 12.4. Here's a script that will reset the played count of each selected track to 0 and remove its played date.
tell application "iTunes"
set sel to selection
if sel is {} then return -- nothing selected
repeat with thisTrack in sel
-- use try blocks to fail gracefully if problem
try
set thisTrack's played count to 0
end try
try
set thisTrack's played date to missing value
end try
end repeat
end tell
Click on the script icon to open this in Script Editor on your machine. From Script Editor's File menu, click "Save...". In the Save Panel, enter a name for the script, like "Reset Plays", and save it to your [username]/Library/iTunes/Scripts/ folder (if no "Scripts" folder exists, create one). Once saved to this folder, the script will appear in iTunes' Script menu. To use, select the track(s) in iTunes whose plays you want to reset and then choose the "Reset Plays" script in the Script menu.
A more advanced version of this script is available as a download from this page.
Alternatively, you can use Add or Subtract Play Count, New Last Played Date, or New Play Count. Each has some capacity to change a track's Plays.
There still seems to be a bug regarding changing the Plays of Matched/Uploaded tracks in the cloud, whereby the played count reverts to whatever it was before being "artificially" set with AppleScript (or other means). I couldn't say if that issue is related to the disappearance of "Reset Plays".
Setting player position Can Fail
Setting the player position while the iTunes player state is paused resets the player state to stopped and resets the player position to 0.
tell application "iTunes"
play -- initialize the state to Play
pause -- put iTunes in Pause mode
set player position to 5
log (get player state) -- will be stopped
log (get player position) -- will be 0
end tell
Attempting a workaround, I found that as long as the track isn't paused, the player position can be set.
This did not occur in previous versions; setting the player position while paused would, as expected, move the play head to that position. In fact, Needle Drop uses a variation of this to begin playing a track at a user-set start time. Needless to say, this won't work with iTunes 12.4. (Hat-tip to Correspondent Rob Robinson.)
[UPDATE: Needle Drop v5.3 addresses this issue.]
[UPDATE ALSO: this issue is fixed in iTunes 12.4.1.]
Music vs music
The AppleScript issue in iTunes 12.4 whereby filtering special kind by Music fails is caused by a conflict with the new media kind property. One of the values it uses is music.
Bugs are being filed. (Hat-tip to Correspondent Nate Weaver.)
Lanced Anxiety
Apple's refresh of the iTunes interface in the latest version and the addition of new AppleScript properties has lanced any anxiety I had about the future of file handling and the future of iTunes AppleScripting. In short: I think we're good for a while.
There's been a lot of chatter lately about Mark Mulligan's projection numbers that suggest Apple could shut down the Store sooner than later. Hot on the heels of this portent was deletegate. Suddenly, iTunes was doomed, your music collection could evaporate, and the Hellmouth would consume us all.
I don't believe Apple would have gone to the effort of adding so much new AppleScript stuff if the roadmap pointed to dropping AppleScript altogether anytime soon. And by the same token, those of us who still rely on iTunes to manage our media files (as opposed to going all-cloud, all the time) can be encouraged by the addition of—for example—the file-related purchaser and downloader properties.
So, while the cloud and streaming are certainly going to be part of the iTunes/Music.app experience, I'm confident that we old-schoolers can still Rip-Mix-Burn easy.
Finally, What select Does
The new select command is evidently used to bring a visible but obscured window to the front. The browser window, miniplayer window, EQ window and video window can receive a select command.
The Return of shuffle and repeat
The shuffle commands are now application properties. Back in the day, each playlist could be set individually via AppleScript to shuffle and/or repeat. Those were deactivated when playlists were re-vamped under iTunes 11. At the time, shuffle and repeat became global settings and were no longer 'scriptable.
Well, they're back. But not for individual playlists, just as global settings. The new properties are shuffle enabled (taking true or false as values) and shuffle mode (songs/ albums/ groupings). The new song repeat property takes the old off, one, and all parameters.
[UPDATE: To be clear, the obsolete shuffle and song repeat have been removed as playlist properties.]
Busted: special kind syntax?
In iTunes 12.4, I can't get a reference to the Music library playlist by doing this:
tell application "iTunes"
set musicPlaylist to (get some playlist whose special kind is Music)
end tell
...because iTunes apparently doesn't recognize the Music value for special kind. When the script is compiled it changes the Music value to lower case:
tell application "iTunes"
set musicPlaylist to (get some playlist whose special kind is music)
end tell
...and the script fails. A lot of my scripts use this to target a particular media library, like Music or Movies.
I suspect, (maybe? perhaps?) that the new select command is related? But, until now, I haven't been able to get any object to react to select. More as it develops.
UPDATE: Well, this works (coercing the value of special kind to text), but it shouldn't have to be done this way:
tell application "iTunes"
set nonSpecial to every user playlist whose special kind is not none
repeat with aP in nonSpecial
if (special kind of aP as text) is "Music" then
log "HEY"
end if
end repeat
end tell
UPDATE ALSO: Correspondent Nate Weaver tweeted to remind me that the event code «class kSpZ» can be used instead of the boinked Music value.
UPDATE ALSO ALSO: Here's the problem.
current playlist
Like current track, current playlist will recognize an Apple Music playlist. Should have mentioned that before, eh? While you can get properties of cloud tracks and playlists—say, the description of a For You playlist—you cannot change them.