# OnScriptCommand

The **OnScriptCommand** event is the entry point for an [internal command](https://chaoses-ib.gitbook.io/directory-opus/manual/scripting/example_scripts/adding_a_new_internal_command) added by a [script add-in](https://chaoses-ib.gitbook.io/directory-opus/manual/scripting/script_add-ins). The actual name of the event is defined by the script itself, when the command is added via the [**ScriptInitData**](https://chaoses-ib.gitbook.io/directory-opus/manual/reference/scripting_reference/scripting_objects/scriptinitdata)**.AddCommand** method - **OnScriptCommand** is merely a placeholder name.

| **Method Name:**   | OnScriptCommand                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Argument Type:** | [**ScriptCommandData**](https://chaoses-ib.gitbook.io/directory-opus/manual/reference/scripting_reference/scripting_objects/scriptcommanddata)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| **Return Type:**   | *bool*                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| **Description:**   | <p>When a script add-in adds a new internal command using <strong>ScriptInitData.AddCommand</strong>, it specifies the name of its entry point with the <strong>ScriptCommand.method</strong> property. When the internal command is run, Opus will call that method within your script.<br>The <strong>ScriptCommandData.func</strong> property provides information about the command environment (including any parsed arguments), and the <strong>cmdline</strong> property provides the raw command line that invoked your command.<br>If this event returns <strong>True</strong> the function will be aborted - you might do this if an error occurs and the user chooses to abort the operation.</p> |
