Sidebar

reference:scripting_reference:scripting_objects:func

Func

The Func object is passed to a script when it is invoked via a command. In a script function, it is passed to the OnClick method as the ClickData.func property, and in a script add-in that adds an internal command, via the ScriptCommandData.func property. The Func object provides information about the default source and destination of the command, as well as details about how it was invoked.

Property Name Return Type Description

args

object:Args 

Returns an Args object that provides access to any arguments given on the command line that invoked this script. This is used when the script has added an internal command to Opus. A command line template can be provided when the command is added, and any arguments the user provides on the command line for the script command will be available via this object.
For most use the argsmap property may be an easier way to access your command's arguments.

argsmap

object:Map 

Returns a Map object that provides keyword lookup for each of the arguments given on the command line. An argument will only be present in the Map if it was used on the command line, so you can easily check which arguments are present using the Map.exists() method.

command

object:Command 

This property returns a pre-filled Command object that can be used to run commands against the source and destination tabs. Using this object is the equivalent of calling DOpusFactory.Command and setting the source and destination tabs manually.

desttab

object:Tab 

This object represents the default destination tab for the function.

fromdrop

bool

Returns True if the command was invoked via a drag-and-drop operation.

fromkey

bool

Returns True if the command was invoked via the keyboard (i.e. via a hotkey rather than a button).

qualifiers

string

Returns a string indicating any qualifier keys that were held down by the user when the command was invoked.

The string can contain any or all of the following: shift, ctrl, alt, lwin, rwin.

If no qualifiers were down, the string will be: none

Note that any qualifiers that were actually involved in launching this command will be filtered out from this property. For example, a hotkey assigned to Ctrl+L would not report that the Ctrl key was held down, because it was integral in launching the command. Use the qualifiers_raw property to access an unfiltered set of qualifiers.

qualifiers_raw

string

Returns a string indicating any qualifier keys that were held down by the user when the command was invoked. This provides the true qualifier set, without the filtering as described above.

The string can contain any or all of the following: shift, ctrl, alt, lwin, rwin.

sourcetab

object:Tab

This object represents the default source tab for the function.

viewer

object:Viewer 

If this button was run from the standalone image viewer, this object represents the viewer window.

Method Name Arguments Return Type Description

Dlg

none

object:Dialog

Creates a new Dialog object, that lets you display dialogs and popup menus. The dialog's window property will be automatically assigned to the source tab.