| [Visual Basic .NET] |
|---|
Public Function ExecuteCommand( _ ByVal Command As String _ ) As IAgExecCmdResult |
| [C#] |
|---|
public IAgExecCmdResult ExecuteCommand( |
| [Managed C++] |
|---|
public: IAgExecCmdResult^ ExecuteCommand( |
| [Java] |
|---|
public IAgExecCmdResult executeCommand( |
| [Unmanaged C++] |
|---|
public: HRESULT ExecuteCommand( |
- 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:
[ ]
NOTE: Although the field isn't case sensitive, the is. may or may not be case sensitive.
where:
| Syntax | Description |
| The name of a particular command (e.g., Load). |
| The object (e.g., Scenario/stkDemo/Satellite/Shuttle) to which the directs action. |
[ | fields modify a 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 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] | Copy Code | |
|---|---|---|
| ||
