## DuScriptUI

Methods related to ScriptUI

View Source Duik_api_fordoc.jsxinc, line 9293

# Members

Type: `Array.<String>`

#### # static defaultColumnAlignment

The default alignment of children of containers with "column" orientation

Default Value:
  - ["fill","top"]

View Source Duik_api_fordoc.jsxinc, line 15612

Type: `int`

#### # static defaultMargins

The default margins of containers

Default Value:
  - 2

View Source Duik_api_fordoc.jsxinc, line 15640

Type: `Array.<String>`

#### # static defaultRowAlignment

The default alignment of children of containers with "row" orientation

Default Value:
  - ["left","center"]

View Source Duik_api_fordoc.jsxinc, line 15619

Type: `int`

#### # static defaultSpacing

The default spacing of containers

Default Value:
  - 2

View Source Duik_api_fordoc.jsxinc, line 15633

Type: `Array.<String>`

#### # static defaultStackAlignment

The default alignment of children of containers with "stack" orientation

Default Value:
  - ["fill","top"]

View Source Duik_api_fordoc.jsxinc, line 15626

Type: `ProgressBar`

#### # static fundingBar

A bar used to show current funding status.

View Source Duik_api_fordoc.jsxinc, line 15646

Type: `StaticText`

#### # static fundingLabel

A label used to show current funding status.

View Source Duik_api_fordoc.jsxinc, line 15652

Type: `DuBinary`

#### # static Icon

The list of available icons.

##### Properties:

Name | Type | Description
--- | --- | ---
`ADD` | `DuBinary` |
`AE_BLUE` | `DuBinary` |
`AE_ORANGE` | `DuBinary` |
`BACK` | `DuBinary` |
`BOX_CHECKED` | `DuBinary` |
`BOX_UNCHECKED` | `DuBinary` |
`BUG` | `DuBinary` |
`BUG_REPORT` | `DuBinary` |
`CHECK` | `DuBinary` |
`CLOSE` | `DuBinary` |
`DOWNLOAD` | `DuBinary` |
`EDIT` | `DuBinary` |
`EXPERT` | `DuBinary` |
`EYE_DROPPER` | `DuBinary` |
`EYE_DROPPER_BIG` | `DuBinary` |
`FEATURE` | `DuBinary` |
`FILE` | `DuBinary` |
`FOLDER` | `DuBinary` |
`FOLDER_CLOSED` | `DuBinary` |
`GO_TO` | `DuBinary` |
`HEART` | `DuBinary` |
`HELP` | `DuBinary` |
`LANGUAGE` | `DuBinary` |
`LANGUAGE_FILE` | `DuBinary` |
`LANGUAGE_SMALL` | `DuBinary` |
`LIST` | `DuBinary` |
`MENU` | `DuBinary` |
`MORE` | `DuBinary` |
`NEXT` | `DuBinary` |
`OPTIONS` | `DuBinary` |
`PARENT` | `DuBinary` |
`PIN` | `DuBinary` |
`PINNED` | `DuBinary` |
`PLACEHOLDER` | `DuBinary` |
`PROGRESS` | `DuBinary` |
`RAINBOX_RED` | `DuBinary` |
`RANDOM` | `DuBinary` |
`REMOVE` | `DuBinary` |
`RESET` | `DuBinary` |
`ROOKIE` | `DuBinary` |
`RUN` | `DuBinary` |
`RX_PURPLE` | `DuBinary` |
`SETTINGS` | `DuBinary` |
`SETTINGS_FILE` | `DuBinary` |
`STANDARD` | `DuBinary` |
`UPDATE` | `DuBinary` |
`USER` | `DuBinary` |
`SEARCH` | `DuBinary` |
`SORT` | `DuBinary` |
`SORT_UP` | `DuBinary` |
`SORT_DOWN` | `DuBinary` |

View Source Duik_api_fordoc.jsxinc, line 9883

Type: `DuProgressBar`

#### # static progressBar

Show this progress bar before long operations with `DuProgressBar.show` and DuESF will update it.

View Source Duik_api_fordoc.jsxinc, line 14784

Type: `string`

#### # static String

The list of strings used by the UI.

##### Properties:

Name | Type | Description
--- | --- | ---
`ABOVE` | `string` |
`ABOVE_SHORT` | `string` |
`ADD_ITEM_OR_CAT` | `string` |
`AE_BLUE` | `string` |
`AE_BLUE_TIP` | `string` |
`AE_ORANGE` | `string` |
`AE_ORANGE_TIP` | `string` |
`APPLY` | `string` |
`APPLY_ALL` | `string` |
`APPLY_SETTINGS` | `string` |
`APPLY_SETTINGS_ALERT` | `string` |
`ARM` | `string` |
`ARTHROPOD` | `string` |
`AUDIO` | `string` |
`AXIS` | `string` |
`BACK_PREVIOUS` | `string` |
`BACK_LOCATION` | `string` |
`BACK_LOCATION_SHORT` | `string` |
`BIRD` | `string` |
`BODY` | `string` |
`BONE` | `string` |
`BUG_REPORT` | `string` |
`BUG_REPORT_TIP` | `string` |
`CAM` | `string` |
`CAMERA` | `string` |
`CANCEL` | `string` |
`CALF` | `string` |
`CATEGORY` | `string` |
`CHARACTER` | `string` |
`CHANNEL` | `string` |
`CHECK_UPDATE` | `string` |
`CIRCLE` | `string` |
`CLAWS` | `string` |
`CLEAR_LIB_TIP` | `string` |
`CLOSE` | `string` |
`COLOR` | `string` |
`COLOR_HIGHLIGHT_TIP` | `string` |
`COPY` | `string` |
`CREATE` | `string` |
`CUSTOM` | `string` |
`CUSTOM_COLOR_TIP` | `string` |
`CLOSE_SETTINGS` | `string` |
`DEFAULT` | `string` |
`DEV_MODE` | `string` |
`DEV_MODE_TIP` | `string` |
`DIGITIGRADE` | `string` |
`EAR` | `string` |
`EDIT` | `string` |
`EDIT_ITEM_OR_CAT` | `string` |
`EDIT_SETTINGS` | `string` |
`EFFECTS` | `string` |
`EXPERT` | `string` |
`EXPERT_UI_TIP` | `string` |
`EYE` | `string` |
`EYES` | `string` |
`EYEBROW` | `string` |
`FEATHER` | `string` |
`FEATHERS` | `string` |
`FEATURE_REQUEST` | `string` |
`FEATURE_REQUEST_TIP` | `string` |
`FILE` | `string` |
`FIN` | `string` |
`FINGERS` | `string` |
`FISH` | `string` |
`FISHBONE` | `string` |
`FISHBONES` | `string` |
`FISH_SPINE` | `string` |
`FOOT` | `string` |
`FOREARM` | `string` |
`FRAME` | `string` |
`FRAMES` | `string` |
`FRONT` | `string` |
`FRONT_LEG` | `string` |
`FRONT_SHORT` | `string` |
`FUNDING_BAR_TIP` | `string` |
`FUNDING_BAR_TIP_DETAILS` | `string` |
`GROUPS` | `string` |
`HAIR` | `string` |
`HAND` | `string` |
`HEAD` | `string` |
`HEEL` | `string` |
`HELP` | `string` |
`HELP_TIP` | `string` |
`HIPS` | `string` |
`HOMINOID` | `string` |
`HOOF` | `string` |
`INVERT` | `string` |
`INVERTED` | `string` |
`ISOLATE` | `string` |
`ITEM` | `string` |
`LANGUAGE_TIP` | `string` |
`LAYER` | `string` |
`LAYERS` | `string` |
`LEFT` | `string` |
`LEFT_SHORT` | `string` |
`LEG` | `string` |
`LIMB` | `string` |
`LOCATION` | `string` |
`LOCATION_SHORT` | `string` |
`MAGIC` | `string` |
`MAIN` | `string` |
`MASKS` | `string` |
`MAXIMUM` | `string` |
`MIDDLE` | `string` |
`MIDDLE_SHORT` | `string` |
`MINIMUM` | `string` |
`MORE_OPTIONS_TIP` | `string` |
`MOUTH` | `string` |
`NAME` | `string` |
`NECK` | `string` |
`NEXT` | `string` |
`NONE` | `string` |
`NORMAL_MODE` | `string` |
`NOSE` | `string` |
`NULL_OBJECT` | `string` |
`OK` | `string` |
`OPACITY` | `string` |
`OPEN` | `string` |
`OPEN_FOLDER` | `string` |
`ORIGINAL` | `string` |
`PATH` | `string` |
`PAW` | `string` |
`PENIS` | `string` |
`PINCER` | `string` |
`PIN_TIP` | `string` |
`PLANTIGRADE` | `string` |
`PREVIOUS` | `string` |
`POLYGON` | `string` |
`POSITION` | `string` |
`PROPERTIES` | `string` |
`RANDOM_TIP` | `string` |
`RECTANGLE` | `string` |
`REFRESH_LIB` | `string` |
`REMOVE` | `string` |
`REMOVE_ITEM_OR_CAT` | `string` |
`RESET_SETTINGS` | `string` |
`RIGHT` | `string` |
`RIGHT_SHORT` | `string` |
`ROOKIE` | `string` |
`ROOKIE_UI_TIP` | `string` |
`ROTATION` | `string` |
`ROUNDED_RECTANGLE` | `string` |
`RUN_EXECUTE` | `string` |
`RX_PURPLE` | `string` |
`RX_PURPLE_TIP` | `string` |
`RX_RED` | `string` |
`RX_RED_TIP` | `string` |
`SAVE_AS` | `string` |
`SCALE` | `string` |
`SCRIPTING` | `string` |
`SELECT_LAYERS` | `string` |
`SELECT_GROUPS` | `string` |
`SET_QUALITY` | `string` |
`SETTINGS` | `string` |
`SETTINGS_FILE` | `string` |
`SETTINGS_FILE_TIP` | `string` |
`SHOULDER` | `string` |
`SHOULDERS` | `string` |
`SHOULDERS_AND_NECK` | `string` |
`SIDE` | `string` |
`SIZE` | `string` |
`SNAKE` | `string` |
`SPINE` | `string` |
`STANDARD` | `string` |
`STANDARD_UI_TIP` | `string` |
`START_TYPING_CMD` | `string` |
`TAIL` | `string` |
`TAIL_SHORT` | `string` |
`TARGET` | `string` |
`TEXT` | `string` |
`TEXTURE` | `string` |
`THIGH` | `string` |
`TIMELINE` | `string` |
`TIP_BONE` | `string` |
`TRANSFORM` | `string` |
`TOES` | `string` |
`TORSO` | `string` |
`TYPE` | `string` |
`UI_MODE_TIP` | `string` |
`UNDER` | `string` |
`UNDER_SHORT` | `string` |
`UNGULATE` | `string` |
`VERTEBRAE` | `string` |
`VULVA` | `string` |
`WING` | `string` |
`WORKING` | `string` |
`X_POSITION` | `string` |
`Y_POSITION` | `string` |

