Skip to main content

Classes

Host.Classes provides class creation and inspection helpers.

Methods

MethodReturnsParametersDescription
Host.Classes.createInstance(classID)objectclassID — class identifier stringCreate an instance of a built-in class
Host.Classes.getClassDescription(classID)objectclassID — class identifier stringGet the class description object
Host.Classes.newIterator()objectnoneCreate a new empty iterator

Instantiable built-in classes

CCL:CommandBarModel

CCL:CommandBarModel is the data model for a macro-style toolbar with pages and items. Created via Host.Classes.createInstance("CCL:CommandBarModel").

Methods:

MethodReturnsParametersDescription
getRootItem()objectnoneGet the root item (type "Root", contains pages)
getParentItem(item)objectitem — child itemGet the parent of an item
createPage(id)objectid — page identifier stringCreate a new page item (type "Page"). Has the same properties and methods as rootItem.
getPage(index)objectindex — 0-based page indexGet a page by index
countPages()numbernoneNumber of pages
addItem(item, parent)item — item object, parent — parent itemAdd an item to the model
invalidate()noneRefresh the view
loadItemFromFile(path)objectpathHost.Url path to a .macropage fileLoad a macro page from file
saveToFile(path)pathHost.Url destinationSave the model to a file
loadFromFile(path)pathHost.Url sourceLoad the model from a file
checkItemsIDs()noneValidate item IDs

Root item properties (from getRootItem()):

PropertyTypeWritableExampleDescription
namestringYes""Item name
titlestringYes"My Tools"Display title
typestringNo"Root", "Page"Item type identifier
idstringYes"myPage"Item identifier
layoutstringYes""Layout definition
revisionnumberNo0Revision number
numChildsnumberNo0Number of child items
flagsnumberNo0Behavior flags
isReadOnlynumberNo0Read-only flag
isTemporarynumberNo0Temporary flag
isLeftClickContextMenunumberNo0Context menu on left click

Root item methods:

Returned by getRootItem().

MethodReturnsParametersDescription
addChildItem(item)item — child item objectAdd a child item
removeChildItem(item)item — child item objectRemove a child item
removeAll()noneRemove all children
getChildItem(index)objectindex — 0-based indexGet a child by index
getChildIndex(item)numberitem — child itemGet child index
cloneItem()objectnoneClone the item
saveToFile(path)pathHost.Url destinationSave item to file
var model = Host.Classes.createInstance("CCL:CommandBarModel");
var root = model.getRootItem();

var page = model.createPage("myPage");
page.title = "My Tools";
root.addChildItem(page);

var item = model.createPage("myButton");
item.title = "Do Something";
page.addChildItem(item);

model.invalidate();

CCL:CommandBarView

CCL:CommandBarView is a view component that renders a CCL:CommandBarModel as a toolbar UI. Created via Host.Classes.createInstance("CCL:CommandBarView").

Properties:

PropertyTypeWritableExampleDescription
namestringNo""View name
titlestringNo""Display title
parentobjectNoParent object

Methods:

MethodReturnsParametersDescription
dragItem(item)item — item objectInitiate drag for a toolbar item
var view = Host.Classes.createInstance("CCL:CommandBarView");
view.name = "myToolbar";

CCL:CommandSelector

CCL:CommandSelector provides a command selection UI for choosing and configuring commands. Created via Host.Classes.createInstance("CCL:CommandSelector").

Properties:

PropertyTypeWritableExampleDescription
namestringYes"CommandSelector"Component name (write-only)
argColumnEnabledYestrueEnable argument column (write-only)

Methods:

MethodReturnsParametersDescription
addExcludedCategory(category)category — category stringExclude a command category from the selector

Signals (sent by CommandSelector, received in notify):

The CommandSelector is added to an IObjectNode panel's children array and binds to skin elements via <using controller="CommandSelector">. Selection signals are sent by the CommandSelector and received through IObserver.notify() after calling Host.Signals.advise(commandSelector, this).

