The Script object is one of the two global script objects provided by Opus. This object is provided to script addins when their various event handlers are invoked (other than for the OnInit event). It provides information relating to the script itself.
Property Name |
Return Type |
Description |
---|---|---|
config |
object:ScriptConfig |
Returns a ScriptConfig object representing the configuration values for this script. In the 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 |
Returns a 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 |
---|---|---|---|
HttpHelpEnabled |
none |
bool |
Returns True if local HTTP help is enabled (that is, if help is shown in the user's web browser), False if the old HtmlHelp-style help is enabled. If HTTP help is enabled, your script is able to add its own help pages via the OnGetHelpContent event, and it can trigger the display of its own help pages using the ShowHelp method. |
InitColumns |
none |
none |
If your script implements the 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 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. |
LoadHelpFile |
<string:name> |
string |
Using the OnGetHelpContent event your script can add its own content to the F1 help. If your script is bundled as a script package you can include .html files in a sub-directory of the package called help, and then load them easily using this method. You can then pass the loaded data to the GetHelpContentData.AddHelpPage method to add the page. |
LoadHelpImage |
<string:name> |
object:Blob |
If your script is bundled as a script package you can include PNG and JPG image files in a sub-directory of the package called help, and then load them easily using this method. You can then pass the loaded data to the GetHelpContentData.AddHelpImage method to add the image. |
LoadImage |
<string:name> [<bool:alpha>] |
object:Image |
Loads an image file from the specified external file. If your script is
bundled as a 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 object can be given as the value of the Control.label property for a static control in a script dialog (when that control is in "image" mode). You can also assign as to the icon property of a Dialog object to specify a custom window icon for your script dialog. |
LoadResources |
<string:name> or |
none |
Loads external 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 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. |
ShowHelp |
<string:page> |
none |
If your script adds its own help pages via the OnGetHelpContent
event, and the user has http help enabled, you can call this
method to display your help in the user's web browser. You might want to
do this when the user clicks a Help button in your script dialog, for
example. You can use the HttpHelpEnabled method to check
if http help is enabled before calling this function. |