Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How should the "open" command work?



On Sep 12, 2006, at 8:56 AM, David Hoerl wrote:

TN2106 says the "open" command should open a file, or a list of files:


open file | list of files -- Returns a specifier to the created application object.

Opens the specified files, and returns the new application objects for them - probably documents. The standard version is designed for opening document files, but applications may apply open to other objects and add additional parameters.



Now, this seems a bit confusing - that the object would be either one item, or a list, when it could easily be a list with one item in it. Clearly this confusion has percolated into Cocoa code that handles this event.

I'm curious as to opinions on how this event really should be defined.

That definition is correct. (Of course, I'm biased, since I wrote it.) I suspect you're confusing the client side with the implementation side -- that definition is how it should appear to the client, that is, someone writing a script. (Remember, the title of TN2106 is "Scripting *Interface* Guidelines".) A scripter may write 'open x', or 'open {x, y, z}'. It is allowed (though slightly silly) to write 'open {x}'. The standard definition used to say "open file", but then no one could figure out that you could in fact open more than one file in the same command.


Now, if what you're complaining about is that on the implementation side it's sort of bogus to make you check for either a bare object or an NSArray, since you could have just converted the bare object to an NSArray with one object in it, then that's a different problem. Is that in fact your problem?


--Chris Nebel AppleScript Engineering

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-implementors mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-implementors/email@hidden

This email sent to email@hidden
References: 
 >How should the "open" command work? (From: David Hoerl <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.