Re: AppleScript bug/change/feature in iTunes 7.7.1?
Re: AppleScript bug/change/feature in iTunes 7.7.1?
- Subject: Re: AppleScript bug/change/feature in iTunes 7.7.1?
- From: Matt Neuburg <email@hidden>
- Date: Sat, 02 Aug 2008 08:33:54 -0700
- Thread-topic: AppleScript bug/change/feature in iTunes 7.7.1?
On Thu, 31 Jul 2008 15:03:49 -0400, Doug Adams <email@hidden> said:
>Hello,
>
>I think I have found a rather unusual AppleScript bug (or perhaps
>feature; one never knows) in iTunes 7.7.1. It effects several scripts
>that may need to reference a track using a persistent ID. When
>attempting to reference a single track with a whose clause, the track
>reference is returned coerced as a list. This requires that an
>additional step be taken to extricate the single item (the track
>reference) from the list.
AppleScript's behavior has always been maddening in this regard; for
example, there are lots of things you can ask the Finder where you don't
know in advance whether you'll get back a single thing or a list, depending
on whether a single thing or multiple things are being returned. Therefore
it quite common to coerce the returned value to a list. This guarantees that
it is a list whether or not it was one to start with (coercing a list to a
list has no effect, and coercing a single loose thing to a list turns it to
a list of one item). Now it is possible to proceed with absolute
consistency; you can inquire how many items the list has, etc.
So I would say (1) what you're describing is actually correct behavior - it
is much more consistent and helpful if the result of a whose inquiry is a
list, regardless of how many items there are - and (2) you should have been
using the "as list" trick all along anyway. m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
One of the 2007 MacTech Top 25: <http://tinyurl.com/2rh4pf>
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden