# OnInit

The **OnInit** event is called once for each [script add-in](../../../scripting/script_add-ins) to initialize it. The event will be called on program startup, and also if a script is added or edited while Opus is already running. Implementing the **OnInit** event is optional, but highly recommended as it allows you to provide a name, description and other information to be shown to the user in Preferences. It also provides a way for a script to [add internal commands](../../../scripting/example_scripts/adding_a_new_internal_command) and [columns](../../../scripting/example_scripts/adding_a_new_column) (although the [**OnAddCommands**](onaddcommands) and [**OnAddColumns**](onaddcolumns) methods provide a better way to do this).

| **Method Name:**   | OnInit                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Argument Type:** | [**ScriptInitData**](../scripting_objects/scriptinitdata)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| **Return Type:**   | _bool_                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| **Description:**   | <p>When Opus starts up, or when a script add-in is added or edited, its <strong>OnInit</strong> method is called. This gives the script a chance to tell Opus something about itself, by setting the various properties of the <strong>ScriptInitData</strong> object. The <strong>AddCommand</strong> method can also be used from this event to <a href="../../../scripting/example_scripts/adding_a_new_internal_command">add internal commands</a>to the Opus command set, and AddColumn method can be used to add <a href="../../../scripting/example_scripts/adding_a_new_column">columns</a>.<br>If you return <strong>True</strong> from this method, the script will be disabled until the next time <strong>OnInit</strong> is called (which normally would be the next time Opus is run). For instance, you might want to do this if the version of Windows isn't appropriate for your script.</p> |
