Overview
Sometimes an application can accomplish something for which none of the default commands suffice: "Fax" for example, or "Collate." If you want that specialized behavior to be scriptable, you must define and implement a script command for it.
What You Must Do
-
Define the command in the Command Description section of the suite definition; the information you must supply is return type, arguments, and command class (as well as associated Apple event codes).
-
Add terminology information for the command to the suite terminology.
-
For each class that you want to send the command to, specify the command in the Supported Commands section of the appropriate class description.
For the procedures related to steps 1 through 3, see "
Creating Suite Definitions and Suite Terminologies
."
-
If you want a default implementation for the command that is based on key-value coding, make a subclass of NSScriptCommand and override
performDefaultImplementation
.
-
If you want a scriptable class to handle the command, define and implement a method for it (see "
Command Handlers
" for details). Make sure to specify this method in the Supported Commands section for the class implementing the method.
You must complete either step 4 or step 5, and you can complete both steps.