Walking Through The Script - 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
Save the script as a text file with the
on page
6). To run the script, double-click the script name in the Scripts panel.

Walking through the script

Examining the script presented above, here is a step-by-step analysis of what the script does (in each
scripting language):
1. Establish communication with the InDesign application object:
AppleScript:
JavaScript:
VBScript:
2. Create a new document and a reference to the document:
AppleScript:
JavaScript:
VBScript:
3. Create a new text frame on the first page and a create a reference to the text frame.:
AppleScript:
JavaScript:
VBScript:
4. Set the geometric bounds (the location of the top, left, bottom, and right edges) of the text frame. In
this step, the script uses measurement overrides ("p" for picas) to ensure the text frame is the correct
size, regardless of your default measurement units. The locations are provided as a list, or array, of val-
ues; each scripting language has a slightly different way of creating an array. For more on array vari-
ables, see
AppleScript:
JavaScript:
VBScript:
5. Add text to the text frame by setting the contents property to a string.:
AppleScript:
JavaScript:
VBScript:
.vbs
tell application "Adobe InDesign CS4"
Refer to the application as
Set myInDesign = CreateObject("InDesign.Application.CS4")
Set myDocument to make document
Var myDocument = app.documents.add();
Set myDocument = myInDesign.Documents.Add
tell page 1 of myDocument
set myTextFrame to make text frame
var myTextFrame = myDocument.pages.item(0).textFrames.add();
Set myTextFrame = myDocument.Pages.Item(1).TextFrames.Add
"Array variables" on page
set geometric bounds of myTextFrame to {"6p", "6p", "24p", "24p"}
myTextFrame.geometricBounds = ["6p", "6p", "24p", "24p"];
myTextFrame.GeometricBounds = Array("6p", "6p", "24p", "24p")
set contents of myTextFrame to "Hello World!"
myTextFrame.contents = "Hello World!";
myTextFrame.Contents = "Hello World!"
file extension to the Scripts Panel folder (see
.
app
14.
Getting started 10
"Installing scripts"

Advertisement

Table of Contents
loading

This manual is also suitable for:

Indesign cs4

Table of Contents