May 20 '16 - 4:55 pm
Did I Forget to Mention This?

The selection property will contain references to tracks selected in Apple Music. You can get properties of these URL tracks, but you can’t set them. That would be dumb*.

I neglected to note this earlier because I was falling all over myself about current track and current playlist also being able to reference Apple Music items.

{UPDATE: *I stand corrected. You can set the loved property of the tracks in a selection of Apple Music tracks.]

May 20 '16 - 10:38 am
EQ window No No

The EQ window inherits full screen from window now, but setting full screen of EQ window to true will error.

Of course I tried it. Thought it’d be fun to see a full screen-sized EQ window.

Slightly disappointed.

May 20 '16 - 10:23 am
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.

May 20 '16 - 7:12 am
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.

May 18 '16 - 7:12 am
Reset Plays MIA

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


set thisTrack’s played count to 0

end 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”.

[UPDATE: iTunes 12.4.1, released June 2, 2014, restores the Reset Plays feature.]

May 17 '16 - 12:01 pm
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.]

May 17 '16 - 9:34 am
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.)

May 17 '16 - 7:04 am
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/ experience, I’m confident that we old-schoolers can still Rip-Mix-Burn easy.

May 16 '16 - 6:53 pm
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.

May 16 '16 - 5:42 pm
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.]

Site contents © 2001 - 2016 (that's right: 2001) Doug Adams and weblished by Doug Adams. Contact support AT dougscripts DOT com. About.
All rights reserved. Legal.
AppleScript, iTunes, iPod, iPad, and iPhone are registered trademarks of Apple Inc. This site has no direct affiliation with Apple, Inc.