dougscripts.com

May 16 2016 - 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.

Site contents © 2001 - 2024 (that's right: 2001) Doug Adams and weblished by Doug Adams. Contact support AT dougscripts DOT com. About.
All rights reserved. Privacy.
AppleScript, iTunes, iPod, iPad, and iPhone are registered trademarks of Apple Inc. This site has no direct affiliation with Apple, Inc.
The one who says "it cannot be done" should not be interrupting the one who is doing it.