In creating a custom dialog for Adobe InDesign, a script can take advantage of a variety of widgets for user input fields. In our previous blog we worked with a text editbox, a dropdown, a checkbox control, and an enabling group. In this discussion we will look at the remaining widgets which can be used with InDesign’s dialog object:

  • border panel
  • editboxes (angle, integer, measurement, percent, and real)
  • comboboxes (angle, integer, measurement, percent, and real)
  • radio button groups and controls


A border panel provides a visible means of organizing widgets within a dialog. It can act similar to a dialog row in that a static text and another element such as an editbox or combo box when placed inside a border panel will occupy the same row. We will use the border panel as part of a test script to illustrate using the various widgets. For this we will start with an integer editbox. The integer editbox is similar to a text editbox with the exception that only a string value that can be converted to an integer can be used for the default edit value. Copy the sample script below and place it in a new AppleScript script. Later, you will use it for testing the other dialog widgets.

Test Script

    set defaultValue to 111
    set uResponse to customDialog("test", defaultValue)
    (*Create dialog handler*)
    on customDialog(dialogName, defaultValue)
       tell application "Adobe InDesign CC 2015"
          --make sure user interaction level is set to interact with all
          set origLevel to user interaction level of script preferences
          set user interaction level of script preferences to interact with all
          --create the dialog, place reference to dialog in a variable
          set dlgRef to make dialog with properties {name:dialogName, can cancel:false, label:""}
          --create parent column inside which all other dialog fields will be created
          tell dlgRef
             set colRef to make dialog column
             tell colRef
                --add border panel
                set panelRef to make border panel
             end tell --colRef
             tell panelRef
                make static text with properties {static label:"Test Editbox:"}
                set testField to make integer editbox with properties {min width:200, edit value:defaultValue, maximum value:500, minimum value:100, small nudge:1, large nudge:10}
            end tell --panelRef
          end tell --dialog
          --show dialog and test whether user clicks cancel or OK
          set willContinue to show dlgRef
          if willContinue then
             --place values from dialog fields in variables
             set testValue to edit value of testField
          end if
          --destroy the dialog
          destroy dlgRef
          --reset script preferences
          set user interaction level of script preferences to origLevel
          --return values from dialog fields
          return testValue
       end tell --application
    end customDialog 

Notice that the value for can cancel above was set to false. With this, the user cannot cancel the dialog so the script does not have to provide for the error that would be created should the user click cancel.

Run the script as is and check the value for the result returned (111.0). Notice that the return value is a real even though the field is an integer editbox. (A fact that has often irked me in using an integer widget.) Next, run the script, but enter a real value in the edit field (one with a decimal value). Make sure the value falls in the range between 100 and 500. Notice that the value returned is a real that has been rounded with a decimal value of zero (0).

For the third test, run the script and try to enter a number lower than 100 or greater than 500.


Now that you have had some experience with the integer editbox, try the same script for the following editboxes: real editbox, angle editbox, and percent editbox. Inside the tell panelRef statement block, substitute the type of editbox to use but keep the same values for the property list. When you test the script, notice that the angle editbox adds a degree symbol after the edit value entry. Similarly, the percent editbox adds a percent symbol.


Measurement editboxes are similar to the other editboxes with the exception that it has an additional property: edit units. This can be any one of Adobe’s measurement values such as points, picas, inches, inches decimal, and more. Behind the scenes, InDesign performs calculations that may cause some confusion. It converts the edit value to points irrespective of the edit unit in place. To understand how this works, the following tests are provided:

Test One

Change the second line inside the tell panelRef code block to read as follows:

set testField to make measurement editbox with properties {min width:200, edit value:defaultValue, maximum value:216, minimum value:24, small nudge:1, large nudge:12, edit units:picas}

For the value of the defaultValue that is passed to the handler, change it to 2.

When you attempt to run the script, you should get the following error: The value must be between 2p0 and 18p0. Apparently, 2 is less than 2p0.

Test Two

Change the value for the defaultValue variable to 24. When you run the script you should see the following screen.

measurement editbox

If you leave the value as the default, the value returned will be 24.0. Try the script with different values for the defaultValue as well as different measurement units for the testField’s  edit units property. Continue until you feel that you understand the concept.


Comboboxes are similar to editboxes with the exception that in addition to the entry field, the combobox has a dropdown which takes a string list for its value. The string list property for the dropdown must be a list of strings that can be converted to number values. To understand the concept, change the following values in the test script above.

In the tell panelRef code block:

   set testField to make integer combobox with properties {min width: 200, edit value:123, maximum value:600, minimum value:100, small nudge:1, large nudge:10, string list:defaultValue}

At top of the script:

   set defaultValue to {"111", "222", "333", "444", "555"}

Run the script and click OK without changing the value in the entry field. Test the script again by selecting a value from the dropdown. Next, try entering a number in the entry field that is not an integer. For this last test, the entry box accepts the number entered but the dialog returns a real value that is rounded with 0 as the decimal value.

testing combobox


When you have a number of entry fields of the same type, you might consider using a repeat loop to save some of the code required. This works extremely well for radiobutton controls and checkbox controls. The way this is done is to have a list of global label values designated at the top of the script. When the fields are created, a reference to the field is placed into a list.

Radiobutton Constrols

Because only a single radio button control can have its checked state set to true, the script can get the selected button value of the group. This index starts with zero (0), so the script needs to add a one (1) to the value returned. Again, to test, modify the test script above using the following:

At the top of the script:

    global labelList
    set labelList to {"Draft", "Confidential", "Read Only", "Secure"}
    set defaultValue to {true, false, false, false}

Inside the tell panelRef code block:

    make static text with properties {static label: "Choose Watermark:"}
    set objectList to {}
    set groupRef to make radiobutton group
    tell groupRef
       repeat with i from 1 to length of labelList
          set end of objectList to make radiobutton control with properties {static label:item i of labelList, checked state: item i of defaultValue}
       end repeat
    end tell --groupRef

Inside the if conditional near the end of the script:

    set buttonSelected to (selected button of groupRef) + 1
    set testValue to item buttonSelected of labelList

radiobutton control group


Checkbox Controls

For a number of checkbox controls, the procedure would be similar to that of the radiobutton controls.

Inside the tell panelRef code block:

    set objectList to {}
    tell make dialog column
        repeat with i from 1 to length of labelList
            set end of objectList to make checkbox control with properties {static label: item i of labelList, checked state: item i of defaultValue}
        end repeat
    end tell --dialog column

The result of the checkbox controls is placed in a list using the following code inside the if conditional near the end of the script:

    set testValue to {}
    repeat with i from 1 to length of objectList
        set end of testValue to checked state of item i of objectList
    end repeat
Checkbox controls

Notice the checkbox controls were created inside a tell statement that created a dialog column. If you are curious, try the script without the dialog column.


Now that you have experienced working with a custom dialog in Adobe InDesign, don’t hesitate to use a custom dialog in your next script. There may be a little code required, but you can get all the information you need from the user with a single interaction. Besides, coding the dialog is not as hard as you might have thought. Try it.


No responses yet

Leave a Reply

Your email address will not be published. Required fields are marked *