About Scripting Languages; Javascript; Windows - Adobe 65024872 - InDesign CS4 - Mac Manual

Scripting guide
Hide thumbs Also See for 65024872 - InDesign CS4 - Mac:
Table of Contents

Advertisement

Adobe InDesign CS4 Scripting Tutorial
Getting started 7
Scripts generally run as a series of actions, which means you can undo the changes the script made to a
document by choosing Undo from the Edit menu. This can help you troubleshoot a script, as you can step
backward through each change. Scripts can change the undo mode and store all of the script actions as a
single undo step. This can significantly speed up script execution. For more on how to do this, refer to the
Adobe InDesign CS4 Scripting Guide for the scripting language of your choice.
To add a keyboard shortcut for a script, choose Edit > Keyboard Shortcuts, select an editable shortcut set
from the Set menu, then choose Product Area > Scripts. A list of the scripts in your Scripts panel appears.
Select a script and assign a keyboard shortcut as you would for any other InDesign feature.

About scripting languages

The language you use to write scripts depends on the scripting system of your platform: AppleScript for
Mac OS, VBScript for Windows, or JavaScript for either platform. Although the scripting languages differ,
the ways they work with InDesign are very similar.
Each sample script in this document is shown in all three scripting languages. Translating a script from one
language to another is fairly easy.

JavaScript

InDesign supports JavaScript for cross-platform scripting in both Mac OS and Windows. InDesign's
JavaScript support is based on an Adobe implementation of JavaScript known as ExtendScript. The
ExtendScript interpreter conforms to the current, ECMA 262 standard for JavaScript. All language features
®
of JavaScript 1.5 are supported. Adobe Illustrator®, Adobe Photoshop®, and other Adobe Creative Suite
products also use the ExtendScript JavaScript interpreter.
While you can write scripts using other versions of JavaScript, like Microsoft® JScript (in Windows) or Late
Night Software's OSA JavaScript (on the Mac OS), the terms you use in those languages are not the same as
the terms you use in ExtendScript. ExtendScript examples do not work in other JavaScript versions.
N
: Because ExtendScript tools and features are used in several Adobe products, we consolidated all
OTE
ExtendScript documentation. To learn more about JavaScript utilities like the ScriptUI user-interface
module and the ExtendScript Toolkit (a JavaScript development environment and object-model
inspector), see Creative Suite 4 JavaScript Tools Guide.

Windows

To use InDesign scripting in Windows, you can use either JavaScript or some version of Microsoft Visual
Basic, such as VBScript.
The Visual Basic tutorial scripts are written in VBScript. We chose VBScript because no added software is
required to run or edit VBScripts; you can edit them with any text editor (like Notepad) and run them using
the InDesign Scripts panel.
Other versions of Visual Basic include Visual Basic 5 Control Creation Edition (CCE), Visual Basic 6, Visual
Basic .NET, and Visual Basic 2005 Express Edition. Versions of Visual Basic prior to Visual Basic .NET work
well with InDesign scripting. Visual Basic .NET and newer versions work less well, because they lack the
data type, which is used extensively in InDesign scripting.
Variant
Many applications contain Visual Basic for Applications (VBA), like Microsoft Word, Microsoft Excel,
Microsoft Visio, or AutoCAD. Although you can use VBA to create InDesign scripts, InDesign does not
include VBA.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Indesign cs4

Table of Contents