View Source Duik_api_fordoc.jsxinc, line 9304

# Methods

#### # static addBugButton(container, showLabelopt) → {DuButton}

Creates a button opening the bug report url.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`container` | `Panel` | `Window` | `Group` |  |  | The ScriptUI Object which will contain and display the button.
`showLabel` | `bool` | <optional> | false | When true, the button includes a "Bug Report" label.

View Source Duik_api_fordoc.jsxinc, line 11720

Returns:
The bug button created.
Type: `DuButton`

#### # static addDonateButton(container, showLabelopt) → {DuButton}

Creates a button opening the link for like/follow/donation

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`container` | `Panel` | `Window` | `Group` |  |  | The ScriptUI Object which will contain and display the button.
`showLabel` | `bool` | <optional> | false | When true, the button includes a `"I ♥ " + DuESF.scriptName` label.

View Source Duik_api_fordoc.jsxinc, line 11854

Returns:
The like button created.
Type: `DuButton`

#### # static addEvent(func, timeOutopt) → {int}

Adds a function to be run periodically, which will be connected to several UI events, fired when the user interacts with the UI.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`func` | `function` |  |  | The function to connect to the UI
`timeOut` | `int` | <optional> | 3000 | A timeOut in milliseconds which prevents the function to be run too often

View Source Duik_api_fordoc.jsxinc, line 15580

Returns:
a unique identifier to be used to remove the function later, with `DuScriptUI.removeEvent`.
Type: `int`

#### # static addHelpButton(container, showLabelopt) → {DuButton}

Creates a button opening the help panel.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`container` | `Panel` | `Window` | `Group` |  |  | The ScriptUI Object which will contain and display the button.
`showLabel` | `bool` | <optional> | false | When true, the button includes a "Help" label.

View Source Duik_api_fordoc.jsxinc, line 11764

Returns:
The help button created.
Type: `DuButton`

#### # static addTranslateButton(container, showLabelopt) → {DuButton}

Creates a button opening the help panel.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`container` | `Panel` | `Window` | `Group` |  |  | The ScriptUI Object which will contain and display the button.
`showLabel` | `bool` | <optional> | false | When true, the button includes a "Help" label.

View Source Duik_api_fordoc.jsxinc, line 11809

Returns:
The help button created.
Type: `DuButton`

#### # static askLanguage(callback, uiopt)

Displays a prompt to select the language of the script.
Won't do nothing if the script already has a language set in the settings.
Use this method before launching the script.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`callback` | `function` |  | The function to execute when the user has chosen the language. This function should be the one which loads the script.
`ui` | `Panel` | `Window` | <optional> | A container to display the UI. A modal Dialog is created if omitted

View Source Duik_api_fordoc.jsxinc, line 11894

#### # static buildAllTabs()

Builds all the tabs from all the tab panels

View Source Duik_api_fordoc.jsxinc, line 14207

#### # static button(container, textopt, imageopt, helpTipopt, addOptionsPanelopt, orientationopt, alignmentopt, localizeopt, ignoreUIModeopt, optionsWithoutButtonopt, optionsButtonTextopt, optionsWithoutPanelopt) → {DuButton}

