> 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_events/oninit.md).

# OnInit

The **OnInit** event is called once for each [script add-in](/directory-opus/manual/scripting/script_add-ins.md) 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](/directory-opus/manual/scripting/example_scripts/adding_a_new_internal_command.md) and [columns](/directory-opus/manual/scripting/example_scripts/adding_a_new_column.md) (although the [**OnAddCommands**](/directory-opus/manual/reference/scripting_reference/scripting_events/onaddcommands.md) and [**OnAddColumns**](/directory-opus/manual/reference/scripting_reference/scripting_events/onaddcolumns.md) methods provide a better way to do this).

| **Method Name:**   | OnInit                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Argument Type:** | [**ScriptInitData**](/directory-opus/manual/reference/scripting_reference/scripting_objects/scriptinitdata.md)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| **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="/directory-opus/manual/scripting/example_scripts/adding_a_new_internal_command.md">add internal commands</a>to the Opus command set, and AddColumn method can be used to add <a href="/directory-opus/manual/scripting/example_scripts/adding_a_new_column.md">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> |
