|[Visual Basic .NET]|
Public Function ExecuteCommand( _ ByVal Command As String _ ) As IAgExecCmdResult
- 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.
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.
|The name of a particular command (e.g., Load).|
|The object (e.g.,
||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
*) so that the is
*. For example, you could type
Scenario/* for Scenario/stkDemo, where
refers to the scenario loaded.
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.
Catch ex As System.Runtime.InteropServices.COMException
MsgBox("The command failed: " & ex.ErrorCode & " [" & ex.Message & "]")
|[Visual Basic .NET]||Copy Code|