Re: Adding simple AppleScript commands to a Cocoa application
Re: Adding simple AppleScript commands to a Cocoa application
- Subject: Re: Adding simple AppleScript commands to a Cocoa application
- From: Jim Correia <email@hidden>
- Date: Sun, 16 Apr 2006 10:09:11 -0400
On Apr 16, 2006, at 9:46 AM, Robert Nolet wrote:
This all works exactly as I want it to, however I think that
creating a subclass of NSScriptCommand and then accessing my
MyController object by going through the application delegate is an
incredibly sloppy and round-about way of achieving this. Also, if I
were to add more commands, I would have to create a new class for
each command I want to implement. So I am looking for a more
elegant way of linking methods in my MyController class to
AppleScript commands.
There are two ways to implement a script command: object first
dispatch, or verb first dispatch.
<http://developer.apple.com/documentation/Cocoa/Conceptual/
ScriptableCocoaApplications/SApps_script_cmds/chapter_8_section_1.html>
You don't say what MyController is. With object first dispatch, "top-
level" commands are going to be dispatched to NSApplication. If
MyController is your applications controller and NSApplication
delegate, you'll have to forward the commands there either with an
NSApplication category, or by using a subclass of NSApplication.
Jim
_______________________________________________
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