Adobe 0046100128056 Scripting Guide - Page 88
Here is the myBreakFrames function referred to in the preceding script.
UPC - 718659087562
View all Adobe 0046100128056 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 88 highlights
CHAPTER 6: Text and Type Working with Text Frames 88 myObjectList.push(app.selection[myCounter]. parentTextFrames[0]); break; } } break; } } //If the object list is not empty, pass it on to the function //that does the real work. if(myObjectList.length != 0){ myBreakFrames(myObjectList); } } } Here is the myBreakFrames function referred to in the preceding script. function myBreakFrames(myObjectList){ myObjectList.sort(myReverseSortByTextFrameIndex); for(var myCounter = 0; myCounter < myObjectList.length; myCounter ++){ myBreakFrame(myObjectList[myCounter]); } } function myBreakFrame(myTextFrame){ if((myTextFrame.nextTextFrame != null)&&(myTextFrame.previousTextFrame != null)){ var myNewFrame = myTextFrame.duplicate(); if(myTextFrame.contents != ""){ myTextFrame.texts.item(0).remove(); } myTextFrame.remove(); } } function myReverseSortByTextFrameIndex(a,b){ //By combining the story id with the text frame index, we can sort the text frames //into the right (reverse) order in a single pass. $.write("padded a: " + myPadString(a.id, 8)+myPadString(a.textFrameIndex, 8)); $.write("padded b: " + myPadString(b.id, 8)+myPadString(b.textFrameIndex, 8)); if((myPadString(a.id, 8)+myPadString(a.textFrameIndex, 8)) > (myPadString(b.id, 8)+myPadString(b.textFrameIndex, 8))){ return -1; } if((myPadString(a.id,8)+myPadString(a.textFrameIndex,8)) < (myPadString(b.id,8)+myPadString(b.textFrameIndex,8))){ return 1; } return 0; } function myPadString(myString, myLength) { var myTempString = ""; var myNewLength = myLength-String(myString).length; for (var myCounter = 0; myCounter