dougscripts.com

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/Music.app 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.]

May 16 '16 - 4:45 pm
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.

May 16 '16 - 3:33 pm
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.

May 16 '16 - 3:00 pm
purchaser

Along with downloader Apple ID/name (mentioned earlier), there are also purchaser Apple ID and purchaser name properties of track.

May 16 '16 - 2:55 pm
media kind

Previously, one could only change the video kind of a track. A new media kind property handles switching among alert tone/ audiobook/ book/ home video/ iTunes U/ movie/ music/ music video/ podcast/ ringtone/ TV show/ voice memo/ unknown. Changing this will place the track entry into the appropriate library; it will remain in any current playlists. Again, another highly desirable ability, AppleScript-wise.

May 16 '16 - 2:50 pm
cloud status of a track is a Thing

iTunes 12.4 now has a new cloud status property of a shared track whereby such a track will be one of the following: unknown/ purchased/ matched/ uploaded/ ineligible/ removed/ error/ duplicate/ subscription/ no longer available/ not uploaded. This has been long in coming.

May 16 '16 - 2:37 pm
description of a Playlist now ‘Scriptable

You can do this:

tell application “iTunes”

— the selected playlist

set thePlaylist to (get view of front window)

— write the description

tell thePlaylist to set description to “This is my favorite playlist!”

end tell

This changes the description for the playlist in Playlist View:

May 16 '16 - 2:25 pm
iTunes 12.4 Released

Apple released iTunes 12.4 today. It features a significant UI change as well as updates under the hood. And AppleScript additions!

I’ve just installed it and note these AppleScript changes right off the bat:

current track – now recognizes tracks being played from “For You” and “New” sections. The tracks will be URL class.

download – originally for podcast episodes, now includes the ability to download cloud tracks or playlists to your library.

select – tell iTunes which objects you want to select (as opposed to selection objects already selected manually). [UPDATE: This is incorrect; see here.]

downloader Apple ID and downloader name properties of track.

New subscription playlist (an Apple Music playlist), miniplayer window and video window classes.

I haven’t tested any of these very thoroughly yet. In fact, only current track. And of course, there is likely more stuff to discover. More as it develops.

 
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.