#### 28.3.7.2 Inserting code with the CodeStore property

To store the content of a FrameMaker paragraph in a macro variable, assign the CodeStore property to the paragraph format:

[HtmlStyles] or [HelpStyles] or [WordStyles]

; CodeStore causes the paragraph content to be stored in the macro

; variable named in [StyleCodeStore]; the para must *precede*

; the point of use of the macro variable in the output document.

; The original para is removed; it can be put back by invoking the

; macro variable in a CodeAfter macro. Note that any CodeStart and

; CodeEnd macros are included in the macro variable content, but

; CodeBefore, CodeAfter, frames, and tables are not.

Parafmt=CodeStore

Explicitly assigning the CodeStore property to a paragraph format is optional when you assign a macro variable to that format in the following section:

[StyleCodeStore]

; doc para format = name of macro variable in which to store para text

Parafmt=Varname

Any CodeStart and CodeEnd macros are included in the macro variable content; however, CodeBefore macros, CodeAfter macros, frames, and tables are not included.

Format name = variable name

If you assign the CodeStore property to a paragraph format, but you do not supply a macro variable name in [StyleCodeStore], Mif2Go uses the paragraph format name itself as the macro variable name.

Must precede point of use

A paragraph with the content you want to appear at a certain point in the output must be the last instance in your FrameMaker document that precedes the point where you want the content inserted. The macro variable holds the value of each instance of the paragraph format in turn until the point of insertion, whereupon Mif2Go inserts the latest value in the output. You can give the macro variable a starting value by defining its name in section [MacroVariables]; see §28.3.2 Assigning values to macro variables.

Content is ignored

When you assign the CodeStore property to a paragraph format, Mif2Go removes all instances of text in that format from the output. You can restore the text by invoking the macro variable in a CodeAfter macro.

Observe the following caveats:

• Do not assign property Delete to the CodeStore paragraph format; if you do, the paragraph content will not be stored in the macro variable.

• Avoid assigning CodeStore to a paragraph format that has any of the HTML List N properties; the </li> coding will be misplaced.

Insert HTML navigation links

Suppose you have a paragraph format named Nextsect that you use for cross references to other FrameMaker files in your book. And suppose you want to save the text of any Nextsect paragraph in macro variable <$$Footnext>, so you can make the link appear in a footer in the HTML output. You would specify these settings:

[HtmlStyles]

Nextsect=CodeStore

[StyleCodeStore]

Nextsect=Footnext

The content of each successive paragraph in format Nextsect would be stored in macro variable <$$Footnext>, replacing the previous value for each instance of Nextsect. Wherever you insert macro variable <$$Footnext>, its current content, taken from the latest instance of Nextsect, appears in the output.

Generate RTF code

You can use CodeStore to generate RTF code for use in later macros, so you do not have to know arcane RTF syntax. For example, suppose you want a copyright notice at the bottom of every WinHelp topic. Put the notice in a paragraph at the start of each chapter file in your FrameMaker document, using a special paragraph format (for example, Copyr). Make the Copyr paragraphs conditional for “Help only” to keep the notices out of print versions of your document. Then specify the following configuration settings:

[HelpStyles]

Copyr=CodeStore

[Inserts]

TopicEnd=<$$Copyr>

This is much easier than trying to compose RTF code yourself to insert via macro:

[Copyr]

\pard \s12 \f3 \fs20 \b Copyright \'a9 2012 Softworks Inc. \par

Besides, code such as \s12 and \f3 could change from one run to the next.

| 28.3.7.1 Capturing paragraph content with the TextStore property |  | 28.3.7.3 Understanding why TextStore and CodeStore work differently |