Home › Forums › General XMetaL Discussion › xmetal selection ReadonlyContainer value › Reply To: xmetal selection ReadonlyContainer value
Reply to: xmetal selection ReadonlyContainer value
October 15, 2013 at 8:24 pmHaving no idea what your document structures look like it is difficult to give the best answer.
However, if there is only one
//XMetaL Script Language JScript:
var rng = ActiveDocument.Range;
rng.MoveToDocumentStart();
if(rng.MoveToElement("title")) {
rng.ReadOnlyContainer = true;
rng.NonRemovableContainer = true;
}
You say “the reference to the selection will change”. I'm not sure what you mean by that, but it sounds like maybe that is your issue. There is only ever one Selection object in a document, set by the user and possibly manipulated using script. Generally scripts use Range instead as you can have multiple Range objects, they are invisible, and they can go some places that a Selection cannot.