Creates a button with an optionnal icon. Must have at least an icon or a text, or both.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`container` | `Panel` | `Window` | `Group` |  |  | The ScriptUI Object which will contain and display the button.
`text` | `string` | <optional> |  | The label of the button. Default: empty string
`image` | `string` | `DuBInary` | <optional> |  | The path to the icon (or a PNG as a string representation). Default: empty string
`helpTip` | `string` | <optional> |  | The helptip. Default: empty string
`addOptionsPanel` | `Boolean` | <optional> | false | Adds a panel for options and a button to access it.
`orientation` | `Boolean` | <optional> | 'row' | The orientation of the button (icon, text, options button). Default will be changed to 'column' if there's no text.
`alignment` | `Boolean` | <optional> | 'left' | The alignment of the button content ('center', 'right' or 'left' for 'row', 'top' 'bottom', 'center' for column).
`localize` | `Boolean` | <optional> | true | Set to false if the text must not be translated.
`ignoreUIMode` | `Boolean` | <optional> | false | Will show texte even if the ui mode is set to > 1 in the script settings
`optionsWithoutButton` | `Boolean` | <optional> | false | Don't add an "ok" button to the options popup
`optionsButtonText` | `string` | <optional> |  | Change the displayed text of the bottom button of the options
`optionsWithoutPanel` | `Boolean` | <optional> | false | Don't create the options popup panel (use `DuButton.onOptions` to add your own callback when the options are requested)

View Source Duik_api_fordoc.jsxinc, line 11268

Returns:
The image button created.
Type: `DuButton`

#### # static centerInScreen(location, size) → {Array.<int>}

Centers the coordinates in their screen

##### Parameters:

Name | Type | Description
--- | --- | ---
`location` | `Array.<int>` | The coordinates [top, left]
`size` | `Dimension` | The rectangle size, an object which has two properties: width and height

View Source Duik_api_fordoc.jsxinc, line 12769

Returns:
the new location
Type: `Array.<int>`

#### # static checkBox(container, text, imageopt, helpTipopt, textCheckedopt, imageCheckedopt, orientationopt) → {DuCheckBox}

Creates a checkbox with an optionnal icon. Must have at least an icon or a text, or both.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`container` | `Panel` | `Window` | `Group` |  |  | The ScriptUI Object which will contain and display the button.
`text` | `string` |  |  | The label of the button. Default: empty string
`image` | `string` | `DuBinary` | <optional> |  | The path to the icon. Default: empty string
`helpTip` | `string` | <optional> | '' | The helptip. Default: empty string
`textChecked` | `string` | <optional> | text | The label of the button displayed when it is checked.
`imageChecked` | `string` | `DuBinary` | <optional> |  | The image to show when it is checked
`orientation` | `string` | <optional> | 'row' | The orientation

View Source Duik_api_fordoc.jsxinc, line 12385

Returns:
The checkbox created.
Type: `DuCheckBox`

#### # static checkUpdate(callbackopt, uiopt, showAlertopt)

Checks if the script can be updated

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`callback` | `function` | <optional> | The function to execute when the user has clicked on the "dismiss" button.
`ui` | `Panel` | `Window` | <optional> | A container to display the UI. A modal Dialog is created if omitted
`showAlert` | `Boolean` | <optional> | Whether to show an alert if the check failed or if the version is up-to-date.

View Source Duik_api_fordoc.jsxinc, line 11966

#### # static colorSelector(container, helpTipopt) → {DuColorSelector}

Creates a new color selector and adds it to the container

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`container` | `Window` | `Panel` | `Group` |  |
`helpTip` | `string` | <optional> | The help tip to show on the selector

View Source Duik_api_fordoc.jsxinc, line 14283

Returns:
Type: `DuColorSelector`

#### # static compSelector(container, helpTipopt) → {DuAECompSelector}

Creates a drop down selector for compositions

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`container` | `Window` | `Panel` | `Group` |  |  | The ScriptUI Object which will contain and display the selector.
`helpTip` | `string` | <optional> | "" | The help tip.

View Source Duik_api_fordoc.jsxinc, line 19182

Returns:
- The selector
Type: `DuAECompSelector`

#### # static editText(container, text, prefixopt, suffixopt, placeHolderopt, helpTipopt, localizeopt) → {DuEditText}

Creates a nice edittext where the edit text is shown only on click.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`container` | `Window` | `Panel` | `Group` |  |  | The ScriptUI Object which will contain and display the nice edit text.
`text` | `string` |  |  | The initial text in the edit.
`prefix` | `string` | <optional> | "" | A text prefix to display.
`suffix` | `string` | <optional> | "" | A text suffix to display.
`placeHolder` | `string` | <optional> | "" | A place holder default text.
`helpTip` | `string` | <optional> | "" | The helpTip of this control
`localize` | `bool` | <optional> | true | Whether to translate the texts of this control

