ScriptColumnData

The ScriptColumnData object is passed to the script-defined entry points for any custom columns added by a script add-in. The method name for these events is defined by the script itself, but generically it's referred to as OnScriptColumn. Note that the fields group, sort, type and value are settable and are the way your method returns values for your column.

 

Property Name

Return Type

Description

col

string

Provides the name of the column that Opus wants the script to return the value for. If you use the same OnScriptColumn method to provide multiple columns you can use this to tell the columns apart.

columns

object:Map 

If the ScriptColumn.multicol value is set to True when the column is added, then this property provides a Map that lets you return the values of one or more columns at once.

You may want to use this method if your script returns multiple columns that all share common calculations (e.g. reading the contents of a folder). That way, you can avoid repeating potentially time consuming operations when you're called for the second and subsequent columns.

The Map contains one member element for each of your columns. Each member element has group, sort, type and value properties which are equivalent to the ones described below.

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

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

group

string

If the ScriptColumn.autogroup value is set to False when the column is added, you should set this value to indicate the group that this file should be placed in when the list is grouped by your column. If you don't provide a group then this file will go into the Unspecified group. If autogroup is set to True this value is ignored.

Note that if the ScriptColumn.multicol value is set to True when the column is added then this property will be found inside the columns Map.

group_type

string

If the group is set via the group property, group_type lets you control the formatting of the group title using the same keywords as the type field (e.g. you can supply a number and have the group title formatted as a file size by setting group_type="size").

item

object:Item

Returns an Item object representing the file or folder that Opus wants the script to return the column value for.

sort

variant

Lets you control the sort order of your column by providing a sort key that can be different to the value. If provided, and the list is sorted by your column, Opus will use the value of this field to position this item rather than the value value.

Note that if the ScriptColumn.multicol value is set to True when the column is added then this property will be found inside the columns Map.

tab

object:Tab

Returns a Tab object representing the tab that contains the item.

type

string

Lets you override the default type of the column (set via ScriptColumn.type when the column was added) on a per-file basis. If not specified, and no default was specified either, then 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). The value should be in the form "x" or "x/y".

 

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).

Note that if you mix different types within the one column then the results you get when sorting by this column, or searching on your column using the Advanced Find function, may be hard to predict.

Note that if the ScriptColumn.multicol value is set to True when the column is added then this property will be found inside the columns Map.

value

variant

This field is how your method returns the actual value for your column - that is, the information that is displayed to the user in this column for each file and folder.

If the type for this column has been set (either by ScriptColumnData.type or ScriptColumn.type) then Opus will try to convert the provided value to the specified type. If the type is not set then Opus will treat the value as a plain text string.

If you don't provide a sort key via the sort field then Opus will also use this value to order the list when the list is sorted by this column.

Note that if the ScriptColumn.multicol value is set to True when the column is added then this property will be found inside the columns Map.