Copy link to clipboard
Copied
I seem to be digging deep into areas of FrameMaker's ExtendScript Object Model that don't get much attention.
In an EDD it is possible to define the auto-insertions that happen when you add a new element to a structured document. The auto insertions can be InsertChild or InsertNestedChild. I need to handle these insertions dynamically according to element context. Unfortunately this seems to be impossible with ExtendScript.
In an ElementDef there are two relevant properties AlsoInsert and AlsoInserts. The first is an array of Stings and the second a Typed Val. It is not clear how these should work together to match the possibilities of the EDD structure. Has anyone made this work? I had a look at the FDK documentation but it's not very helpful.
The FDK and ExtendScript documents seem to be giving different information which is unhelpful. The FDK reference does not include a definition for an equivalent to AlsoInserts.
Any ideas greatefully received.
Ian
Further update...
This now seems to be an error in the data browser when showing TypedVal properties. This is what is actually contained in the AutoInsertions property:
So we have the AutoInserts TypedVal with a valsVal reference to an array of TypedVal Objects which are equivalent to each Automatically Insert child from the EDD.
Within each of those TypedVal properties the array of auto Insertion strings is to be found in the ssval property.
This means that everything does work and my problems hav
...Copy link to clipboard
Copied
Ian,
never had an use case to this yet.
So, I think AlsoInserts expects a TypedVal of a string Array, also but in a differenct struct model.
Easiest way to check what's expected is to have an EDD with a complete autoinsertion structure.
After that get the ElementDef Object, and check these properties with the data Explorer and Play around changing that properties with the Console in ESTK.
Hope this helps
Markus
Copy link to clipboard
Copied
Markus,
Thanks for the reply. One important fact that I failed to include in my original post is that the data captured in the Data Browser does not match the insertions and nested insertions that are defined in the EDD. The AutoInserts TypedVal is always empty. I'm finding it difficult to understand how the available properties could ever define what's possible in the EDD.
Ian
Copy link to clipboard
Copied
Ian,
according to FDK:
The list of the tags of child elements
that are automatically inserted when
an element is initially added.. For
example, consider the case where
you set AlsoInserts property of
element definition of A to [[a1,
a11],[a2, a21]]. In this case, when A
is inserted, the following elements
are inserted: children of A are a1 and
a2, and children of a1 and a2 are a11
and a21 respectively.
my understanding of using AlsoInsert, following happens when Element A is inserted
A
a1
a11
a2
a21
and this must be set to as follows
AelemDef.AlsoInsert = ["a1,a11", "a2,a21"];
And if AlsoInserts is empty, I think this is an internal property, which has no effect.
As I'm not sure, if this is all the truth, I hope this helps in any case
Markus
Copy link to clipboard
Copied
Yes Markus I had read the FDK and ExtendScript documents and I can see that the described behaviour does not happen. For this definition in an EDD:
I only see this in the Data Browser:
So it looks like a bug to me...
Ian
Copy link to clipboard
Copied
Further update...
This now seems to be an error in the data browser when showing TypedVal properties. This is what is actually contained in the AutoInsertions property:
So we have the AutoInserts TypedVal with a valsVal reference to an array of TypedVal Objects which are equivalent to each Automatically Insert child from the EDD.
Within each of those TypedVal properties the array of auto Insertion strings is to be found in the ssval property.
This means that everything does work and my problems have been solved, However the display in the Data Browser is incorrect.
One last point, I believe that the ElementDef.AutoInsert property is there for backward compatibility with the old auto insertion behaviour.
Ian