Insert Method

[Microsoft Agent is deprecated as of Windows 7, and may be unavailable in subsequent versions of Windows.]

Description

Inserts a Command object in the Commands collection.

Syntax

agent**.Characters ("CharacterID").Commands.Insert** Name, RefName, Before_

Caption, Voice, Enabled, Visible

Part Description
Name Required. A string value corresponding to the ID you assign to the Command.
RefName Required. A string value corresponding to the name (ID) of the command just above or below where you want to insert the new command.
Before Optional. A Boolean value indicating whether to insert the new command before the command specified by RefName. True (Default). The new command will be inserted before the referenced command.
False The new command will be inserted after the referenced command.
Caption Optional. A string value corresponding to the name that will appear in the character's pop-up menu and in the Commands Window when the client application is input-active. For more information, see the Command object's Captionproperty.
Voice Optional. A string value corresponding to the words or phrase to be used by the speech engine for recognizing this command. For more information on formatting alternatives for the string, see the Command object's Voice property.
Enabled Optional. A Boolean value indicating whether the command is enabled. The default value is True. For more information, see the Command object's Enabled property.
Visible Optional. A Boolean value indicating whether the command is visible in the Commands Window when the client application is input-active. The default value is True. For more information, see the Command object's Visible property.

Remarks

The value of a Command object's Name property must be unique within its Commands collection. You must remove a Command before you can create a new Command with the same Name property setting. Attempting to create a Command with a Name property that already exists raises an error.

This method also returns a Command object. This enables you to declare an object and assign a Command to it when you call the Insert method.

   Dim Cmd2 as IAgentCtlCommandEx
   Set Cmd2 = Genie.Commands.Insert ("my second command", "my first command",_ True, "Test", "Test", True, True)
   Cmd2.VoiceCaption = "this is a test"

See Also

Add method, Remove method, RemoveAll method