View Source Duik_api_fordoc.jsxinc, line 13246

Returns:
The custom Group containing the edit text.
Type: `DuEditText`

#### # static fileSelector(container, textopt, textFieldopt, helpTipopt, imageopt, modeopt, filtersopt, orientationopt) → {DuFileSelector}

Creates a file selector with a field for the path and a browse button.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`container` | `Window` | `Panel` | `Group` |  |  | The ScriptUI Object which will contain and display the panel.
`text` | `string` | <optional> | "Browse..." | The text to display on the button.
`textField` | `boolean` | <optional> | true | Whether to show the text field for the path.
`helpTip` | `string` | <optional> | '' | The helptip for this control.
`image` | `string` | `DuBinary` | <optional> |  | The image to use as an icon; a "file" icon by default.
`mode` | `string` | <optional> | 'open' | The open mode, either 'open' or 'save'.
`filters` | `string` | <optional> |  | The file type filters.
`orientation` | `string` | <optional> | 'row' | The orientation of the control (button+edittext).

View Source Duik_api_fordoc.jsxinc, line 13603

Returns:
The control.
Type: `DuFileSelector`

#### # static folderSelector(container, textopt, textFieldopt, helpTipopt, orientationopt) → {DuFolderSelector}

Creates a folder selector with a field for the path and a browse button

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`container` | `Window` | `Panel` | `Group` |  |  | The ScriptUI Object which will contain and display the panel.
`text` | `string` | <optional> | "Browse..." | The text to display on the button.
`textField` | `boolean` | <optional> | true | Whether to show the text field for the path.
`helpTip` | `string` | <optional> | '' | The helptip for this control.
`orientation` | `string` | <optional> | 'row' | The orientation of the control (button+edittext).

View Source Duik_api_fordoc.jsxinc, line 13503

Returns:
The control.
Type: `DuFolderSelector`

#### # static form(container) → {DuForm}

Creates a layout to add forms to a UI, using ScriptUI groups.
You can easily add controls/fields to this form using DuScriptUI.addField

##### Parameters:

Name | Type | Description
--- | --- | ---
`container` | `Window` | `Panel` | `Group` | The ScriptUI Object which will contain and display the form.

View Source Duik_api_fordoc.jsxinc, line 13934

Returns:
The custom Group containing the form.
Type: `DuForm`

#### # static getClosestScreen(location) → {Object}

Gets the corners of the screen the closest to (or containing) the location

##### Parameters:

Name | Type | Description
--- | --- | ---
`location` | `Array.<int>` | The coordinates

View Source Duik_api_fordoc.jsxinc, line 12789

Returns:
The screen object with a top, left, right and bottom property.
Type: `Object`

#### # static group(container, orientationopt) → {Group}

Adds a group in a container, using DuScriptUI default alignments, and DuScriptUI.defaultSpacing. Margins are set to 0.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`container` | `Panel` | `Window` | `Group` |  | Where to create the group
`orientation` | `string` | <optional> | The orientation to use. One of "column", "row" or "stack". By default, "column" if added in a row, "row" if added in a column.

View Source Duik_api_fordoc.jsxinc, line 12249

Returns:
The group created
Type: `Group`

#### # static layerPicker(container) → {DuAELayerPicker}

Creates a two-column group to allow the user to pick layers

##### Parameters:

Name | Type | Description
--- | --- | ---
`container` | `Window` | `Panel` | `Group` | The ScriptUI Object which will contain and display the selector.

View Source Duik_api_fordoc.jsxinc, line 19437

Returns:
The picker.
Type: `DuAELayerPicker`

#### # static layerPickerDialog(title) → {DuAELayerPickerDialog}

Creates a dialog with a DuAELayerPicker
Use `DuScriptUI.showUI` to show it after creation.

##### Parameters:

Name | Type | Description
--- | --- | ---
`title` | `string` | The title of the dialog.

View Source Duik_api_fordoc.jsxinc, line 19540

Returns:
The dialog window.
Type: `DuAELayerPickerDialog`

#### # static layerSelector(container, helpTipopt) → {DuAELayerSelector}

Creates a drop down selector for layers

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`container` | `Window` | `Panel` | `Group` |  |  | The ScriptUI Object which will contain and display the selector.
`helpTip` | `string` | <optional> | "" | The help tip.

View Source Duik_api_fordoc.jsxinc, line 18880

Returns:
- The selector
Type: `DuAELayerSelector`

#### # static layout(item, forceopt)

Resets the layout of the whole ui containing a scriptUI item.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`item` | `ScriptUI` |  | The ScriptUI element which needs to be resized
`force` | `Boolean` | <optional> | Needs to be true if you need to layout before `DuESF.state` is `DuESF.State.RUNTIME`. That should be the case only for the main UI; Note that you should not need it anyway, `DuScriptUI.showUI` does that for you.

