• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

Scripting UI Options

LEGEND ,
Sep 19, 2011 Sep 19, 2011

Copy link to clipboard

Copied

InDesign offers numerous ways of creating user interfaces for scripts. As a general rule, the more capable the UI must be, the more complex it will be to build it. Below is an overview of the options available:

Native InDesign Dialogs

InDesign is unique among the Creative Suite applications in that it offers its own dialog functionality. These dialogs are by far the easiest to create -- and there are some great built-in widgets, but there are a couple of limitations:

  1. Only window type available are dialogs. No non-modal palettes or the like.
  2. Native InDesign dialogs are completely static. You can not change the dialog once it's created, and it can not react to user input in a dynamic way.

If these limitations are not a problem for your UI, go with the native dialogs. They are the quickest and easiest way. Look at the InDesign DOM documentation for app.dialogs for usable wigets and types.

Script UI

InDesign CS3 introduced Script UI.

Script UI offers many advanced features not available in the native InDesign dialogs. These include:

  1. Three window types can be used: "Dialog", "Window", and "Palette".
  2. Script UI offers an advanced event architecture which allows to dynamically change the dialog based on user input.
  3. Script UI includes basic drawing tools which can be used to customize the look of the UIs.
  4. Images can be used in the UI as well.

The learning curve for script UI is much steeper than the basic dialogs, and building them requires much more code.

There are two third-party tools available for making the creation of Scipt UI dialogs easier: Rapid Script UI and Script UI Builder. Each uses a different approach, so it pays to check them both out.

For further information on Script UI, I recommend reading the Javascript Tools Guide available from within the ExtendScript Toolkit. Make sure to look at the included sample scripts.

Another excellent resource is Peter Kahrel's "ScriptUI for dummies" which is for dummies and non dummies alike!

Embedded Flash UI

Flash swf files can be embedded in Script UI containers. Any kind of swf files can be played -- including movies. For Script UIs, you would usually be more interested in UI elements. Most developers would create these swf files using Flash Builder, but you could use any application which can create interactive swf movies for this (including but not limited to Flash).

It is possible embed one swf for the whole dialog, or embed mulitple swfs into different parts of a dialog. The Flex framework makes building advanced dialogs much easier.

Communication between the swf and ExtendScript is accomplished using callbacks. Refer to the Javascript Tools Guide and the sample scripts for more information.

Debugging the swfs can be done using Flash Builder, but to do that you need to enable debugging in InDesign. The method for doing that changed in CS5. Prior to CS5, a special debug OWL plugin needed to be installed. This was available as part of the discontinued PatchPanel project. In CS5 and later, debugging is enabled by using an undocumented creation attribute of the FlashPlayer. Something like this:

var debugMode = true;

d.fp = d.add("flashplayer", undefined, d.swfFile, {enableDebugger: debugMode});

CS SDK Flash UI

CS5 introduced a whole new type of UI. The CS SDK enables flash UIs to acheive much tighter integration and can be loaded in panels. An additional adavntage to the CS SDK is the fact that CSXS modal dialogs can change the InDesign object model -- something not possible using any of the other UI options.

For more information on the CS SDK, visit the Extension Builder and CS SDK forums.

Native OS Dialogs

For those familiar with AppleScript or Visual Basic, it is possible to use these OS native technologies to build UIs. You would generally run the script in either VB or AppleScript using these UIs, but it is possible to run ExtendScript code as well using app.doScript().

Other Options

Other options can include just about anything. People have been known to use REALBasic and other technologies to build UIs. If you use an outside technology, you will need some way to communicate with InDesign. One way of doing this is to use Visual Basic on Windows or AppleScript on Mac.

TOPICS
Scripting

Views

24.8K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Oct 21, 2012 Oct 21, 2012

Copy link to clipboard

Copied

LATEST

Thanks for posting this, Harbs! This portion of the API is poorly documented, so this was a super help! Turning on the debugger allowed me to discover an otherwise invisible issue.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines