Path Text; Autocorrect; Footnotes - Adobe 0046100128056 - InDesign - Mac Manual

Javascript
Table of Contents

Advertisement

C
6: Text and Type
HAPTER

Path Text

You can add path text to any rectangle, oval, polygon, graphic line, or text frame. The following script
fragment shows how to add path text to a page item (for the complete script, see PathText):
//Given a document "myDocument" with a rectangle on page 1...
var myPage = myDocument.pages.item(0);
var myRectangle = myPage.rectangles.item(0);
var myTextPath = myRectangle.textPaths.add({contents:"This is path text."});
To link text paths to another text path or text frame, use the
properties, just as you would for a text frame (see

Autocorrect

The autocorrect feature can correct text as you type. The following script shows how to use it (for the
complete script, see Autocorrect):
//The autocorrect preferences object turns the
//autocorrect feature on or off.
app.autoCorrectPreferences.autoCorrect = true;
app.autoCorrectPreferences.autoCorrectCapitalizationErrors = true;
//Add a word pair to the autocorrect list. Each AutoCorrectTable is linked
//to a specific language.
var myAutoCorrectTable = app.autoCorrectTables.item("English: USA");
//To safely add a word pair to the auto correct table, get the current
//word pair list, then add the new word pair to that array, and then
//set the autocorrect word pair list to the array.
var myWordPairList = myAutoCorrectTable.autoCorrectWordPairList;
//Add a new word pair to the array.
myWordPairList.push(["paragarph", "paragraph"]);
//Update the word pair list.
myAutoCorrectTable.autoCorrectWordPairList = myWordPairList;
//To clear all autocorrect word pairs in the current dictionary:
//myAutoCorrectTable.autoCorrectWordPairList = [[]];

Footnotes

The following script fragment shows how to add footnotes to a story (for the complete script, including
the
myGetRandom
var myDocument = app.documents.item(0);
var myPage = myDocument.pages.item(0);
var myTextFrame = myPage.textFrames.item(0);
//Add four footnotes at random locations in the story.
for(myCounter = 0; myCounter < 4; myCounter ++){
myWord = myTextFrame.parentStory.words.item(myGetRandom(0,
myTextFrame.parentStory.words.length));
var myFootnote = myWord.insertionPoints.item(-1).footnotes.add();
//Note: when you create a footnote, it contains text--the footnote marker
//and the separator text (if any). If you try to set the text of the footnote
//by setting the footnote contents, you will delete the marker. Instead, append
//the footnote text, as shown below.
myFootnote.insertionPoints.item(-1).contents = "This is a footnote.";
}
function, see Footnotes):
nextTextFrame
"Working with Text Frames" on page
Path Text 108
and
previousTextFrame
86).

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Indesign cs5

Table of Contents