> For the complete documentation index, see [llms.txt](https://chaoses-ib.gitbook.io/directory-opus/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://chaoses-ib.gitbook.io/directory-opus/manual/reference/scripting_reference/scripting_objects/scriptcommand.md).

# ScriptCommand

In a script's [**OnInit**](/directory-opus/manual/reference/scripting_reference/scripting_events/oninit.md) method it can call the [**ScriptInitData**](/directory-opus/manual/reference/scripting_reference/scripting_objects/scriptinitdata.md)**.AddCommand** method to [add commands](/directory-opus/manual/scripting/example_scripts/adding_a_new_internal_command.md) to the Opus internal command set. Each call to **AddCommand** returns a **ScriptCommand** object that the script needs to initialize.

| Property Name | Return Type                                                                                                                   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ------------- | ----------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| desc          | *string*                                                                                                                      | Use this to set a description for the command, that is displayed in the [Customize](/directory-opus/manual/customize.md) dialog when the user selects the command from the [Commands tab](/directory-opus/manual/customize/the_customize_dialog/commands.md).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| fayt          | *object:*[**ScriptFAYTCommand**](/directory-opus/manual/reference/scripting_reference/scripting_objects/scriptfaytcommand.md) | Returns a [**ScriptFAYTCommand**](/directory-opus/manual/reference/scripting_reference/scripting_objects/scriptfaytcommand.md) object that you can use to initialise this command to [extend the FAYT field](/directory-opus/manual/scripting/example_scripts/extending_the_fayt.md).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| hide          | *bool*                                                                                                                        | Set to **True** to hide this command from the drop-down command list shown in the [command editor](/directory-opus/manual/customize/creating_your_own_buttons/command_editor.md). This lets you add commands that can still be used in buttons and hotkeys but won't clutter up the command list.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| icon          | *string*                                                                                                                      | Use this property to assign a default icon to this command. You can specify the name of an internal icon (if you want to specify an icon from a particular set, use *setname:iconname -* use this if you have bundled your script in a [script package](/directory-opus/manual/scripting/script_add-ins/script_package.md) with its own icon set) or the path of an external icon or image file.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| label         | *string*                                                                                                                      | <p>Use this to set a label for the command. This is displayed in the <a href="/directory-opus/manual/customize/the_customize_dialog/commands.md">Commands tab</a> of the <a href="/directory-opus/manual/customize.md">Customize</a> dialog (under the <em>Script Commands</em> category), and will form the default label of the button created if the user drags that command out to a toolbar.</p><p>The actual name of the command (used to invoke the command) is assigned through the <strong>name</strong> property.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| method        | *string*                                                                                                                      | <p>This is the name of the method that Opus will call in your script when the command is invoked. This would typically be set to <em>OnXXXXX</em> where <em>XXXXX</em> is the name of the command, however any method name can be used.</p><p>When the method is invoked it is passed a single argument, a <a href="/directory-opus/manual/reference/scripting_reference/scripting_objects/scriptcommanddata.md"><strong>ScriptCommandData</strong></a> object. Generically this method is referred to as <a href="/directory-opus/manual/reference/scripting_reference/scripting_events/onscriptcommand.md"><strong>OnScriptCommand</strong></a>.</p>                                                                                                                                                                                                                                                                                                                                                                                                        |
| name          | *string*                                                                                                                      | This is the name of the command. This determines the name that will invoke the command when it is used in buttons and hotkeys.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| noprogress    | *bool*                                                                                                                        | Set to false if you don't want your command to display a progress indicator if more than one file is selected.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| template      | *string*                                                                                                                      | <p>This lets you specify an optional command line template for the command. This is a string in the form <em>ARGNAME1/MOD,ARGNAME2/MOD,ARGNAME3/MOD</em>, etc, where ARGNAME is the name of the argument and /MOD are one or more <a href="/directory-opus/manual/reference/command_reference/argument_types.md">modifiers used to indicate the argument type</a>. The command line template can specify as many arguments as needed.</p><p>When your command is invoked and its \*\*<a href="/directory-opus/manual/reference/scripting_reference/scripting_events/onscriptcommand.md">OnScriptCommand</a>\*\*event is triggered, any arguments supplied on the command line are parsed according to this template and provided via the <a href="/directory-opus/manual/reference/scripting_reference/scripting_objects/scriptcommanddata.md"><strong>ScriptCommandData</strong></a><strong>.</strong><a href="/directory-opus/manual/reference/scripting_reference/scripting_objects/func.md"><strong>func</strong></a><strong>.args</strong> property.</p> |
