Figure 4 Parsing Speech
Private Sub DirectSR1_PhraseFinish(ByVal flags As Long, ByVal beginhi As Long, _
ByVal beginlo As Long, ByVal endhi As Long, ByVal endlo As Long, _
ByVal Phrase As String, ByVal parsed As String, ByVal results As Long)
Rem If we got a null match, then the speaker needs to retry
If (parsed = "") Then
MsgBox "Not a recognized command, please retry", vbOKOnly, _
"Command Errors"
Else
Rem We heard something we should understand...
Select Case parsed
Case "submit"
ctrlSubmit_Click
Case "show SQL"
btnShowSQL_Click
Case "close"
SendKeys "%{F4}", False
Case "exit"
btnExit_Click
Case "most"
ctrlQuestion.SelText = "which patient has the most orders"
ctrlSubmit_Click
Case Else
Dim Result As Boolean
Result = Phrase Like "*orders for patient*"
If Result Then
ctrlQuestion.SelText = "orders for patient " & parsed
ctrlSubmit_Click
End If
End Select
End If
End Sub