The ScriptInitData object is passed to the OnInit event in a script add-in. The script should initialize the various properties to identify itself, and can optionally add internal commands using the AddCommand method, and custom columns using the AddColumn method, before returning.
Property Name |
Return Type |
Description |
---|---|---|
config |
object:ScriptConfig |
Returns a ScriptConfig 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. |
config_desc |
object: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 created via the DOpusFactory.Map method, filled with name/description 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. |
file |
string |
Returns the path and filename of this script. |
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. |
vars |
object:Vars |
Returns a 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.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 |
Adds a new information column to Opus. The returned ScriptColumn 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
Advanced
Find function. |
AddCommand |
none |
object:ScriptCommand |
Adds a new internal command to Opus. The returned ScriptCommand object must be properly initialized. A script add-in can add as many internal commands as it likes to the Opus internal command set.
Instead of adding commands in OnInit, your script can implement the OnAddCommands 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 OnAddCommands is implemented then this method is unavailable in OnInit. |