Sunday, January 01, 2006
DiscussionAs is implicit in the names of the enumerated values (the first four, anyway), this value is relative to some object or to the members of a collection of objects. The purpose of the fifth value, the "unknown" location option, is not at all clear. You certainly would never use it when calling a method that takes a location as an argument (e.g., a move method).
There are times when InDesign loses track of the location of various items. For example, in order to speed the progress of scripts, they generally run with window updating and story composing switched off. In these circumstances, I could see a method returning the unknown location value, except that a careful check of the reference guide reveals that not a single method returns this information. Perhaps it's there for future expansion.
Because this enumeration is only ever used as an argument when calling a method, the numerical values above have little more than academic interest. You could use them if you wished, but the result would be a more obscure script -- of course, there are times when obscurity has value, but most of the time you're better off writing "in the clear" by using the named variants.
Usage ExamplesMany variants of the move() method have a to argument that takes a member of this enumeration as a parameter. Similarly, some add() methods have an at argument to indicate where a new object should be added, and some duplicate() methods have the to argument.
To move the first paragraph of text frame myTF to the end of story myStory:
myTF.paragraphs.move(LocationOptions.atEnd, myStory);To move a range of paragraphs in a story to before another paragraph in the same story (as you might do if you received a Word document with sections in the wrong order):
myStory.paragraphs.itemByRange(ObjStart,i-1).move(LocationOptions.before,myStory.paragraphs[IntroStart]);To add a new row to the end of table myTable:
myTable.rows.add(LocationOptions.atEnd,myTable);To add a new page to a document immediately after page myPage, updating the reference contained in myPage to refer to the newly added page:
myPage = myDocument.pages.add(LocationOptions.after, myPage);To duplicate page n of document myFdoc after the last page of document myDoc:
myFdoc.pages[n].duplicate(LocationOptions.after,myDoc.pages[-1]);This is equivalent to:
myFdoc.pages[n].duplicate(LocationOptions.atEnd,myDoc);Sometimes, the form you use for an operation like this depends on the way you happen to think about the maneuver.