XSIApplication.GetCommandByScriptingName

Introduced

v5.0

Description

Finds a built-in or custom command by its scripting name.

C# Syntax

Command XSIApplication.GetCommandByScriptingName( String in_strScriptingName );

Scripting Syntax

oReturn = XSIApplication.GetCommandByScriptingName( ScriptingName );

Return Value

Command

Parameters

Parameter Type Description
ScriptingName String The scripting name of the command you want to find.

Examples

1. JScript Example

// JScript example that shows how to find a command by its scripting name
var oCmd = Application.GetCommandByScriptingName( "GetMarking" )
Application.LogMessage( "Command Name: \"" + oCmd.Name + "\", Command Scripting Name: \"" + oCmd.ScriptingName + "\"" ) ;
// Test if a command with a given scripting name exists
oCmd = Application.GetCommandByScriptingName( "CommandThatDoesNotExist" )
if ( oCmd == null )
{
	Application.LogMessage( "Command \"CommandThatDoesNotExist\" is not installed" ) ;
} 
//Expected output:
//INFO : Command Name: "Get Marked Parameters", Command Scripting Name: "GetMarking"
//INFO : Command "CommandThatDoesNotExist" is not installed

2. VBScript Example

' VBScript example that shows how to find a command by its scripting name
set oCmd = Application.GetCommandByScriptingName( "GetMarking" )
Application.LogMessage( "Command Name: """ & oCmd.Name & """, Command Scripting Name: """ & oCmd.ScriptingName & """" ) 
' Test if a command with a given scripting name exists
set oCmd = Application.GetCommandByScriptingName( "CommandThatDoesNotExist" )
if typename( oCmd ) = "Nothing" then
	Application.LogMessage( "Command ""CommandThatDoesNotExist"" is not installed" )
end if 
'Expected output:
'INFO : Command Name: "Get Marked Parameters", Command Scripting Name: "GetMarking"
'INFO : Command "CommandThatDoesNotExist" is not installed

See Also

Command.ScriptingName CommandCollection.Item