Reply to: Read Only Mode – Xmetal 5.5July 2, 2009 at 6:35 pm
ActiveDocument.Range is valid and what you have should work I think, as long as “XMetaL” is a variable (object) that represents XMetaL Author instantiated as a COM object.
Here's the simplest fully functional script that does what you are asking for. For readability I've renamed your “xmlReadMode” to “rng” because that is more descriptive of what that object actually is.
Save the following into a *.vbs file and run:
[code]Set XMetaL = CreateObject (“XMetaL.Application”)
Set rng = XMetaL.ActiveDocument.Range
'toggle ReadOnlyContainer for current selection
if (rng.ReadOnlyContainer = true) then
rng.ReadOnlyContainer = false
rng.ReadOnlyContainer = true
Set XMetaL = nothing[/code]
Note that you may need to alter the variable declarations if you are not working with VBScript in your actual solution.