• 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: [cocoa scripting] default sub container
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cocoa scripting] default sub container


  • Subject: Re: [cocoa scripting] default sub container
  • From: Bill Cheeseman <email@hidden>
  • Date: Mon, 05 Sep 2005 17:47:35 -0400

on 2005-09-05 12:49 PM, Ken Victor at email@hidden wrote:

> i (think i) would like to be able to write scripts more like:
>
> tell application "myApp"
> <commands>
> end tell
>
> ie, not need to specify the document, and if there is only one
> document, then pass along the commands to that document; but if there
> is more than one document open, then return an appropriate error.
>
> 2 questions:
>
> 1) is this possible?
> 2) and if this is possible, is it a good idea?

1. Is it possible? Yes, as I understand it, if you're using old-style
*.scriptSuite files and their "DefaultSubcontainerAttribute" entry. See the
NSScriptClassDescription documentation and the Mac OS X 10.2 Cocoa Scripting
release notes.

But I'm not sure how this is handled for sdef-based applications. The sdef
man page refers to "implied containers" in connection with the 'contents'
property, but it doesn't quite say whether this is only built into certain
classes or how you would implement it in custom classes. I plan to look into
it in detail shortly, perhaps by implementing an explicit 'contents'
property.

NSScriptClassDescription has a -defaultSubcontainerAttribute method, but no
corresponding -setDefaultSubcontainerAttribute: method.

2. It doesn't strike me as a good idea in the case you describe. Mostly
because scripters are used to providing an explicit document reference in
all cases. I think the default subcontainer mechanism is more suited to the
kinds of situations that are less familiar or more natural, like the 'word 1
of document' vs. 'word 1 of text of document' example given in the
documentation.

--

Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com

PreFab Software - http://www.prefab.com/scripting.html
The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com
Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >[cocoa scripting] default sub container (From: Ken Victor <email@hidden>)

  • Prev by Date: Re: [cocoa scripting] getting script class attribute name
  • Next by Date: Re: NSArrayController / NSTableView questions
  • Previous by thread: Re: [cocoa scripting] default sub container
  • Next by thread: Beta Testers needed
  • Index(es):
    • Date
    • Thread