Signals:

Signal IDRetrieves command viaDescription
"commandSelected"getArg(0)Fires when a command is confirmed (double-click/Enter)
"commandFocused"getArg(0)Fires when a command is focused/highlighted in the tree
"propertyChanged"getArg(0) — property nameFires when search/filter state changes

Command object:

Returned by getArg(0) in commandFocused/commandSelected.

PropertyTypeWritableExampleDescription
namestringNo"Keyboard Shortcuts"Command display name
categorystringNo"Application"Command category
classIDstringNo"{5EB7D908-...}"Command class ID (GUID)
argumentsstringNo"InitialCategory,InitialCommand"Comma-separated argument names

skin.xml Snippet:

<using controller="CommandSelector">
<EditBox name="searchString" width="500" height="20" options="border immediate" attach="left right"/>
<TreeView name="commandTree" width="500" options="autoexpand exclusive noroot noicons nodrag selectfullwidth selection" scrolloptions="transparent autohideboth" attach="all"/>
</using>

scriptname.js Snippet:

var sel = Host.Classes.createInstance("CCL:CommandSelector");
sel.name = "CommandSelector";
sel.argColumnEnabled = true;
this.children.push(sel);
Host.Signals.advise(sel, this);

this.notify = function(subject, msg) {
if (msg.id === "commandSelected") {
var cmd = msg.getArg(0);
}
if (msg.id === "commandFocused") {
var cmd = msg.getArg(0);
if (cmd) this._selectedCmd = cmd;
}
};

CCL:FileSelector

CCL:FileSelector displays a native OS file dialog for opening or saving files. Created via Host.Classes.createInstance("CCL:FileSelector").

Properties:

PropertyTypeWritableExampleDescription
fileNamestringYes"export.txt"Default file name for save dialogs

Methods:

MethodReturnsParametersDescription
addFilter(fileType)fileType — object with .extension and .descriptionAdd a file type filter
countPaths()numbernoneNumber of selected paths (for multi-select)
getPath()objectnoneGet selected file path as a Host.Url object
runOpen(title)numbertitle — dialog titleShow an open file dialog. Returns 1 if a file was selected, 0 if cancelled.
runSave(title)numbertitle — dialog titleShow a save file dialog. Returns 1 if saved, 0 if cancelled.
setFileName(name)name — file name stringSet the default file name
setFolder(folder)folder — folder path (string or Url)Set the default folder
var fs = Host.Classes.createInstance("CCL:FileSelector");
fs.addFilter({ extension: "txt", description: "Text Files" });
fs.addFilter({ extension: "xml", description: "XML Files" });
fs.setFileName("output.txt");

var result = fs.runOpen("Select a file");
if (result === 1) {
var path = fs.getPath();
// path.url → "file:///Users/.../file.txt"
// path.name → "file.txt"
}

CCL:ParamList

CCL:ParamList is created via Host.Classes.createInstance("CCL:ParamList") and is used for persistent dialogs and panels that remain open across multiple interactions.

Properties:

PropertyTypeWritableExampleDescription
controllerobjectYesthisController object for dialog parameter bindings

Methods:

MethodReturnsParametersDescription
addColor(name)objectname — parameter nameAdd a color picker parameter
addCommand(cat, name, id)objectcat — category, name — command name, id — identifierAdd a command binding parameter
addFloat(min, max, name)objectmin — minimum, max — maximum, name — parameter nameAdd a float slider or editbox
addInteger(min, max, name)objectmin — minimum, max — maximum, name — parameter nameAdd an integer slider or editbox
addList(name)objectname — parameter nameAdd a list / dropdown parameter
addMenu(name)objectname — parameter nameAdd a dropdown menu parameter
addParam(name)objectname — parameter nameAdd a generic parameter (button trigger)
addString(name)objectname — parameter nameAdd a string editbox parameter
remove(name)name — parameter nameRemove a parameter from the list

