EasyManua.ls Logo

Adobe 0046100128056 - InDesign - Mac - Splitting All Frames in a Story; Creating an Anchored Frame

Adobe 0046100128056 - InDesign - Mac
209 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
CHAPTER 6: Text and Type Working with Text Frames 89
Splitting all frames in a story
The following script fragment shows how to split all frames in a story into separate, independent stories,
each containing one unlinked text frame (for the complete script, see SplitStory):
if(app.documents.length != 0){
if(app.selection.length != 0){
//Get the first item in the selection.
var mySelection = app.selection[0];
//Process the selection. If text or a text frame is
//selected, do something; otherwise, do nothing.
switch(mySelection.constructor.name){
case "Text":
case "InsertionPoint":
case "Character":
case "Word":
case "Line":
case "TextStyleRange":
case "Paragraph":
case "TextColumn":
case "TextFrame":
//If the text frame is the only text frame in the story, do nothing.
if(mySelection.parentStory.textContainers.length != 1){
//Splitting the story is a two-step process: first, duplicate
//the text frames, second, delete the original text frames.
mySplitStory(mySelection.parentStory);
myRemoveFrames(mySelection.parentStory);
}
break;
}
}
}
Here is the mySplitStory function referred to in the preceding script:
function mySplitStory(myStory){
var myTextFrame;
//Duplicate each text frame in the story.
for(var myCounter = myStory.textContainers.length-1; myCounter >= 0;
myCounter --){
myTextFrame = myStory.textContainers[myCounter];
myTextFrame.duplicate();
}
}
function myRemoveFrames(myStory){
//Remove each text frame in the story. Iterate backwards to
//avoid invalid references.
for(var myCounter = myStory.textContainers.length-1; myCounter >= 0; myCounter --){
myStory.textContainers[myCounter].remove();
}
}
Creating an anchored frame
To create an anchored frame (also known as an inline frame), you can create a text frame (or rectangle,
oval, polygon, or graphic line) at a specific location in text (usually an insertion point). The following script
fragment shows an example (for the complete script, see AnchoredFrame):

Table of Contents

Related product manuals