View Source Duik_api_fordoc.jsxinc, line 12192

#### # static library(container, library, optionsopt)

Adds a new `DuLibrary` to the container.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`container` | `Panel` | `Window` | `Group` |  | The ScriptUI Object which will contain and display the library.
`library` | `DuLibraryItem` |  | A library object. Key/value pairs, values being `DuLibraryItem` objects, keys being their display name.
`options` | `object` | <optional> | Options and other values.

View Source Duik_api_fordoc.jsxinc, line 15016

#### # static mainPanel(container, scriptNameopt, contentAlignmentopt, borderlessopt) → {DuPanel}

Creates the main panel for a script

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`container` | `Panel` | `null` |  |  | The container ('this' in the root of the calling script), either a Panel (when launched from the 'Window' menu) or null (when launched from 'file/scripts/run...')
`scriptName` | `string` | <optional> | DuESF.scriptName | A name for this UI
`contentAlignment` | `Array.<string>` | <optional> | DuScriptUI.defaultColumnAlignment | The alignment of the content in the panel
`borderless` | `string` | <optional> | false | When true, creates a borderless window if container is not a panel

View Source Duik_api_fordoc.jsxinc, line 10066

Returns:
The panel created, either a ScriptUI Panel or a ScriptUI Window.
Type: `DuPanel`

##### Example

    var ui = DuScriptUI.mainPanel(this,"Test Script");
    var refreshButton = ui.content.add('button',undefined,"Refresh");
    refreshButton.onClick = function() { ui.refreshUI( new File($.fileName) ); }; //reloads the current script
    DuScriptUI.showUI(ui);

#### # static moveInsideScreen(location, size) → {Array.<int>}

Moves the coordinates so that the size completely fits inside an existing screen

##### Parameters:

Name | Type | Description
--- | --- | ---
`location` | `Array.<int>` | The coordinates [top, left]
`size` | `Dimension` | The rectangle size, an object which has two properties: width and height

View Source Duik_api_fordoc.jsxinc, line 12746

Returns:
the new location
Type: `Array.<int>`

#### # static multiButton(container, textopt, imageopt, helpTipopt, ignoreUIModeopt) → {DuSelector}

Creates a multi button popup

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`container` | `Window` | `Panel` | `Group` |  |  | The ScriptUI Object which will contain and display the multi button.
`text` | `string` | <optional> |  | The text.
`image` | `string` | `DuBInary` | <optional> |  | The path to the icon (or a PNG as a string representation). Default: empty string
`helpTip` | `string` | <optional> |  | The help tip to show on the multi button
`ignoreUIMode` | `Boolean` | <optional> | false | Will show texte even if the ui mode is set to > 1 in the script settings

View Source Duik_api_fordoc.jsxinc, line 14378

Returns:
- The multiButton
Type: `DuSelector`

#### # static parentWindow(scriptUIControl) → {Window}

Finds the window containing this ScriptUI Control

##### Parameters:

Name | Type | Description
--- | --- | ---
`scriptUIControl` | `Control` | The ScriptUI Control

View Source Duik_api_fordoc.jsxinc, line 11148

Returns:
The containing ScriptUI Window
Type: `Window`

#### # static popUp(title, alignmentopt, modalopt) → {DuPopup}

Creates a borderless popup

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`title` | `string` |  |  | The title of the popup
`alignment` | `Array.<string>` | <optional> | [ "fill", "top" ] | The alignement of this window
`modal` | `boolean` | <optional> | false | Set the popup to a modal dialog

View Source Duik_api_fordoc.jsxinc, line 10212

Returns:
The popup, a ScriptUI Window which is borderless, with a 'tieTo(control)' method.
Type: `DuPopup`

##### Example

    var popup = DuScriptUI.popUp( );
    var popupButton = DuScriptUI.button( myUI, "My Buttton for the popup" );
    popup.tieTo( popupButton ); // will show the popup when the button is clicked, just above it.

#### # static removeEvent(id)

Removes a function previously added with `DuScriptUI.addEvent`.

##### Parameters:

Name | Type | Description
--- | --- | ---
`id` | `int` | The id of the function

View Source Duik_api_fordoc.jsxinc, line 15594

#### # static scriptPanel(container, addSettingsButtonopt, addHelpButtonopt, scriptFileopt) → {DuScriptPanel}

Creates the main panel of a script

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`container` | `Panel` | `null` |  |  | The container ('this' in the root of the calling script), either a Panel (when launched from the 'Window' menu) or null (when launched from 'file/scripts/run...')
`addSettingsButton` | `bool` | <optional> | true | Whether to create a button to open the settings or not
`addHelpButton` | `bool` | <optional> | false | Whether to create a button to open the help panel or not
`scriptFile` | `File` | <optional> |  | The main script file, needed for the refresh button in debug mode

