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

Object: SpObjectToken

Category Property

The Category property returns the category of the object token as an SpObjectTokenCategory object.

If the object token has not been initialized, an attempt to reference this property will generate an SPERR_UNINITIALIZED error.


Syntax

Set: (This property is read-only)
Get: SpObjectTokenCategory = SpObjectToken.Category

Parts

SpObjectToken
The owning object.
SpObjectTokenCategory
Set: (This property is read-only)
Get: An SpObjectTokenCategory object returning the category.

Example

The following Visual Basic form code demonstrates the use of the SpObjectToken's Category and Id properties and its GetDescription method. It also demonstrates the handling of uninitialized object tokens. To run this code, create a form with the following controls:

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

    The Form_Load procedure creates a voice object and a recognizer object. The Command1_Click procedure creates several object tokens and sends them to a subroutine which displays information about them in the list box. The first token sent is a newly-created token with no Category. The subroutine code generates an error when it tries to get the Category property of this token. The other tokens passed to the subroutine are properly initialized, and for each token, the subroutine displays the Description of the token, the ID of the token, and the ID of the token's category.


    Option Explicit
    
    Dim T As SpeechLib.SpObjectToken
    Dim C As SpeechLib.SpObjectTokenCategory
    
    Dim V As SpeechLib.SpVoice
    Dim R As SpeechLib.SpSharedRecognizer
    
    Const SPERR_UNINITIALIZED = &H80045001
    
    Private Sub Command1_Click()
    
        List1.Clear
    
        'Create new token -- uninitialized
        Set T = New SpObjectToken
        Call TokenInfo("new token", T)
        
        'Voice object furnishes Voice tokens and AudioOutput tokens
        Set T = V.GetVoices().Item(0)
        Call TokenInfo("voice token", T)
        
        Set T = V.GetAudioOutputs().Item(0)
        Call TokenInfo("audioout token", T)
        
        'Recognizer object furnishes recognizer tokens and AudioInput tokens
        Set T = R.GetRecognizers().Item(0)
        Call TokenInfo("recognizer token", T)
        
        Set T = R.GetAudioInputs().Item(0)
        Call TokenInfo("audioin token", T)
    
    End Sub
    
    Private Sub TokenInfo(text, token As SpObjectToken)
        
        On Error GoTo TokenInfoExit
        List1.AddItem text
        Set C = token.Category
        
    TokenInfoExit:
        Select Case Err.Number
        
        Case 0
            List1.AddItem "  Token.GetDescription:"
            List1.AddItem "    " & token.GetDescription
            List1.AddItem "  Token.Category.Id:"
            List1.AddItem "    " & token.Category.Id
            List1.AddItem "  Token.Id:"
            List1.AddItem "    " & token.Id
            
        Case SPERR_UNINITIALIZED
            List1.AddItem "   SPERR_UNINITIALIZED"
            
        End Select
        List1.AddItem ""
    
    End Sub
    
    Private Sub Form_Load()
        'Voice object furnishes Voice tokens and AudioOutput tokens
        'Recognizer object furnishes recognizer tokens and AudioInput tokens
        Set V = New SpVoice
        Set R = New SpSharedRecognizer
    End Sub


    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