~~Title: Script ~~
The **Script** object is one of the two global script objects provided by Opus. This** **object is provided to [[:scripting:script_add-ins|script addins]] when their various event handlers are invoked (other than for the **[[..:scripting_events:oninit|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 **[[..:scripting_events:oninit|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 **[[..:scripting_events:onaddcolumns|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 **[[..:scripting_events:onaddcommands|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
$$ \\
[]\\
[]\\
[]
$$ object:**[[image|Image]]**
$$ Loads an image file from the specified external file. If your script is bundled as a [[:scripting:script_add-ins:script_package|script package]] you can place image files in a sub-directory of the package called **images** 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.
The returned **[[image|Image]]** object can be given as the value of the **[[control|Control]].label** property for a static control in a [[:scripting:script_dialogs|script dialog]] (when that control is in "image" mode). You can also assign as to the **icon** property of a **[[dialog|Dialog]]** object to specify a custom window icon for your script dialog.
$$ LoadResources
$$ or\\
$$ //none//
$$ Loads external [[:scripting:resources|script 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 [[:scripting:script_add-ins:script_package|script package]], the resource file must have a **.odxml** extension for **LoadResources** to be able to find it in the package.
$$ RefreshColumn
$$
$$ //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
$$ \\
$$ //none//
$$ Lets a script add-in update the flags for a [[:scripting:example_scripts:extending_the_fayt|FAYT extension]]. This equates to the options shown to the user for the FAYT mode on the [[:preferences:preferences_categories:filtering_and_sorting:quick_keys|Quick Keys]] Preferences page.
The //name// should be the name of the FAYT extension command; this is given to your command as the **[[scriptfaytcommanddata|ScriptFAYTCommandData]].fayt** property. The //flags// value should represent a flag combination that's meaningful to your extension.