Adds a voice command into the current window. The command is automatically disabled when closing the window. This voice command can be deleted by DeleteVoiceCommand
Note: a speech recognition program must be installed on the runtime computer. A speech recognition program is supplied with Windows Vista. For the other systems, "Dragon Naturally Speaking" must be installed (tests run with version 9 "Preferred" or "standard").
// Starts the "Proc_Anim_Window" procedure if the voice command is recognized
nVoiceID is int
nVoiceID = AddVoiceCommand("Proc_Anim_Window", "Animate the window")
// Starts the "Find" procedure if the voice command is recognized
nVoice1ID is int = AddVoiceCommand("Find", "Finds the form of")
nVoice2ID is int = AddVoiceCommand("Find", "Displays the form of")
nVoice3ID is int = AddVoiceCommand("Find", "Searches for the form of")
sCustomer is string = Param1[[21 to ]]
HReadSeekFirst(sCustomer, FIRSTNAMELASTNAME, sCustomer)
<Result> = AddVoiceCommand(<Procedure Name> , <Sentence to Recognize>)
Identifier of voice command.
<Procedure Name>: Character string (with quotes)
Name of the procedure that will be run when the voice command is heard. This procedure has the following format:
PROCEDURE <Procedure Name> (<Parameter Name>)
<Parameter Name> is a character string parameter. At run time, <Parameter Name> corresponds to the sentence that is recognized.
<Sentence to Recognize>: Character string (with quotes)
Sentence used to trigger the execution of the procedure. If this parameter corresponds to an empty string (""), the specified procedure will be run for each sentence spoken.
If <Sentence to Recognize> corresponds to an empty string (""), the procedure will be run for each sentence pronounced. This enables you to process the sentenced spoken in the procedure in order to recognize the voice command that was used.
You can for example store in an array (associative array for example) all the available voice commands (phonetically) and the procedure associated with each one of these commands.
To do so, pass each word of the sentence phonetically and compare the sentence with the array of voice commands. If the command is recognized, the associated procedure can be run.
To improve the understanding, you also have the ability to delete the unnecessary words found at the beginning and at the end of sentence.
AddVoiceCommand must be used in the initialization code of window or control. This function is not recognized if it is used in the initialization code of project.