# Func

The **Func** object is passed to a script when it is invoked via a command. In a [script function](../../../scripting/script_functions), it is passed to the [**OnClick**](../scripting_events/onclick) method as the [**ClickData**](clickdata)**.func** property, and in a script add-in that [adds an internal command](../../../scripting/example_scripts/adding_a_new_internal_command), via the [**ScriptCommandData**](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**](args)       | <p>Returns an <a href="args"><strong>Args</strong></a> 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 <a href="../../../scripting/example_scripts/adding_a_new_internal_command">internal command</a> 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.<br>For most use the <strong>argsmap</strong> property may be an easier way to access your command's arguments.</p> |
| argsmap       | _object:_[**Map**](map)         | Returns a [**Map**](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**](map) if it was used on the command line, so you can easily check which arguments are present using the [**Map**](map)**.exists()** method.                                                                                                                                                                                                                                                                                                     |
| command       | _object:_[**Command**](command) | This property returns a pre-filled [**Command**](command) object that can be used to run commands against the source and destination tabs. Using this object is the equivalent of calling [**DOpusFactory**](dopusfactory)**.Command** and setting the source and destination tabs manually.                                                                                                                                                                                                                                                                                                                       |
| desttab       | _object:_[**Tab**](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_                        | <p>Returns a string indicating any qualifier keys that were held down by the user when the command was invoked.</p><p>The string can contain any or all of the following: <em>shift,</em> <em>ctrl</em>, <em>alt</em>, <em>lwin</em>, <em>rwin</em>.</p><p>If no qualifiers were down, the string will be: <em>none</em></p>                                                                                                                                                                                                                                                                                       |
| sourcetab     | _object:_[**Tab**](tab)         | This object represents the default source tab for the function.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| viewer        | _object:_[**Viewer**](viewer)   | If this button was run from the [standalone image viewer](../../../additional_functionality/viewing_images), this object represents the viewer window.                                                                                                                                                                                                                                                                                                                                                                                                                                                             |

| Method Name | **Arguments** | Return Type                   | Description                                                                                                                                                                  |
| ----------- | ------------- | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Dlg         | _none_        | _object:_[**Dialog**](dialog) | Creates a new [**Dialog**](dialog) object, that lets you display dialogs and popup menus. The dialog's **window** property will be automatically assigned to the source tab. |
