Site logo

Script UI

Script UI bugs

ScriptUI EditText with custom border (Win & Mac) by Marc Autret

On Mac OS, the EditText widget is subject to a specific focus ring wich automatically allocates 2 or 3 additional transparent pixels all around the field! Hence, if the control is nested within a background-colored group, that color is revealed through this additional space.
 From that point you need to apply two fixes:
(1) create a white subgroup between the outer group and the EditText to make sure that the revealed background fits the EditText background
(2) make the EditText borderless to inhibits its own stroke.

// ScriptUI EditText with custom border (Win & Mac)
// ========================== 
var STROKE_COLOR = [1,0,0],    // red
    STROKE_WEIGHT = 1,        // in pixels
    FILL_COLOR = [1,1,1],    // white
    INSET_SPACE = 3;        // in pixels -- Mac OS focus ring needs it >=3
var u,
    w = new Window('dialog'),
    // ---
    gBorder = w.add('panel').add('group'),
    gSpacer = gBorder.add('group'),
    e = gSpacer.add('edittext', u, u, {borderless:true}),
    // ---
    bCancel = w.add('button', u, "Cancel"),
    // ---
    gx =,
// Edit field settings
// ---
e.characters = 12;
gBorder.margins = STROKE_WEIGHT; = gx.newBrush(SOLID_BRUSH, STROKE_COLOR );
gSpacer.margins = INSET_SPACE;  = = gx.newBrush(SOLID_BRUSH, FILL_COLOR );;

Underlined StaticText by Marc Autret

Original link is here

var u,
    w = new Window('dialog', "Underline Me!"),
    s1 = w.add('statictext', u, "Not Underlined"),
    s2 = w.add('statictext', u, "Underlined"),
    b = w.add('button', u, "OK"),
    // ---
    wgx =,
    linePen = wgx.newPen(wgx.PenType.SOLID_COLOR,[0,0,0], 1);
s2.preferredSize[1] += 3;
s2.onDraw = function(/*DrawState*/)
    var gx =,
        sz = this.preferredSize,
        y = sz[1]-1;
    gx.moveTo(0, y);

Custom Radial Buttons by Brett Gonterman

Click here to download.

ScriptUI Tips and Tricks by Marc Autret

testScroller.js by Marc Autret -- Demonstrates ScriptUI Scrollbar usage

Scrollable alert by Marijan Tompa

Scrolling panel by Bob Stucky

Understanding myWidget.onDraw

Updating Image widgets

Apply a custom border to an EditText

Spin progress bar by Marc Autret

ScriptUI Fonts Facts by Marc Autret

ScriptUI Custom Eventsnew UIEvent(…) works fine in InDesign (CS4/CS5/CS6) provided that you let the view parameter undefined.

See Your Swatches in ScriptUI by Marc Autret

The original discussion is here.

Example of a dynamic “folder” dialog box