• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How do you add a track not currently in iTunes to iTunes playlist using applescript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do you add a track not currently in iTunes to iTunes playlist using applescript


  • Subject: Re: How do you add a track not currently in iTunes to iTunes playlist using applescript
  • From: has <email@hidden>
  • Date: Fri, 11 Jan 2008 17:05:07 +0000

On 11 Jan 2008, at 15:47, Gary (Lists) wrote:

[1] According to iTunes' dictionary, its 'add' command actually
requires a list of alias objects. However, iTunes is smart enough that
if you pass it a POSIX file object, it will automatically coerce it to
the right type for you.

Hmm.

Calling that "smart", without any quotes or other decipherable sarcasm,
suggests that you approve of AS hiding something from the user. ;)

iTunes' behaviour here is completely in keeping with good scripting interface design guidelines.


When unpacking a command's parameters, it's correct practice for the application to tell the Apple Event Manager what type of value it requires; it's then up to the AEM to check the supplied value's type and, if it's different, coerce it to the desired type if possible.

Also, the great majority of applications already follow this rule. It's the applications that do all their own type-checking of command parameters and complain if you don't pass them _exactly_ the right type that are the exception, and an annoyance to work with.


Now, you can argue the virtues and vices of weak-vs-strong typing till the cows come home, but that's really a separate debate. As far as application scripting is concerned, the decision has already been made and it's up to applications to abide by it since that's what users expect.


One complain you certainly can make, however, is that the documentation describing the supported coercions could be a bit more obvious. Last I recall, it was buried down in some appendix of the ASLG and somewhat out of date. Then again, 'needs better documentation' is a criticism that can be levelled at various aspects of AppleScript and pretty much all application scripting in general. :p

has
--
http://appscript.sourceforge.net
http://rb-appscript.rubyforge.org

_______________________________________________
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
References: 
 >Re: How do you add a track not currently in iTunes to iTunes playlist using applescript (From: "Gary (Lists)" <email@hidden>)

  • Prev by Date: Re: Name of file
  • Next by Date: Re: underscore and splitting words from string...
  • Previous by thread: Re: How do you add a track not currently in iTunes to iTunes playlist using applescript
  • Next by thread: file sorting via applescript?
  • Index(es):
    • Date
    • Thread