# Script

The **Script** object is one of the two global script objects provided by Opus. This\*\* \*\*object is provided to [script addins](../../../scripting/script_add-ins) when their various event handlers are invoked (other than for the [**OnInit**](../scripting_events/oninit) event). It provides information relating to the script itself.

| Property Name | Return Type                               | Description                                                                                                                                                                                                                                                                                                                                                                            |
| ------------- | ----------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| config        | _object:_[**ScriptConfig**](scriptconfig) | Returns a [**ScriptConfig**](scriptconfig) object representing the configuration values for this script. In the [**OnInit**](../scripting_events/oninit) method a script can define the properties that make up its configuration - the user can then edit these values in Preferences. The object returned by the **config** property represents the values that the user has chosen. |
| file          | _string_                                  | Returns the path and filename of this script.                                                                                                                                                                                                                                                                                                                                          |
| vars          | _object:_[**Vars**](vars)                 | Returns a [**Vars**](vars) object that represents the variables that are scoped to this particular script. This allows scripts to use variables that persist from one invocation of the script to another.                                                                                                                                                                             |

| Method Name     | **Arguments**                                                                                 | Return Type               | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| --------------- | --------------------------------------------------------------------------------------------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| InitColumns     | _none_                                                                                        | _none_                    | If your script implements the [**OnAddColumns**](../scripting_events/onaddcolumns) event, you can call the **InitColumns** method at any time to reinitialize your columns. You may want to do this, for example, in response to the user modifying your script's configuration.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| InitCommands    | _none_                                                                                        | _none_                    | If your script implements the [**OnAddCommands**](../scripting_events/onaddcommands) event, you can call the **InitCommands** method at any time to reinitialize your commands. You may want to do this, for example, in response to the user modifying your script's configuration.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| LoadImage       | <p>&#x3C;string:name><br>[&#x3C;int:width>]<br>[&#x3C;int:height>]<br>[&#x3C;bool:alpha>]</p> | object:[**Image**](image) | <p>Loads an image file from the specified external file. If your script is bundled as a <a href="../../../scripting/script_add-ins/script_package">script package</a> you can place image files in a sub-directory of the package called <strong>images</strong> and then load them from your script by giving their name. You can optionally specify the desired size to load the image at, and whether the alpha channel (if any) should be loaded or not.</p><p>The returned <a href="image"><strong>Image</strong></a> object can be given as the value of the <a href="control"><strong>Control</strong></a><strong>.label</strong> property for a static control in a <a href="../../../scripting/script_dialogs">script dialog</a> (when that control is in "image" mode). You can also assign as to the <strong>icon</strong> property of a <a href="dialog"><strong>Dialog</strong></a> object to specify a custom window icon for your script dialog.</p> |
| LoadResources   | <p>&#x3C;string:name> or<br>&#x3C;string:XML></p>                                             | _none_                    | Loads external [script resources](../../../scripting/resources) and makes them available to the script. You can either provide a filename or a raw XML string. If your script is bundled as a [script package](../../../scripting/script_add-ins/script_package), the resource file must have a **.odxml** extension for **LoadResources** to be able to find it in the package.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| RefreshColumn   | \<string:name>                                                                                | _none_                    | If your script implements any custom columns, you can use this method to cause them to be regenerated if they are currently shown in any tabs. You may want to do this, for example, in response to the user modifying your script's configuration. Pass the name of the column you want to regenerate as the argument to this method.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| UpdateFAYTFlags | <p>&#x3C;string:name><br>&#x3C;int:flags></p>                                                 | _none_                    | <p>Lets a script add-in update the flags for a <a href="../../../scripting/example_scripts/extending_the_fayt">FAYT extension</a>. This equates to the options shown to the user for the FAYT mode on the <a href="../../../preferences/preferences_categories/filtering_and_sorting/quick_keys">Quick Keys</a> Preferences page.</p><p>The <em>name</em> should be the name of the FAYT extension command; this is given to your command as the <a href="scriptfaytcommanddata"><strong>ScriptFAYTCommandData</strong></a><strong>.fayt</strong> property. The <em>flags</em> value should represent a flag combination that's meaningful to your extension.</p>                                                                                                                                                                                                                                                                                                   |
