Using Palettes To Manage Scripts; Using The Scripts Palette - Adobe 27510753 - InDesign CS2 - PC Manual

Scripting guide
Hide thumbs Also See for 27510753 - InDesign CS2 - PC:
Table of Contents

Advertisement

40
Getting Started with InDesign Scripting
}
else {
//No documents are open, so display an error message.
alert("No InDesign documents are open. Please open a document and try again.")
}
You can also use JavaScript's "try...catch" statement for error handling, as shown in the example below:
//Display the type of the first item in the selection.
try {
myObjectType = app.selection[0].constructor.name;
alert("The first selected item is a " + myObjectType + " object.");
}
catch (e){
if (app.documents.length == 0){
//No documents are open, so display an error message.
alert("No InDesign documents are open. Please open a document and try again.");
}
else {
if (app.selection.length == 0){
//Nothing is selected, so display an error message.
alert("Nothing is selected. Please select an object and try again.");
}
else{
alert("An error occurred, but I'm not sure what it was.");
}
}
}

Using palettes to manage scripts

Using the Scripts palette

The InDesign Scripts palette provides the easiest and best way to run most InDesign scripts. To display the
Scripts palette, choose Window > Automation > Scripts (if the palette is not already visible).
If the Scripts palette is not available, it's because the plug-in is not installed or has been disabled. Use the
plug-in manager to enable the plug-in, or reinstall the Scripts palette.
If you want to run a JavaScript in InDesign, you must have the Scripts palette installed.
Here are some common actions using the Scripts palette:
To add a script to the Scripts palette, put the script into the Scripts folder inside the Presets folder in your
l
InDesign folder. You can run compiled or uncompiled AppleScripts, JavaScripts (.jsx), VBScripts (.vbs), or
executable programs from the Scripts palette. You can also put file aliases (Mac OS) or shortcuts (Windows)
to files or folders in this folder. When you return to InDesign, the file names of the script files (or folders)
that you placed in the folder appear in the Scripts palette.
To run a script from the Scripts palette, double-click the name of the script in the palette. Scripts run from
l
the Scripts palette run faster than scripts run from the Finder (Mac OS) or Explorer (Windows). When you
Adobe InDesign CS2 Scripting Guide

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Indesign cs2

Table of Contents