Providing Options for Users

  Microsoft Speech Technologies Homepage

Users of a voice-only application should be able to exit the current dialog, ask for help, and issue other commands that are not part of the current question and answer dialog. Use Command controls to enable users to issue these commands.

Command controls share scope with other Dialog Speech Controls or Application Speech Controls, which means that a Command control's grammars are active for every Dialog Speech Control or Application Speech Control in that scope.

Grammars that define command words or phrases are typically separate from grammars that define the words or phrases associated with regular question and answer dialogs. Command grammars define words and phrases such as "Help," "Exit," and "Main Menu."

Associate command grammars with a Command control, and associate the Command control with a Dialog Speech Control or Application Speech Control.

To associate a speech or DTMF command grammar with a Command control

  1. From the Speech Toolbox, drag a Command control onto the design canvas of an .aspx page.
  2. Right-click the Command control, and on the shortcut menu, click Property Builder to open the General panel of the Command Property Builder.
  3. In the tree view pane on the left, under the Input heading, click General.
  4. Associate a new grammar file, a new inline grammar, or an existing grammar file with the Command control, just as with a QA control.

To associate a Command control with a Dialog Speech Control or Application Speech Control

  1. From the Speech Toolbox, drag a Command control onto the design canvas of an .aspx page.

  2. Right-click the Command control, and on the shortcut menu, click Property Builder to open the General panel of the Command Property Builder.

  3. In the Scope box, type or select the ID of the control with which this Command control will share scope.

    Note  To specify that the Command control shares scope with multiple controls, place the relevant controls within a Panel Web Form control on a page, and on the Scope box, type or select the ID of the Panel control.

When a Command control shares scope with another control that is active, the grammar associated with the Command control is also active. Users can issue commands during the question and answer cycle defined by the other control, and activate the grammar associated with the Command control.

When a Command shares scope with an Application Speech Control, and the user says the command Help, the Help prompt played back to the user depends on whether the Command contains a prompt.

  • If the Command contains a prompt, that prompt will be played when a user says Help, instead of the default prompt that is contained in the Application Speech Control.
  • If the Command does not contain a prompt, the default prompt of the Application Speech Control will be played when the user says Help.

To create a custom Help Command

  1. Right-click a Command control, and on the shortcut menu, click Property Builder to open the General panel of the Command Property Builder.
  2. In the Scope box, type or select the ID of the Application Speech Control with which this Command will share scope.
  3. In the Type text box, type Help.
  4. In the tree view pane on the left, under the Voice Output heading, click General.
  5. Type an inline prompt or specify a prompt function, just as with a QA.

For more information regarding the General panel of the Command Property Builder, click Help.

To test words, phrases, or keypresses against a speech or DTMF command grammar

  1. Right-click a Command control on an .aspx page, and on the shortcut menu, click Property Builder to open the General panel of the Command Property Builder.
  2. In the tree view pane on the left, under the Input heading, click General, and then do one of the following.
    • To test against a speech grammar, click the Grammar tab, and then click XPathTrigger Sample Sentence Tool to expand the XPathTrigger Sample Sentence tool for the speech grammar.
    • To test against a DTMF grammar, click the DTMF tab, and then click XPathTrigger Sample Sentence Tool to expand the XPathTrigger Sample Sentence tool for the DTMF grammar.
  3. The remainder of the steps mirror those listed in To test words, phrases, or keypresses against a speech or DTMF grammar.

To specify general input Command control properties

  1. Right-click a Command control on an .aspx page, and on the shortcut menu, click Property Builder to open the General panel of the Command Property Builder.
  2. In the tree view pane on the left, under the Input heading, click General, and then do any or all of the following.
    • In the XPathTrigger box, type or select the XPath expression that semantically identifies the Command control in the SML document.
    • In the OnClientCommand text box, type the name of a client-side function called when the Triggered event is raised.
    • Select AutoPostBack if the Command control should post back to the server after each user interaction.
    • If AutoPostBack is selected, on the Triggered box, type or select the name of the event handler for the Triggered event.

To associate inline prompts with a Command control

  1. Right-click a Command control on an .aspx page, and on the shortcut menu, click Property Builder. This action opens the General panel of the Command Property Builder.
  2. In the tree view pane on the left, under the Output heading, click General. The remainder of the steps mirror those listed in To associate inline prompts with a QA control.

To associate prompt functions with a Command control

  1. Right-click a Command control on an .aspx page, and on the shortcut menu, click Property Builder to open the General panel of the Command Property Builder.
  2. In the tree view pane on the left, under the Output heading, click General. The remainder of the steps mirror those listed in To associate prompt functions with a QA control.

For an example of how to use global commands such as "Help", "Repeat", and "Main Menu", and how to implement context-sensitive help, see the Global Commands plus Context Sensitive Help sample included in the SASDK.

See Also

Creating Speech-Enabled Web Pages | Designing Dialogue Flow | Dialogue Organization