RunCommand Method (IApplication)

RunCommand Method (IApplication) | Send Feedback
See Also Example

Errors[out]
  Status of running the command as defined in dsRunCommandError_e

CommandString
  Name of command to run (see Remarks)

HideCommandTitle
  True to hide the command in the command window, false to show the command in the command window

Runs the specified command.

# Syntax

Visual Basic |
--- | ---
    Function RunCommand( _
       ByVal CommandString As System.String, _
       ByVal HideCommandTitle As System.Boolean _
    ) As dsRunCommandError_e

C# |
--- | ---
    dsRunCommandError_e RunCommand(
       System.string CommandString,
       System.bool HideCommandTitle
    )

JavaScript |
--- | ---
    RunCommand(
       CommandString : String,
       HideCommandTitle : Boolean
    ) : String

COM native C++ |
--- | ---
    HRESULT RunCommand(
       BSTR CommandString,
       VARIANT_BOOL HideCommandTitle,
       dsRunCommandError_e* Errors
    )

C++ |
--- | ---
    DSRESULT RunCommand(
       const dsString& CommandString,
       bool HideCommandTitle,
       dsRunCommandError_e* Errors
    )

#### Parameters

CommandString
  Name of command to run (see Remarks)
HideCommandTitle
  True to hide the command in the command window, false to show the command in the command window
Errors[out] or Return Value
  Status of running the command as defined in dsRunCommandError_e

# Example

Insert Splines (C#)
Insert Splines (VB.NET)
Insert Splines (VBA)

# Remarks

Depending on the programming language that you use, either:

- append \n to the command
  - or -

- include & Chr(10) after the command
  These control strings emulate a user pressing the Enter key in DraftSight. The number of control strings should correspond to the number of times a user is required to press the Enter key for the command in DraftSight.

For example:

To delete all entities in a drawing in this programming language... | Call...
C# | int state; state = (int)dsApp.RunCommand("DELETE ALL\n\n", false);
VB.NET | Dim state as Integer; state = dsApp.RunCommand("DELETE ALL" & Chr(10) & Chr(10), False)
VBA | Dim state as Long; state = dsApp.RunCommand("DELETE ALL" & Chr(10) & Chr(10), False)

# See Also

####

IApplication Interface
IApplication Members
IApplication::AbortRunningCommand Method
IApplication::CreateCommand Method
IApplication::GetRunningCommand Method
ICommand Interface
ICommand Event ExecuteNotify
ICommandMessage::GetLastError Method
ICommand::LastError Property
IApplication Event CommandCancelNotify
IApplication Event CommandPostNotify
IApplication Events CommandPreNotify

# Availability

DraftSight V1R1