Microsoft Word Suite
108
if (count of fields of active document) 1 then
display dialog ("Code = " & content of field code of field 1 of ¬
active document as string) & return & "Result = " & content of ¬
result range of field 1 of active document as string
end if
To add a field to the fields list, use the make command. The following example inserts a DATE field
at the beginning of the selection and then displays the result. This example uses the hidden text
range property of the field object to specify the location of the field.
collapse range text object of selection direction collapse start
set myField to make new field at active document with properties ¬
{text range:text object of selection, field type:field date}
display dialog (content of result range of myField) as string
Properties
entry index
Returns a number that indicates the position of the field in the fields list. Read-only.
field code
Returns a text range object that represents a field's code. A field's code is everything that's
enclosed by the field characters ({ }) including the leading space and trailing space characters.
Read/write.
field kind
Returns the type of link for a field object. Read-only.
Can be one the following:
Constant
Description
field kind hot
A field that's automatically updated each time it's displayed or each
time the page is reformatted, but which can also be manually updated
(for example, INCLUDEPICTURE or FORMDROPDOWN).
field kind warm A field that can be updated and has a result. This type includes fields
that are automatically updated when the source changes as well as
fields that can be manually updated (for example, DATE or
INCLUDETEXT).
field kind none An invalid field (for example, a pair of field characters with nothing
inside).
field kind cold
A field that doesn't have a result (for example, XE (Index Entry) fields,
TC (Table of Contents Entry) fields, or Private fields).