## CommandCollection.Item

### Description

Returns the Command corresponding to the specified index (0-based) or key.

### C# Syntax

    // get accessor
    Command CommandCollection.get_Item( Object idx );

### Parameters

Parameter | Type | Description
--- | --- | ---
Key | Long or String | Index or name of the command to retrieve. Note: This method expects the true command name (see SIObject.Name), not the Command.ScriptingName. Note: Avoid using numerical indexes as they can change from computer to computer as users create custom commands.

### Examples

#### VBScript Example

    ' Display information about a command
    SUB ShowCommand( ByRef oCommand )
    logmessage "--------------------------------"
    logmessage "Name: " & oCommand.Name
    logmessage "FileName: " & oCommand.FileName
    logmessage "Handler: " & oCommand.Handler
    logmessage "Language: " & oCommand.language
    logmessage "Type: " & oCommand.type
    END SUB
    set oCommands = Application.Commands
    ' get the first command
    set oFoundCommand = oCommands.Item( 0 )
    ShowCommand oFoundCommand
    ' find the same command using its name
    set oCommandByName = oCommands.Item( oFoundCommand.Name )
    ShowCommand oCommandByName

### See Also

Command Application XSIApplication.GetCommandByScriptingName