Skip to main content
Participant
November 11, 2020
Question

Magic Number in the MarkerText Property of Paragraph Markers

  • November 11, 2020
  • 1 reply
  • 169 views

I'd like to create paragraph markers via ExtendScript for heading paragraphs without existing markers, and wonder how to set a correct MarkerText property of a marker. When a cross-reference to a Heading is created manually in FrameMaker, it seems FrameMaker creates a new marker wih the MarkerText property set according to the following format:

<magicNumber>: <pgfFormatName>: <pgfNumber> <somePgfText>

 

where

  • <pgfFormatName> is the name of the paragraph format (e.g., pgf.Name)
  • <pgfNumber> is the paragraph number (e.g., pgf.PgfNumber)
  • <somePgfText> is initial text from the paragraph (pgf.getText item[s])
  • <magicNumber> is a 5-digit decimal number

Example:

69752: H2,1.1: 1.1 Example text of a level 2 heading

 

The <magicNumber> element (69752 in the example) is what I don't understand. It seems to be unique within a document (maybe even unique within a book), and I assume it matters for keeping cross-references consistent (e.g., when heading numbers and/or text change). Thus, I'm wondering the following:

  • How is <magicNumber> computed by FrameMaker?
  • Atlernative question: Is there an ExtendScript shortcut to (i) compute <magicNumber>, (ii) set the entire MarkerText property, or even (iii) create a proper Marker for a heading paragraph?

 

Cheers

Johannes

This topic has been closed for replies.

1 reply

frameexpert
Community Expert
Community Expert
November 12, 2020

The magic number isn't really magic, it is simply a unique identifier for a FrameMaker object. Most objects have a Unique property which is like a serial number for that object. Within a document, that number should be unique to a particular object; for example, each paragraph in a document will have a Unique property value that no other pargraph in the document has.

 

When building a Cross-Ref marker with ExtendScript, it doesn't really matter what number you use; the idea is just to build a totally unique string for the marker so that it is unique within that document. When I do it, I usually use the new marker's Unique property for the Unique property of the paragraph that contains the marker.

 

Another reason for using the

<magicNumber>: <pgfFormatName>: <pgfNumber> <somePgfText>

combination is that it makes the Cross-Reference dialog box show the resulting cross-reference as a paragraph cross-reference instead of a spot cross-reference, which is usually more useful for the end user.

 

There must be some built-in algorithm for generating the "magic" marker text, but I don't think it is exposed to ExtendScript. You will have to build your own, but now you know the pattern, you should be able to code it.