View Source Duik_api_fordoc.jsxinc, line 10556

Returns:
The panel created, either a ScriptUI Panel or a ScriptUI Window.
Type: `DuScriptPanel`

##### Example

    var ui = DuScriptUI.mainPanel(this,"Test Script");
    var refreshButton = ui.content.add('button',undefined,"Refresh");
    refreshButton.onClick = function() { ui.refreshUI( new File($.fileName) ); }; //reloads the current script
    DuScriptUI.showUI(ui);

#### # static selectionModeSelector(minimalModeopt) → {DuSelector}

Creates a selector to choose a selection mode

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`minimalMode` | `DuAE.SelectionMode` | <optional> | DuAE.SelectionMode.SELECTED_PROPERTIES | The lowest mode to use

View Source Duik_api_fordoc.jsxinc, line 19610

Returns:
The selector
Type: `DuSelector`

#### # static selector(container, helpTipopt) → {DuSelector}

Creates a drop down selector, using image buttons

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`container` | `Window` | `Panel` | `Group` |  | The ScriptUI Object which will contain and display the selector.
`helpTip` | `string` | <optional> | The help tip to show on the selector

View Source Duik_api_fordoc.jsxinc, line 12905

Returns:
- The selector
Type: `DuSelector`

#### # static separator(container, nameopt, checkableopt, drawLineopt, translatableopt) → {DuSeparator}

Adds separator with an optionnal name in the group

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`container` | `Panel` | `Window` | `Group` |  |  | Where to create the separator
`name` | `string` | <optional> |  | The name displayed
`checkable` | `boolean` | <optional> | false | When true, adds a checkbox to the separator
`drawLine` | `boolean` | <optional> | true | Draws a line when there is no name. When false, the separator is an empty space
`translatable` | `boolean` | <optional> | true | If false, the name won't be translated

View Source Duik_api_fordoc.jsxinc, line 12296

Returns:
The separator
Type: `DuSeparator`

#### # static setBackgroundColor(uiItem, color, adjustedopt)

Changes the color of the background of a ScriptUI Object

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`uiItem` | `ScriptUI` |  |  | The ScriptUI Object
`color` | `Array` |  |  | The new color [R,V,B,A] Array
`adjusted` | `Boolean` | <optional> | true | lightens the color if the brightness setting of Ae is not set on the darkest one

View Source Duik_api_fordoc.jsxinc, line 12225

#### # static setTextColor(text, color, adjustedopt)

Changes the color of the text of a ScriptUI Object

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`text` | `ScriptUI` |  |  | The ScriptUI Object
`color` | `DuColor` |  |  | The new color
`adjusted` | `Boolean` | <optional> | false | lightens the color if the brightness setting of Ae is not set on the darkest one

View Source Duik_api_fordoc.jsxinc, line 12206

#### # static settingField(container, textopt, minimumLabelWidthopt) → {DuSettingField}

Creates a `DuSettingField` which can be enabled or disabled

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`container` | `Panel` | `Window` | `Group` |  | The ScriptUI Object which will contain and display the setting.
`text` | `string` | <optional> | The label of the setting
`minimumLabelWidth` | `int` | <optional> | The minmimum width of the label

View Source Duik_api_fordoc.jsxinc, line 15534

Returns:
The setting created.
Type: `DuSettingField`

#### # static setupScript(callback, uiopt, scriptNameopt, reInitopt, reInitMethodopt)

Runs the installation wizard for the script (asks for files and network access, asks the language...).

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`callback` | `function` |  |  | The function to execute when ready. This function should be the one which loads the script.
`ui` | `Panel` | `Window` | <optional> |  | A container to display the UI. A modal Dialog is created if omitted
`scriptName` | `string` | <optional> | DuESF.scriptName | The name of the script, used in the UI.
`reInit` | `boolean` | <optional> | false | Set to true to display to prompt to reinit/reinstall the script below the button to ask for file access.
`reInitMethod` | `function` | <optional> |  | A function to run in order to reinit/reinstall the script as soon as we get file access, before running the callback

View Source Duik_api_fordoc.jsxinc, line 18827

#### # static showUI(ui, enterRunTimeopt)

Resizes and shows the main panel of a script

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`ui` | `Panel` | `Window` |  |  | The UI created by Duik.ui.createUI
`enterRunTime` | `boolean` | <optional> | false | Set to true to automatically set DuESF to runtime state Set this to false if the ui shown is not the actual main panel of the script and it is shown before the main panel has been loaded.

View Source Duik_api_fordoc.jsxinc, line 10461

#### # static slider(container, defaultValueopt, minopt, maxopt, orientationopt, invertedAppearanceopt, prefixopt, suffixopt, textAlignmentopt, valueButtonsopt) → {DuSlider}