Individual Param Properties (returned by add* methods):

All individual params share these 10 properties. The value type varies by param kind (number for numeric types, string for string params).

PropertyTypeWritableExampleDescription
typenumberNo1Internal type: 0=button, 1=integer, 2=float, 3=string, 4=list/menu, 5=command, 6=color
valuevariesYes42Current value (number or string depending on type)
minnumberNo0Minimum allowed value
maxnumberNo127Maximum allowed value
defaultvariesNo0Default value
namestringNo"MyParam"Parameter name
stringstringYes"50"String representation of the current value
enabledflagYes0Enable state (1 = enabled)
signalAlwaysflagYes0Signal on every change (1 = on)
reverseflagYes0Reverse display (1 = reversed)

Color params (type 6) also support a palette property for assigning a color palette, such as Host.Engine.TrackColorPalette. Setting palette = null clears the palette.

Individual Param Methods:

MethodReturnsParametersDescription
setValue(val)val — new valueSet value programmatically
setFormatter(formatter)formatter — formatter objectSet a display formatter
appendString(text)text — item textAdd an item to a list/menu param
removeAll()noneClear all items from a list/menu param

Required interfaces: IController, IParamObserver.

function MyTask() {
var kPackageID = "com.your.packageid";

this.interfaces = [
Host.Interfaces.IEditTask,
Host.Interfaces.IController,
Host.Interfaces.IParamObserver
];

this.paramList = Host.Classes.createInstance("CCL:ParamList");
this.paramList.controller = this;

this.MyParam = this.paramList.addInteger(0, 127, "MyParam");
this.MyMenu = this.paramList.addMenu("MyMenu");
this.MyMenu.appendString("Option A");
this.MyMenu.appendString("Option B");
this.MyColor = this.paramList.addColor("MyColor");
this.MyColor.palette = Host.Engine.TrackColorPalette;
this.MyColor.value = Host.Engine.TrackColorPalette.getAt(0);
this.MyButton = this.paramList.addParam("MyButton");

this.paramChanged = function(param) {
if (param === this.MyParam) { /* handle */ }
if (param.name === "MyButton" && param.value === 1) {
param.value = 0;
}
};

this.performEdit = function(context) {
var theme = Host.GUI.Themes.getTheme(kPackageID);
Host.GUI.runDialog(theme, "FormName", this);
return Host.Results.kResultOk;
};
}

CCL:ProgressDialog

CCL:ProgressDialog displays a modal progress dialog with status text and a progress bar. Created via Host.Classes.createInstance("CCL:ProgressDialog").

Properties:

PropertyTypeWritableExampleDescription
titlestringYes"Processing..."Dialog window title
textstringYes"Step 3 of 10"Status text displayed in the dialog
valuenumberYes0.5Progress bar position (0.0 = empty, 1.0 = full)

Methods:

MethodReturnsParametersDescription
beginProgress()noneShow the progress dialog
endProgress()noneClose the progress dialog
var progress = Host.Classes.createInstance("CCL:ProgressDialog");
progress.title = "Quantizing Events";
progress.text = "Starting...";
progress.beginProgress();

var total = 100;
for (var i = 0; i < total; i++) {
progress.text = "Processing event " + (i + 1) + " of " + total;
progress.value = (i + 1) / total;
// ... do work ...
}

progress.text = "Complete";
progress.endProgress();

Host:ListViewModel

Host:ListViewModel is the script-owned data model used to populate a ListView, created via Host.Classes.createInstance("Host:ListViewModel").

Properties:

PropertyTypeWritableExampleDescription
itemCountnumberNoitemCountCurrent number of items in the list
columnsobjectNocolumns.addColumn(...)Column definition surface
itemViewobjectNoitemView.setFocusItem(index, scroll)Item view reference (null until model is attached to a rendered dialog via Host.GUI.runDialog())

Methods:

