You are reading help file online using chmlib.com
|
Object: SpObjectTokenCategory
The EnumerateTokens method returns a selection of SpObjectToken objects.
Selection criteria may be applied optionally.
SpObjectTokenCategory.EnumerateTokens(
[RequiredAttributes As String = ""],
[OptionalAttributes As String = ""]
) As ISpeechObjectTokens
The EnumerateTokens method returns an ISpeechObjectTokens variable.
The following Visual Basic form code demonstrates a simple use of the EnumerateTokens method. To run this code, create a form with the following controls:
Paste this code into the Declarations section of the form.
The Command1 procedure creates an SpVoice object, and uses the voice's GetVoices method to get an ISpeechObjectTokens collection containing an object token for each voice on the computer. A "For Each" loop lists each voice token's Description property in the list box.
The Command2 procedure creates a new SpObjectTokenCategory object, uses the SetId method to associate it with the category of voices, and the EnumerateTokens method to get an ISpeechObjectTokens collection containing an object token for each voice on the computer. A "For Each" loop lists each voice token's Description property in the list box.
The list of voices displayed by the two command buttons will be identical.
Option Explicit
Dim V As SpeechLib.SpVoice 'voice object
Dim T As SpeechLib.SpObjectToken 'object token
Dim E As SpeechLib.ISpeechObjectTokens 'an enumeration of object tokens
Dim C As SpeechLib.SpObjectTokenCategory 'a category of object tokens
Private Sub Command1_Click()
List1.Clear
List1.AddItem "Enumerate voices with SpVoice.GetVoices"
List1.AddItem ""
Set V = New SpVoice 'create new voice
Set E = V.GetVoices() 'no parameters -- get all voices
For Each T In E
List1.AddItem " " & T.GetDescription
Next
End Sub
Private Sub Command2_Click()
List1.Clear
List1.AddItem "Enumerate voices with SpObjectToken.EnumerateTokens"
List1.AddItem ""
Set C = New SpObjectTokenCategory 'create new token category object
C.SetId SpeechCategoryVoices 'init ID of voices category
Set E = C.EnumerateTokens() 'no parameters -- get all voices
For Each T In E
List1.AddItem " " & T.GetDescription
Next
End Sub
You are reading help file online using chmlib.com
|