Creates a slider.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`container` | `Window` | `Panel` | `Group` |  |  | The ScriptUI Object which will contain and display the nice edit text.
`defaultValue` | `int` | <optional> | 0 | The initial value.
`min` | `int` | <optional> | 0 | The minimal value.
`max` | `int` | <optional> | 100 | The maximal value.
`orientation` | `string` | <optional> | 'column' | Either 'row' or 'column'
`invertedAppearance` | `boolean` | <optional> |  | Revert the slider with max value on the left
`prefix` | `string` | <optional> |  | A text prefix to display.
`suffix` | `string` | <optional> |  | A text suffix to display.
`textAlignment` | `string` | <optional> | 'center' | The alignment of the text. One of 'left', 'center', 'right' for column orientation, And 'top', 'center', 'bottom' for row orientation.
`valueButtons` | `Array.<int>` | <optional> | [] | A list of predefined values to add as buttons.

To Do:
  - implement helpTip

View Source Duik_api_fordoc.jsxinc, line 13765

Returns:
The custom Group containing the slider.
Type: `DuSlider`

#### # static smallbutton(container, text, helpTipopt, valueopt) → {DuButton}

Creates a small button.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`container` | `Panel` | `Window` | `Group` |  | The ScriptUI Object which will contain and display the button.
`text` | `string` |  | The label of the button. Default: empty string
`helpTip` | `string` | <optional> | The helptip. Default: empty string
`value` | `any` | <optional> | A user value stored in the button, which is passed to the onClick method

View Source Duik_api_fordoc.jsxinc, line 11604

Returns:
The image button created.
Type: `DuButton`

#### # static staticText(container, text, coloropt, localizeopt, multiLineopt) → {StaticText}

Creates a statictext (with an optionnal color).

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`container` | `Window` | `Panel` | `Group` |  |  | The ScriptUI Object which will contain and display the nice edit text.
`text` | `string` |  |  | The initial text in the edit.
`color` | `DuColor` | <optional> |  | The color of the text. By default, uses a slightly darker text than the Host App text color
`localize` | `bool` | <optional> | true | Set this to false to never translate this text.
`multiLine` | `bool` | <optional> | false | Set this to true to add a multiline text. Auto detected by default if the text contains the newline character.

View Source Duik_api_fordoc.jsxinc, line 13439

Returns:
The ScriptUI StaticText created.
Type: `StaticText`

#### # static stringPrompt(title, defaultString) → {DuPopup}

Creates a popup to ask for a simple string

##### Parameters:

Name | Type | Description
--- | --- | ---
`title` | `string` | The title of the popup
`defaultString` | `string` | The placeholder for the edit text

View Source Duik_api_fordoc.jsxinc, line 11089

Returns:
The popup, with an `onAccept( str )` callback.
Type: `DuPopup`

#### # static tabPanel(container, tabOrientation) → {DuTabPanel}

Creates a panel with tabs

##### Parameters:

Name | Type | Description
--- | --- | ---
`container` | `Window` | `Panel` | `Group` | The ScriptUI Object which will contain and display the panel.
`tabOrientation` | `string` | The orientation to use for tab buttons.

View Source Duik_api_fordoc.jsxinc, line 14075

Returns:
The panel.
Type: `DuTabPanel`

#### # static titleBar(container, titleopt, closeButtonopt, pinButtonopt) → {DuTitleBar}

Creates a titlebar

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`container` | `Panel` | `Window` | `Group` |  |  | The ScriptUI Object which will contain and display the titlebar.
`title` | `string` | <optional> | "" | The title.
`closeButton` | `Boolean` | <optional> | true | Wether to add a close button
`pinButton` | `Boolean` | <optional> | true | Wether to add a pin button

View Source Duik_api_fordoc.jsxinc, line 9977

Returns:
The titlebar
Type: `DuTitleBar`

#### # static toolBar(container, numColsopt) → {Group}

Creates a toolbar with a lighter background

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`container` | `Panel` | `Window` | `Group` |  | The ScriptUI Object which will contain and display the toolbar.
`numCols` | `int` | <optional> | The number of columns to use when adding the buttons.

View Source Duik_api_fordoc.jsxinc, line 14798

Returns:
The toolbar, a ScriptUI Group
Type: `Group`

#### # static versionButton(container, imageopt) → {DuButton}

Creates a button displaying the version of the script and redirecting to the about url.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`container` | `Panel` | `Window` | `Group` |  |  | The ScriptUI Object which will contain and display the button.
`image` | `string` | `DuBinary` | <optional> | DuESF.scriptIcon | The path to the icon or a png binstring. Default: empty string

View Source Duik_api_fordoc.jsxinc, line 11689

Returns:
The version button created.
Type: `DuButton`