Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Simple Prompt Example (SALT Reference; Speech Application SDK)

Simple Prompt Example

Speech Server 2004 R2
  Microsoft Speech Technologies Homepage

The following example demonstrates how to control a prompt element using its various methods.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns:salt="http://www.saltforum.org/2002/SALT">
  <head>
    <object id="Speechtags" CLASSID="clsid:DCF68E5B-84A1-4047-98A4-0A72276D19CC" VIEWASTEXT></object>
  </head>
    
  <body>
    <?import namespace="salt" implementation="#Speechtags" />
    <salt:prompt id="Prompt1">

      This is a very long prompt. While this prompt is playing, please
      click the buttons to pause and resume the playing of this prompt.

    </salt:prompt>

    <input type="button" name="BtnStart" value="Start Prompt" OnClick="StartPrompt()" id="StartBtn">
    <input type="button" name="BtnPause" value="Pause Prompt" OnClick="PausePrompt()" id="PauseBtn">
    <input type="button" name="BtnResume" value="Resume Prompt" OnClick="ResumePrompt()" id="ResumeBtn">
    <input type="button" name="BtnStop" id="StopBtn" value="Stop Prompt" onClick="StopPrompt()">
    <br><br>
   <b> Prompt Action:</b> <input type="text" name="Status" id="ProgressTxt">
 
    <script language="JScript">
    <!--

      var statusFlag=0;
      // 0 = Initial State
      // 1 = prompt in-progress
      // 2 = prompt paused
           
      function StartPrompt() {
        if (statusFlag == 0) {
          ProgressTxt.value="Prompt started...";
          Prompt1.Start();
          statusFlag=1;
        }
      }

      function PausePrompt() {
        if (statusFlag == 1) {
          ProgressTxt.value="Prompt paused...";      
          Prompt1.Pause();
          statusFlag=2;
        }
      }

      function ResumePrompt() {
        if (statusFlag == 2) {
          ProgressTxt.value="Prompt resumed..."; 
          Prompt1.Resume();
          statusFlag=1          
        }  
      }
      
      function StopPrompt() {
        if(statusFlag > 0) {
          ProgressTxt.value="Prompt stopped...";
          Prompt1.Stop();
          statusFlag = 0;   
        }     
      }      
    -->
    </script>
  </body>
</html>

See Also

prompt Element

Show:
© 2015 Microsoft