ScriptColumn

In a script's OnInit method it can call the ScriptInitData.AddColumn method to add custom columns to Opus. These columns can be displayed in file displays and infotips, and can be searched on using the Advanced Find function. Each call to AddColumn returns a ScriptColumn object that the script needs to initialize.
 

Property Name

Return Type

Description

autogroup

bool

If this is set to True (which is the default), and the file display is grouped by this column, Opus will generate the groups automatically based on the column value. If you set this to False, Opus will expect you to provide grouping information in your OnScriptColumn function.

autorefresh

bool

Set to True to force Opus to update the value for this column when a file changes.

defsort

int

This property lets you control the default sort behavior for your column. Normally when the user clicks the column header to sort by a column the column is initially sorted in ascending order, and then clicking again reverses the sort order. If you set defsort to -1, the first click on the column header will sort in descending order. Date and size fields have this behavior set by default.

defwidth

int or string

Specifies a default width for your column, which will be used unless the file display has auto-sizing enabled. If you specify a simple integer value this represents a width measured in average characters (e.g. 12 specifies 12 average characters wide). You can also specify an absolute number of pixels by adding the px suffix (e.g. "150px" specifies 150 pixels).

grouporder

string

If the autogroup property is set to False, the grouporder property lets you control the order your column's groups appear in. Each group should be listed in the string in the desired order, separated by a semi-colon (e.g. "Never Modified;Modified"). If not provided, groups will default to sorting alphabetically.

header

string

If this property is set, this defines the string that will be displayed in the column header when this column is added to a Lister. If not set, the label value will be used.

infotiponly

bool

Set this to True if you  want your column to be only available for use in Info Tips. You might want this if your column takes a significant amount of time to return a value, in which case the user would probably only want to use it in an Info Tip so they can see the value on demand. If set to False (the default) the column will be available everywhere.

justify

string

This field lets you control the justification of your column. If not specified, columns default to left justify. Acceptable values are center, left, right and path.

keyscroll

bool

If this is set to True, and the user has the Sort-field specific key scrolling Preferences option enabled, then your column will participate in this special mode.

label

string

Use this to set a label for the column. This is displayed in the column header when the column is added to a Details/Power mode file display (unless overridden by the header property), and in various column lists such as in the Folder Options dialog.

match

Vector:string

If you add strings to this Vector (e.g. via the push_back method) it will be used to provide a drop-down list of possible values when searching on this column using the Advanced Find function.

maxstars

int

If the column type is set to stars this property lets you specify the maximum number of stars that will be used. This is used to ensure the column is sized correctly.

method

string

This is the name of the method in your script that provides the actual values for your new column. This would typically be set to OnXXXXX where XXXXX is the name of the command, however any method name can be used.

When the method is invoked it is passed a single argument, a ScriptColumnData object. Generically this method is referred to as OnScriptColumn.

multicol

bool

If your script implements multiple columns that require common calculations to perform, you may wish to set the multicol property. If this is set to True then your column handler function has the option of returning data for multiple columns simultaneously, rather than just the specific column it is being invoked for.

When your handler is called, the ScriptColumnData object won't contain the usual group, sort, type and value properties. Instead, it will have a columns property that points to a Map that lets you set the values for one or more of your columns at once.

For example, you might set the value of a column called MyColumn like this:

scriptColData.columns("MyColumn").value = "My Column Value";

name

string

This is the raw name of the column. This determines the name that can be used to control the column programmatically (for example, the Set COLUMNSTOGGLE command can be used to toggle a column on or off by name).

The name of a custom column is built from a combination of the name of the script that provides the column and the raw name of the column itself, and is preceded by the prefix scp:. For example, if your script were called My Script and your column's name were My Column, you could toggle this column using the command Set COLUMNSTOGGLE="scp:My Script/My Column". You can use the button editor menus to build the command automatically, if you are unsure of anything.

namerefresh

 

Set to True to force Opus to update the value for this column when a file's name changes.

nogroup

bool

Set to True to prevent the file display being grouped by this column.

nosort

bool

Set to True to prevent the file display being sorted by this column.

type

string

This field lets you set the default type of the column. If not specified, columns default to plain text. Acceptable values are:

number: The column displays integer numbers
double: The column displays floating point (fractional) numbers
size: The column displays file sizes (automatically displays bytes, KB, MB, etc)
zip: The column displays file sizes (uses the settings for Zip file sizes)
percent: The column displays a percentage
graph: The column displays a bar graph (expects a value from 0 to 100)
igraph: The column displays an inverted bar graph
date: The column displays a date
time: The column displays a time
datetime: The column displays both a date and a time
stars: The column displays stars (similar to the built-in Rating column)

 

For date, time and datetime columns, you can also specify utc to have the values automatically converted from UTC to local time (e.g. datetime,utc).

For number and double columns, you can also specify signed to have the values treated as signed rather than unsigned (e.g. number,signed).

 

Your OnScriptColumnmethod can override the type on a per-file basis, however this field sets the default type and also controls the behavior of the Advanced Find function when searching using your column.