FROM : Brian Webster
DATE : Thu Jan 17 20:16:03 2002
On Thursday, January 17, 2002, at 12:33 AM, Neal A. Crocker wrote:
> This method occured to me, but it raises some problems, if I
> understand cocoa script support correctly. As far as I
> understand it, if I do this, then cocoa will automatically
> allow script to make new "entries" at any desired postition
> within the array. Perhaps I'm missing something. Perhaps
> cocoa wouldn't allow this if I specify that the "entries"
> property of the dictionary class is readonly in the scriptSuite
> file. Alternatively, may cocoa wouldn't allow it if I failed
> to implement a "setValues" method. My grasp of how applescript
> interacts with cocoa objects is still somewhat hazy.
In my experience, setting the read only attribute in the script
suite will make it show up as read only in the scripting
dictionary in Script Editor, but you can still set the attribute
if the appropriate method is implemented. Also, I don't believe
adding a ReadOnly attribute in the ToManyRelationships
dictionary will have any affect at all.
But anyway, a script will not be able to insert new objects in a
container unless you implement the set<Bars> or
insertValue:in<Bars>: methods for the container object.
>> Alternatively, I think you should also be able to handle
>> get/set commands manually by adding an entry under the
>> SupportedCommands key and specifying a method in your app to
>> handle the commands. I'm not entirely certain what object
>> you'll have to add the method to in order to have it called.
>> It's probably the container object that has the key/value
>> pairs, but I'm not 100% certain.
>>
>> Anyway, once your command handler method is called, you can
>> retrieve the command arguments from the NSScriptCommand object
>> that gets passed to the command handler method. From there,
>> you can look at the NSScriptObjectSpecifiers yourself and
>> return the appropriate value. Also, if a script tries to
>> access something by index, you can use setScriptErrorNumber:
>> and setScriptErrorString: to return an error message.
>
> That has distinct possibilities. I hadn't realized that get
> and set were treated as ordinary events by cocoa.
Yes, there are subclasses of NSScriptCommand for each of the
events in the standard suite (NSGetCommand, NSSetCommand,
NSDeleteCommand, etc.).
--
Brian Webster
<email_removed>
http://homepage.mac.com/bwebster
DATE : Thu Jan 17 20:16:03 2002
On Thursday, January 17, 2002, at 12:33 AM, Neal A. Crocker wrote:
> This method occured to me, but it raises some problems, if I
> understand cocoa script support correctly. As far as I
> understand it, if I do this, then cocoa will automatically
> allow script to make new "entries" at any desired postition
> within the array. Perhaps I'm missing something. Perhaps
> cocoa wouldn't allow this if I specify that the "entries"
> property of the dictionary class is readonly in the scriptSuite
> file. Alternatively, may cocoa wouldn't allow it if I failed
> to implement a "setValues" method. My grasp of how applescript
> interacts with cocoa objects is still somewhat hazy.
In my experience, setting the read only attribute in the script
suite will make it show up as read only in the scripting
dictionary in Script Editor, but you can still set the attribute
if the appropriate method is implemented. Also, I don't believe
adding a ReadOnly attribute in the ToManyRelationships
dictionary will have any affect at all.
But anyway, a script will not be able to insert new objects in a
container unless you implement the set<Bars> or
insertValue:in<Bars>: methods for the container object.
>> Alternatively, I think you should also be able to handle
>> get/set commands manually by adding an entry under the
>> SupportedCommands key and specifying a method in your app to
>> handle the commands. I'm not entirely certain what object
>> you'll have to add the method to in order to have it called.
>> It's probably the container object that has the key/value
>> pairs, but I'm not 100% certain.
>>
>> Anyway, once your command handler method is called, you can
>> retrieve the command arguments from the NSScriptCommand object
>> that gets passed to the command handler method. From there,
>> you can look at the NSScriptObjectSpecifiers yourself and
>> return the appropriate value. Also, if a script tries to
>> access something by index, you can use setScriptErrorNumber:
>> and setScriptErrorString: to return an error message.
>
> That has distinct possibilities. I hadn't realized that get
> and set were treated as ordinary events by cocoa.
Yes, there are subclasses of NSScriptCommand for each of the
events in the standard suite (NSGetCommand, NSSetCommand,
NSDeleteCommand, etc.).
--
Brian Webster
<email_removed>
http://homepage.mac.com/bwebster
| Related mails | Author | Date |
|---|---|---|
| Brian Webster | Jan 16, 18:52 | |
| Neal A. Crocker | Jan 17, 07:33 | |
| Brian Webster | Jan 17, 20:16 |






Cocoa mail archive

