Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
![]() |
Deactivates a grammar element or one of its rules.
listen.Deactivate(grammarName, ruleName)
Remarks
The Deactivate method must be called before recognition begins. If the Deactivate method is called after a recognition begins, it will have no effect until the recognition is restarted. If the grammar rule does not exist, Deactivate has no effect. If all the top-level rules are deactivated, the grammar element is considered deactivated.
Parameters
- grammarName
Required. Name of the grammar to be deactivated. - ruleName
Optional. Name of the top-level rule to be deactivated. If ruleName is not specified, all top-level rules in grammarName are deactivated.
Example
The following code demonstrates activating and deactivating rules of a grammar within a listen element.
<html xmlns:salt="http://www.saltforum.org/2002/SALT">
<body onload="p1.start()">
<prompt id="p1" oncomplete="StartReco()" bargeIn="false">
What time would you like to travel today?
</prompt>
<listen id="r1" onreco="VerifyResult()" >
<grammar name="g1" src="./time.grxml" />
<grammar name="g2" src="./commands.grxml" />
<grammar name="g3" src="./servicejump.grxml" />
<grammar name="g4" src="./correctdate.grxml" />
</listen>
<script language="JScript">
<!--
function StartReco() {
// Deactivate service jumps, and activate HELP global command only
r1.Deactivate("g3");
r1.Deactivate("g2");
r1.Activate("g2", "help");
r1.Start();
}
-->
</script>
</body>
<html>
.jpg)