SpObjectToken Interface (SAPI 5.4)
The SpObjectToken automation object represents an available resource of a type used by SAPI. The default interface for this object is ISpeechObjectTokens.
The Speech configuration database contains folders representing the resources on a computer that are used by SAPI 5.1 or later speech recognition (SR) and text-to-speech (TTS). These folders are organized into resource categories, such as voices, lexicons, and audio input devices. The SpObjectTokenCategory object provides access to a category of resources, and the SpObjectToken object provides access to a single resource.
Several Speech Automation objects support methods that return collections of resources from a specific category of available resources. Examples are SpVoice.GetAudioOutputs, SpVoice.GetVoices and SpSharedRecognizer.GetProfiles, as well as the SpObjectToken object's MatchesAttributes method. Each of these operations returns an ISpeechObjectTokens object variable containing a collection of SpObjectToken objects.
The read-only Id property of an SpObjectToken object is the path to the folder of the resource with which it is associated. The read-only DataKey property is a data key object providing read and write access to this folder. An SpObjectToken created with the New keyword has an empty Id property, and is therefore not associated with a resource. Before it can be used, a new SpObjectToken must be associated with a resource by means of its SetId method.
The SpObjectToken object also provides the ability to create and access storage files associated with a resource. The paths of data storage files created by an engine or by applications for a specific resource are stored in its object token.
See the SpObjectToken Example for a complete example and additional details.
Automation Interface Elements
The SpObjectToken automation interface contains the following elements:
|Category Property||Returns the category of the object token as an SpObjectTokenCategory object.|
|DataKey Property||Returns the data key of the object token as an ISpeechDataKey object.|
|Id Property||Returns the ID of the token.|
|CreateInstance Method||Creates an instance of the object represented by the token.|
|DisplayUI Method||Displays the specified UI.|
|GetAttribute Method||Returns the value of the specified attribute.|
|GetDescription Method||Returns the name of the resource represented by the object token.|
|GetStorageFileName Method||Creates a storage file for data associated with the object token.|
|IsUISupported Method||Determines if the specified UI is supported.|
|MatchesAttributes Method||Indicates whether the token matches specified attributes.|
|Remove Method||Removes the token from the speech configuration database.|
|RemoveStorageFileName Method||Removes a storage file associated with the object token.|
|SetId Method||Associates a new object token with a resource by setting its ID property.|