MethodReturnsParametersDescription
newItem(id)objectid — item identifierCreate a new list item with a .details surface for custom fields
addItem(item)item — item object from newItem()Add an item to the list
removeItem(item)item — item object to removeRemove an item from the list
getItem(index)objectindex — 0-based indexGet an item by index
getFocusItem()objectnoneGet the currently focused item
getSelectedItems()objectnoneGet selection object with .count and .newIterator() for traversal
changed()noneNotify the view that the model has changed (refresh UI)
doPopup()noneOpen the list's context popup
addTitleSorter()noneAdd title-based sorting
addDetailSorter()noneAdd detail-based sorting

Columns:

MethodReturnsParametersDescription
addColumn(width, title, field, columnWidth, flags)width — column width, title — display title, field — data field name, columnWidth — width value, flags — bitmask of CCL.JS.Columns.* constantsAdd a column definition to the list

Column flags are defined in CCL.JS.Columns (after include_file("resource://{main}/sdk/cclapp.js")):

FlagValueDescription
CCL.JS.Columns.kSizable1 (0x0001)Column width is resizable
CCL.JS.Columns.kMoveable2 (0x0002)Column can be reordered
CCL.JS.Columns.kSortable32 (0x0020)Column is sortable by click
CCL.JS.Columns.kCanFit64 (0x0040)Column can stretch to fit available space

Combine flags with bitwise OR: CCL.JS.Columns.kSizable | CCL.JS.Columns.kSortable, or use hex values like 0x0021 (= kSizable | kSortable).

itemView:

MethodReturnsParametersDescription
setFocusItem(index, scroll)index — 0-based item index, scroll — whether to scroll into view (true or false)Set keyboard focus to an item and optionally scroll it into view

Observe changes:

Host.Signals.advise(list, this);
Host.Signals.unadvise(list, this);

Populate rows example:

var list = Host.Classes.createInstance("Host:ListViewModel");
var item = list.newItem("item1");
item.details.myField = "value";
list.addItem(item);
list.changed();

Host:PresetParam

Host:PresetParam is a host-backed preset-selection object created via Host.Classes.createInstance("Host:PresetParam"). It shares the same 10-property surface as other param objects but adds preset-management methods.

Properties:

PropertyTypeWritableExampleDescription
typenumberNo4Internal type (always 4 for preset params)
valuenumberYes2Current selected index
minnumberNo0Minimum allowed index
maxnumberNo0Maximum allowed index (updates as items are added)
defaultnumberNo0Default value
namestringNo""Parameter name
stringstringYes"Selected"String representation of current selection
enabledflagYes1Enable state (1 = enabled)
signalAlwaysflagYes1Signal on every change (1 = on)
reverseflagYes0Reverse display (1 = reversed)

Methods:

MethodReturnsParametersDescription
appendString(text)text — preset label stringAdd a preset entry by display name
appendValue(value)value — preset valueAdd a preset entry by value
fromString(text)text — preset label stringSelect a preset by its display name
getNormalized()numbernoneGet the current value as a normalized float (0–1)
getSelectedValue()stringnoneGet the currently selected preset's stored value
getValueAt(index)stringindex — entry index (0-based)Get the value at a given index
isType(type)numbertype — value to testCheck whether the parameter matches a given type
removeAll()noneClear all preset entries
selectRelativePath(path)path — relative preset path stringSelect an entry by relative preset path
selectValue(value)value — preset value to selectSelect an entry by its stored value
setCurve(value)value — curve valueSet the parameter curve
setFormatter(formatter)formatter — formatter objectSet a display formatter
setMetaInfo(attrs)attrsHost.Attributes(...) objectSet metadata used to populate or filter preset content
setNormalized(value)value — normalized float (0–1)Set the value using a normalized float
setSignalAlways(value)value1 to enable, 0 to disableSet whether the param signals on every change
setValue(val)val — index or valueSet the current selection
shouldShowFolders(value)value1 to show, 0 to hideControl whether preset folders are shown