CHMlib Logo Leading Translation Management System for Translation Agencies, Top Translation Management Software for Freelance Translators, Time Tracking Software, Word Count, Character Count and Line Count Software, Computer Assisted Translation Tool for Easy Word Count, Clipboard Character Count Software, User-Friendly Translation Memory Software, Terminology Management Software, Terminology Management Server, Microsoft Glossary Software, Dictionary of Acronyms, Social Network for Translators and Translation Agencies, Acronyms and Abbreviations Search Engine, Russian Translation Lab, Ukrainian Translation Lab.
You are reading help file online using chmlib.com
CrisisHelper - First Aid in Tough Times of World Economic Crisis


Intelligent Interface Technologies Home Page Microsoft Speech SDK

Speech Automation 5.1

Interface: ISpeechRecoGrammar

CmdLoadFromFile Method


The CmdLoadFromFile method loads a command and control grammar from the specified file.

The grammar may be compiled or uncompiled, and it can be loaded for static or dynamic use, as specified in the LoadOption parameter.


ISpeechRecoGrammar.CmdLoadFromFile(
     FileName As String,
     [LoadOption As SpeechLoadOption = SLOStatic]
)

Parameters

FileName
Specifies the file name. SAPI 5 supports loading of compiled static grammars through a URL.
LoadOption
[Optional] Specifies whether the grammar is to be loaded for static or dynamic use. The default is static.

Return Value

None.


Example

The following Visual Basic form code demonstrates the use of the CmdLoadFromFile and the CmdLoadFromMemory methods. To run this code, create a form with the following control:

  • A command button called Command1
  • Paste this code into the Declarations section of the form.

    The Form_Load procedure creates two grammar objects and uses the CmdLoadFromFile method to load the Solitaire rules into the first grammar. The Command1_Click procedure calls a subroutine called GrammarToMemory, which creates a temporary grammar in a Variant variable, and returns this grammar to the caller. The Command1 procedure then reloads the first grammar with the temporary grammar.


    Option Explicit
    
    Dim C As SpeechLib.SpSharedRecoContext
    Dim G1 As SpeechLib.ISpeechRecoGrammar
    Dim G2 As SpeechLib.ISpeechRecoGrammar
    
    Private Sub Command1_Click()
        Dim GT As Variant               'Temp grammar in Variant variable
        
        GT = GrammarToMemory(G1)         'GT is temp version of grammar G
        
        Call G2.CmdLoadFromMemory(GT, SLOStatic)
    
    End Sub
    
    Private Sub Form_Load()
    
        Set C = New SpSharedRecoContext
        Set G1 = C.CreateGrammar
        Set G2 = C.CreateGrammar
        
        Call G1.CmdLoadFromFile("c:\sol.xml", SLODynamic)
    
    End Sub
    
    Private Function GrammarToMemory(objGRM As SpeechLib.ISpeechRecoGrammar) As Variant
    
        'Make changes to a standard grammar, and save it as temp grammar.
        'Add rules to the grammar, delete rules from the grammar, or other changes here.
    
        'Return the variant from ISpeechGrammarRules.CommitAndSave
        GrammarToMemory = objGRM.Rules.CommitAndSave("")
        
    End Function


    You are reading help file online using chmlib.com

    If you want your help file to be removed or added please send e-mail to chmlibcom@gmail.com
    Partner sites: Logo Design, Simple Anti-Crisis Accounting Software, Voice Search for Web