You are reading help file online using chmlib.com
|
Object: SpObjectToken
The MatchesAttributes method indicates whether the token matches specified attributes.
SpObjectToken.MatchesAttributes(
Attributes As String
) As Boolean
A Boolean variable. If True, the token matches the specified attributes; if False, it does not match.
The following Visual Basic form code demonstrates the use of the MatchesAttibutes method. To run this code, create a form with the following controls:
Paste this code into the Declarations section of the form.
The Form_Load procedure initializes a new SpObjectTokenCategory object to the voices category, selects all voices into an ISpeechObjectTokens collection, and loads Combo1 with several attribute declarations. These attributes are intentionally irregular with regard to capitalization, spacing and spelling.
The Command1 procedure contains a loop that performs a MatchesAttibutes call on each available voice. The name of each voice and the Boolean result of the MatchesAttibutes method is displayed in the list box.
Option Explicit
Dim C As SpeechLib.SpObjectTokenCategory 'a category of object tokens
Dim E As SpeechLib.ISpeechObjectTokens 'an enumeration of those tokens
Dim T As SpeechLib.SpObjectToken 'one object token
Private Sub Command1_Click()
Dim Vname, Vmatch
List1.Clear
List1.AddItem "Test for voices matching """ & Combo1.text & """"
List1.AddItem ""
For Each T In E
Vname = T.GetDescription
Vmatch = T.MatchesAttributes(Combo1.text)
List1.AddItem " " & Vname & " " & Vmatch
Next
End Sub
Private Sub Form_Load()
Combo1.AddItem "vendor=microsoft"
Combo1.AddItem "gender=female"
Combo1.AddItem "Gender = Male"
Combo1.AddItem "gender!=male"
Combo1.AddItem "name=Microsoft sam"
Combo1.AddItem "Name != microsoft Sam"
Combo1.AddItem "name=MICROSOFT SAM,gender=female" 'no possible matches
Combo1.AddItem "gedner = male" 'no possible matches
Combo1.ListIndex = 0
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
End Sub
You are reading help file online using chmlib.com
|