# ScriptInitData

The **ScriptInitData** object is passed to the [**OnInit**](../scripting_events/oninit) event in a [script add-in](../../../scripting/script_add-ins). The script should initialize the various properties to identify itself, and can optionally [add internal commands](../../../scripting/example_scripts/adding_a_new_internal_command) using the **AddCommand** method, and [custom columns](../../../scripting/example_scripts/adding_a_new_column) using the **AddColumn** method, before returning.

| Property Name   | Return Type                               | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| --------------- | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| config          | _object:_[**ScriptConfig**](scriptconfig) | <p>Returns a <a href="scriptconfig"><strong>ScriptConfig</strong></a> object, that the script can use to initialize its default configuration. Properties added to the object in this method will be displayed to the user in Preferences, allowing them to change their value and thus configure the behavior of the script.</p><p>If you want to preserve the order of configuration items, you can replace this object with an <a href="orderedmap"><strong>OrderedMap</strong></a> by simply assigning the new object to the <code>config</code> property.</p> |
| config\_desc    | _object:_[**Map**](map)                   | This lets you assign descriptions for your script's configuration options that are shown to the user in the editor dialog. To do this, set this property to a [**Map**](map) created via the [**DOpusFactory**](dopusfactory)**.Map** method, filled with name/description string pairs.                                                                                                                                                                                                                                                                           |
| config\_groups  | _object:_[**Map**](map)                   | This lets you organize your script's configuration options into groups when shown to the user in the editor dialog. The group names are arbitrary - configuration options with the same group name will appear grouped together. Set this property to a [**Map**](map) created via the [**DOpusFactory**](dopusfactory)**.Map** method, filled with name/group string pairs.                                                                                                                                                                                       |
| copyright       | _string_                                  | Lets the script specify a copyright message that is displayed to the user in Preferences.                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| default\_enable | _bool_                                    | Set this to **True** if the script should be enabled by default, or **False** if it should be disabled by default. The user can enable or disable scripts using Preferences - this simply controls the default state.                                                                                                                                                                                                                                                                                                                                              |
| desc            | _string_                                  | Lets the script specify a description message that is displayed to the user in Preferences.                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| early\_dblclk   | _bool_                                    | Set this to **True** if your script implements the [**OnDoubleClick**](../scripting_events/ondoubleclick) event and (for performance reasons) you want to be called with only a path to the double-clicked item rather than a full [**Item**](item) object. See the [**OnDoubleClick**](../scripting_events/ondoubleclick) event documentation for more details.                                                                                                                                                                                                   |
| file            | _string_                                  | Returns the path and filename of this script.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| group           | _string_                                  | Lets you specify an arbitrary group for this script. If scripts specify a group they will be displayed in that group in the list in Preferences.                                                                                                                                                                                                                                                                                                                                                                                                                   |
| log\_prefix     | string                                    | Lets the script specify a string that will be prepended to any log output it performs. If not set the name of the script is used by default.                                                                                                                                                                                                                                                                                                                                                                                                                       |
| min\_version    | _string_                                  | Specifies the minimum Opus version required. If the current version is less than the specified version the script will be disabled. You can specify the major version only (e.g. _"11"_), a major and minor version (e.g. _"11.3"_) or a specific beta version (e.g. _"11.3.1"_ for 11.3 Beta 1).                                                                                                                                                                                                                                                                  |
| name            | _string_                                  | Lets the script specify a display name for the script that is shown in Preferences.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| startup         | _bool_                                    | The **OnInit** method is called in two different circumstances - once during Opus startup, and again if the script is installed or edited when Opus is already running. This property will return **True** if the **OnInit** method is being called during Opus startup, or **False** for any other time.                                                                                                                                                                                                                                                          |
| url             | _string_                                  | Lets you provide a URL where the user can go to find out more about your script (it's displayed to the user in Preferences).                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| vars            | _object:_[**Vars**](vars)                 | Returns a [**Vars**](vars) collection of user and script-defined variables that are local to this script. These variables are available to other methods in the script via the [**Script**](script)**.vars** property.                                                                                                                                                                                                                                                                                                                                             |
| version         | _string_                                  | Lets the script specify a version number string that is displayed to the user in Preferences.                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |

| Method Name | **Arguments** | Return Type                                 | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ----------- | ------------- | ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| AddColumn   | _none_        | _object:_[**ScriptColumn**](scriptcolumn)   | <p>Adds a new information column to Opus. The returned <a href="scriptcolumn"><strong>ScriptColumn</strong></a> object must be properly initialized. A script add-in can add as many columns as it likes, and these will be available in file displays, infotips and the <a href="../../../basic_concepts/searching_and_filtering/find_files/advanced_find"><strong>Advanced Find</strong></a> function.</p><p>Instead of adding columns in <strong>OnInit</strong>, your script can implement the <a href="../scripting_events/onaddcolumns"><strong>OnAddColumns</strong></a> method. This is more flexible as it allows you to access your script's configuration at the time you add columns, and columns can be dynamically added and removed while Opus is running. If <a href="../scripting_events/onaddcolumns"><strong>OnAddColumns</strong></a> is implemented then this method is unavailable in <strong>OnInit</strong>.</p> |
| AddCommand  | _none_        | _object:_[**ScriptCommand**](scriptcommand) | <p>Adds a new internal command to Opus. The returned <a href="scriptcommand"><strong>ScriptCommand</strong></a> object must be properly initialized. A script add-in can add as many internal commands as it likes to the Opus internal command set.</p><p>Instead of adding commands in <strong>OnInit</strong>, your script can implement the <a href="../scripting_events/onaddcommands"><strong>OnAddCommands</strong></a> method. This is more flexible as it allows you to access your script's configuration at the time you add commands, and commands can be dynamically added and removed while Opus is running. If <a href="../scripting_events/onaddcommands"><strong>OnAddCommands</strong></a> is implemented then this method is unavailable in <strong>OnInit</strong>.</p>                                                                                                                                              |
