beautypg.com

Using the assistant 18, Making behavior available from the assistant 18 – Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 661

background image

C H A P T E R 1 8

Intelligent Assistant

Using the Assistant

18-15

Using the Assistant

18

This section describes how to make an application behavior available through the
Assistant, as well as how to display online help from the Assistant. This material
presumes understanding of the conceptual material provided in previous section.

Making Behavior Available From the Assistant

18

You need to take the following steps to make an application behavior available
through the Assistant:

1. Create an action template for your primary action. If necessary, create additional

action templates that define subtasks of the primary action.

2. Create zero or more target templates. (Some actions require no target; others

may use system-supplied target templates.)

3. Implement your

PostParse

method.

4. Create a task template.

5. Register and unregister your task template with the Assistant at the

appropriate times.

The sections immediately following describe these tasks in detail.

It is recommended that you begin by defining the action and target templates
required to complete the primary action. After doing so, you will have a better idea
of the tasks your

PostParse

method needs to handle. After creating all the

necessary templates and writing a suitable

PostParse

method, defining the task

template itself is likely to be a trivial chore.

Defining Action and Target Templates

18

Action templates and target templates are simply frames that contain a specified set of
slots and values. You need to define templates for all the actions and targets required
to complete a task. One of the action templates must define the primary action.

Take the following steps to define an action template or a target template:

1. Define a frame containing the

value

,

isa

and

lexicon

slots.

2. Assign the frame to a slot or variable that is the name of the template.

3. Place in the

value

slot a string that identifies the action or target that this

template defines.

4. If the template defines an action, place the symbol

'dyna_user_action

in its

isa

slot. If the template defines a target, place the symbol

'dyna_user_obj

in its

isa

slot.