DuAEF.DuScriptUI

ScriptUI tools

Members

static defaultColumnAlignment :Array.<String>

The default alignment of children of containers with "column" orientation
Default Value:
  • ["fill","top"]

static defaultMargins :int

The default margins of containers
Default Value:
  • 2

static defaultRowAlignment :Array.<String>

The default alignment of children of containers with "row" orientation
Default Value:
  • ["left","center"]

static defaultSpacing :int

The default spacing of containers
Default Value:
  • 2

static defaultStackAlignment :Array.<String>

The default alignment of children of containers with "stack" orientation
Default Value:
  • ["fill","top"]

static helpPanel

The panel where the help is displayed

static uiStrings

Stores all strings used by the UI.
This can be very useful to work with a translation framework.

Methods

static addButton(container, textopt, imageopt, helpTipopt, imageOveropt, imageDisabledopt) → {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 <optional>
The path to the icon. Default: empty string
helpTip string <optional>
The helptip. Default: empty string
imageOver string <optional>
image The path to an icon displayed when the mouse is over the button.
imageDisabled string <optional>
image The path to an icon displayed when the button is disabled.
Returns:
DuButton - The image button created.

static addCheckBox(container, text, image, helpTip, imageChecked, imageOver, textCheckedopt) → {DuCheckBox}

Creates a checkbox with an optionnal icon. Must have at least an icon or a text, or both.
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
image string The path to the icon. Default: empty string
helpTip string The helptip. Default: empty string
imageChecked string The path to an icon displayed when the button is checked. Default: empty string
imageOver string The path to an icon displayed when the mouse is over the button. Default: same as imageChecked
textChecked string <optional>
The label of the button displayed when it is checked.
Returns:
DuCheckBox - The image checkbox created.

static addCompSelector(container) → {CompSelector}

Creates a drop down selector for compositions
Parameters:
Name Type Description
container Window | Panel | Group The ScriptUI Object which will contain and display the selector.
Returns:
CompSelector - - The selector

static addEditText(container, text, prefixopt, suffixopt, placeHolderopt, helpTipopt, translatableopt) → {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
translatable bool <optional>
true Wether to translate the texts of this control
Returns:
DuEditText - The custom Group containing the edit text.

static addFolderSelector(container, textopt, textFieldopt, helpTipopt) → {TabPanel}

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 Wether to show the text field for the path.
helpTip string <optional>
'' The helptip for this control.
Returns:
TabPanel - The panel.

static addForm(container) → {Form}

Creates a layout to add forms to a UI, using ScriptUI groups.
You can easily add controls/fields to this form using DuAEF.DuScriptUI.addField
Parameters:
Name Type Description
container Window | Panel | Group The ScriptUI Object which will contain and display the form.
Returns:
Form - The custom Group containing the form.

static addGroup(container, orientationopt) → {Group}

Adds a group in a container, using DuAEF.DuScriptUI default alignments, and DuAEF.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.
Returns:
Group - The group created

static addLayerPicker(container) → {LayerPicker}

Creates a two-columns 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.
Returns:
LayerPicker - The picker.

static addLayerSelector(container) → {Selector}

Creates a drop down selector for layers
Parameters:
Name Type Description
container Window | Panel | Group The ScriptUI Object which will contain and display the selector.
Returns:
Selector - - The selector

static addRSSPanel(container, updateIntervalopt, rssUrlopt, titleColoropt, rssArgsopt, rssUserAgentVersionopt, rssPortopt) → {TabPanel}

Creates a panel which displays RSS feed.
DuRSS uses a cache system and gets the content online only if more time than a given interval has passed, otherwise it gets the contents from cache.
Parameters:
Name Type Attributes Default Description
container Window | Panel | Group The ScriptUI Object which will contain and display the panel.
updateInterval int <optional>
3600 The minimum interval between two updates of the feed (in seconds).
rssUrl string <optional>
The url of the RSS server.
titleColor string <optional>
The color for the title of articles.
rssArgs string <optional>
'feed' The subdirectory/arguments to append to the url (without a leading '/')
rssUserAgentVersion string <optional>
'DUAEF/0.0.0' Your script version name and number to be used as a user agent to connect to the server
rssPort int <optional>
80 The server port.
Returns:
TabPanel - The panel.

static addSelector(container) → {Selector}

Creates a drop down selector, using image buttons
Parameters:
Name Type Description
container Window | Panel | Group The ScriptUI Object which will contain and display the selector.
Returns:
Selector - - The selector

static addSeparator(container, nameopt, checkableopt, drawLineopt) → {Separator}

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
Returns:
Separator - The separator

static addSimpleCheckBox(container, textopt, helpTipopt, coloropt) → {SimpleCheckBox}

Creates a checkbox which can be colored, and changes color on hover
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.
helpTip string <optional>
The helptip.
color color <optional>
DuAEF.DuJS.Color.Colors.LIGHT_GREY The color of the text
Returns:
SimpleCheckBox - The image checkbox created.

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

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.
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.
Returns:
DuSlider - The custom Group containing the slider.
To Do:
  • implement helpTip

static addSmallButton(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
Returns:
DuButton - The image button created.

static addStaticText(container, text, coloropt, translatableopt, 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 Array.<int> <optional>
The color of the text.
translatable bool <optional>
true Set this to false to never translate this text.
multiline bool <optional>
Set this to true to add a multiline text.
Returns:
StaticText - The ScriptUI StaticText created.

static addTabPanel(container, showTitleopt) → {DuTabPanel}

Creates a panel with tabs
Parameters:
Name Type Attributes Default Description
container Window | Panel | Group The ScriptUI Object which will contain and display the panel.
showTitle boolean <optional>
true Wether to show the titles of the tabs or not.
Returns:
DuTabPanel - The panel.

static adjustColor(color) → {Array.<float>}

Adjust the color according to the brightness setting of After Effects
Parameters:
Name Type Description
color Array.<float> The color [R,V,B,A] Array
Returns:
Array.<float> - - The new color [R,V,B,A] Array

static askFilesAndNetworkAccess(ui, callback, scriptNameopt, reInitopt, reInitMethod)

Displays an invitation to enable file and network access.
Use this method before loading any scripts which needs this authorization.
Parameters:
Name Type Attributes Default Description
ui Panel | Window A container to display the UI.constructor
callback function The function to execute when the user has granted access to file and network.
This function should be the one which loads the script.
scriptName string <optional>
DuAEF.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 A function to run to reinit/reinstall the script as soon as we get file access, before running the callback

static buildAllTabs()

Builds all the tabs from all the tab panels

static createLayerPickerDialog(title) → {LayerPickerDialog}

Creates a dialog with a LayerPicker
Use DuAEF.DuScriptUI.showUI to show it after creation.
Parameters:
Name Type Description
title string The title of the dialog.
Returns:
LayerPickerDialog - The dialog window.

static createPopup(title, alignmentopt) → {DuPopup}

Creates a borderless popup
Parameters:
Name Type Attributes Default Description
title string The title of the popup
alignment Array.<string> <optional>
DuAEF.DuScriptUI.defaultColumnAlignment The alignement of this window
Returns:
DuPopup - The popup, a ScriptUI Window which is borderless, with a 'tieTo(control)' method.
Example
var popup = DuAEF.DuScriptUI.createPopup( );
var popupButton = DuAEF.DuScriptUI.addButton( myUI, "My Buttton for the popup" );
popup.tieTo( popupButton ); // will show the popup when the button is clicked, just above it.

static createUI(container, scriptName, contentAlignmentopt, borderlessopt) → {DuPanel}

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...')
scriptName string A name for this UI
contentAlignment Array.<string> <optional>
DuAEF.DuScriptUI.defaultColumnAlignment The alignment of the contents in the panel
borderless string <optional>
false When true, creates a borderless window if container is not a panel
Returns:
DuPanel - The panel created, either a ScriptUI Panel or a ScriptUI Window.
Example
var ui = DuAEF.DuScriptUI.createUI(this,"Test Script");
var refreshButton = ui.contents.add('button',undefined,"Refresh");
refreshButton.onClick = function() { ui.refreshUI( new File($.fileName) ); }; //reloads the current script
DuAEF.DuScriptUI.showUI(ui);

static layout(item)

Resets the layout of the whole ui containing a scriptUI item.
Parameters:
Name Type Description
item ScriptUI The ScriptUI element which needs to be resized

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 bool <optional>
true lightens the color if the brightness setting of Ae is not set on the darkest one

static setTextColor(text, color, adjustedopt, fauxBoldopt)

Changes the color of the text of a ScriptUI Object
Parameters:
Name Type Attributes Default Description
text ScriptUI The ScriptUI Object
color Array.<float> The new color [R,V,B,A] Array
adjusted bool <optional>
true lightens the color if the brightness setting of Ae is not set on the darkest one
fauxBold bool <optional>
false

static showAbout()

Shows the about popup

static showHelp()

Shows the help popup

static showNews()

Shows the news popup

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

static updateHelpPopup(title, text, link)

Updates the helpPopup with new information
Parameters:
Name Type Description
title string A title.
text string The help text.
link string The http link to a webpage