[Visual Basic .NET] |
---|
Public Function ExecuteCommand( _ ByVal Command As String _ ) As IAgExecCmdResult |
[C#] |
---|
public IAgExecCmdResult ExecuteCommand( string Command ); |
[Managed C++] |
---|
public: IAgExecCmdResult^ ExecuteCommand( String __gc ^ Command ); |
[Java] |
---|
public IAgExecCmdResult executeCommand( String Command ); |
[Unmanaged C++] |
---|
public: HRESULT ExecuteCommand( BSTR Command, IAgExecCmdResult ** ppExecCmdRes ); |
- Command
- Connect command to execute. For instance: "New / Scenario Scenario1".
If the command succeeds, a collection of strings (AgExecCmdResult object) is returned.
If the command fails, an automation exception is raised (error code: 0x80040002, text: "Command Failed").
Following is a brief description of the basic format for data sent to and from Connect. Syntax for each command is explained briefly. Syntax specifies the order in which you must generate a Connect command as well as any parameters and switches associated with the command.
Input Command Format to Connect
Commands sent to Connect use the following format:
<CommandName> <ObjectPath> [<CommandData>]
NOTE: Although the <CommandName>
field isn't case sensitive, the <ObjectPath>
is. <CommandData>
may or may not be case sensitive.
where:
Syntax | Description |
<CommandName> |
The name of a particular command (e.g., Load). |
<ObjectPath> |
The object (e.g., Scenario/stkDemo/Satellite/Shuttle ) to which the <CommandName> directs action. |
[<CommandData>] |
<CommandData> fields modify a <CommandName> and may or may not be required. Please refer to the format of the individual commands for additional information. |
NOTE: Since only one scenario can be open at any given time in STK, you can substitute the scenario name with a wildcard (*
) so that the <ObjectPath>
is Scenario/*
or just *
. For example, you could type Scenario/*
for Scenario/stkDemo, where *
refers to the scenario loaded.
Output
If the command succeeds, the return value contains the list of strings.
If the command fails, a COM exception is raised (error code: 0x80040002, text: "Command Failed"). To implement error processing you need to handle this exception. This varies from language to language:
- in the .NET languages you need to catch an exception of type System.Runtime.InteropServices.COMException.
Try
Me.AxAgUiAxVOCntrl1.Application.ExecuteCommand("Bad command")
Catch ex As System.Runtime.InteropServices.COMException
MsgBox("The command failed: " & ex.ErrorCode & " [" & ex.Message & "]")
End Try
[Visual Basic .NET] | ||
---|---|---|
|