Use this procedure to make a specific change to a valid Q++Studio script export. It connects the GenTokens editor to the XML reference. The original export supplies the script structure and resource references; keep unrelated content intact.
Evidence: curated SaveToReadFrom_XML_v3.zip, including the v2 XML helpers, and the supplied GenTokens PAS/DFM files. Source analysis establishes serialization and UI mappings; the edited script still needs an import and generation check in Q++Studio.
1. Locate the correct configuration
Example within the selected grid’s Grid Options property. Other settings are omitted here for clarity; this fragment is not a complete configuration to import.
<GenTokens>
<GenToken id="1" rec_type="TGenTokensOptions">
<LineContents>[#d]</LineContents>
<!-- Other settings omitted from this illustration. -->
</GenToken>
</GenTokens>
First locate the intended diary-grid script line and its Grid Options property. Within that property, select GenTokens/GenToken by its id, from 1 to 18: id="1" corresponds to [GenTokens1], id="2" to [GenTokens2], and so on. These IDs are local to that grid’s options, so the same ID can appear in another script line. Do not use a document-wide replacement. In the implementation, the editor’s tab indices start at 0; XML IDs start at 1.
Keep the property attributes, script line attributes, resource IDs, other GenToken slots and nested settings that the requested change does not affect. The rec_type of a GenToken is TGenTokensOptions even though the Pascal record is TGenTokensRec.
Complete field reference: TGenTokensRec.
2. Map the main controls to XML
UI setting |
XML relative to the selected GenToken |
Editing rule |
Text and tokens on each generated line |
LineContents |
Preserve token syntax and escaping; # is the day-value placeholder described in the user help. |
Generation mode |
MaxType |
Use the mode table below. |
Number beside generation mode |
NumMonths (mode 0), otherwise MaxDay |
Changing mode may require changing the element name. |
Step Size |
StepSize |
Visible for modes 0, 3, 4, 5; UI range 1–84. |
Blank lines on outside days |
BlankLinesOnOutsideDays |
Boolean text true/false. |
Begin on week start |
BeginOnWeekStart |
Boolean text true/false. When a GenTokens is placed in the same textbox and after a mini-calendar token, BeginOnWeekStart is ignored. Use the :ws modifier on the mini-calendar marker to change the date associated with DayValue 1; changing this XML Boolean alone will not achieve that result. |
No line ending if blank line |
NoLineEndingIfBlankLine |
Boolean text true/false. |
Displayed mode |
MaxType |
Numeric element |
End of the Month(s) |
0 |
NumMonths |
Relative DayValue |
1 |
MaxDay |
Day of Month |
2 |
MaxDay |
Number of Lines |
3 |
MaxDay |
Min of Nbr of Lines or EOM |
4 |
MaxDay |
Nbr of Lines / EOM |
5 |
MaxDay |
The numeric control accepts 1–9999. These UI bounds do not mean that every value is meaningful in every mode. For MaxType=4, generation stops at the specified line count or the end of the month, whichever comes first. For MaxType=5, an incoming DayValue of 1–9 selects the fixed-count first half; 10 and above selects the second half, which runs to the end of the month. See GenTokens Grid Options for the intended two-column use. These behaviors are documented in the user help; the supplied form-transfer code establishes the XML mapping, not the underlying generation algorithm.
User help: GenTokens Options (HelpContext 175265).
3. Edit special-case conditions
LineEndingOptions id=0 is the default formatting. IDs 1–15 are special cases. Preserve case IDs and their intended priority. The user documentation describes evaluation in numerical order, stopping at the first matching enabled case; the evaluator itself is not in the supplied GenTokens UI units.
Condition state in the dialog |
XML representation |
Checked: must be true |
Character in the appropriate TrueConditions field |
Unchecked: must be false |
Character in the appropriate FalseConditions field |
Indeterminate: irrelevant |
Character absent from both groups |
TrueConditions and FalseConditions each contain BoolType (0=Any, 1=All) and separate Weekdays, Holidays, MoonPhases, DaysOfMonth and Miscellaneous strings. TrueFalseLogicalOperator combines the two groups (0=AND, 1=OR in the supplied combo). Preserve the existing combination unless the requested logic requires changing it. Do not infer empty-group evaluation solely from the editor.
Exact condition characters: TDateConditionsRec Values.
Explanation of the controls: Special Case Conditions (HelpContext 175915).
4. Edit line endings and formatting
Choice |
UI index (not XML) |
LineEnding/EndingType XML value |
Nothing |
0 |
6 |
Soft Return |
1 |
0 |
Hard Return |
2 |
1 |
Tabulation |
3 |
2 |
Next Column |
4 |
8 |
Next Box |
5 |
7 |
Macro |
6 |
3 |
Formatting |
7 |
4 |
Xtags |
8 |
5 |
Skip Line |
9 |
9 |
Xtags (EndingType=5) is not supported by InDesign. For an InDesign script, use an appropriate supported line ending, such as Formatting for paragraph formatting, and supply its corresponding payload. The XML value table documents serialization; it does not make every choice available in both DTP applications.
When editing EndingType, use the XML value in the above table, not the UI index. For Formatting, Xtags or Macro, also supply the settings or text required by that choice; changing EndingType alone does not create them. Where possible, copy a complete existing configuration and adjust it. Some nested settings are written on the next save only when their controlling formatting options are enabled.
The editor enables default slot 0 when retrieving its options. When editing its payload directly, retain Enabled=true. To disable a special case but keep its configuration available, use Enabled=false and WasOnceEnabled=true. The reader initializes missing slots; omitting a slot is not a harmless way to disable it.
Payload reference: TLineEndingRec.
Activation and retention: TLineEndingOptionsRec.
User help: Line Endings and Paragraph Formatting (HelpContext 175920).
5. Focused before/after examples
These are fragments to replace or edit inside an existing configuration, not complete script files. Preserve the surrounding XML and all unlisted values.
Requested change / location |
Before |
After |
Generate 12 lines instead of to the end of one month; selected GenToken |
<MaxType>0</MaxType><NumMonths>1</NumMonths> |
<MaxType>3</MaxType><MaxDay>12</MaxDay> |
Disable an existing case, retaining its payload; selected LineEndingOptions |
<Enabled>true</Enabled><WasOnceEnabled>true</WasOnceEnabled> |
<Enabled>false</Enabled><WasOnceEnabled>true</WasOnceEnabled> |
Use a soft rather than hard return; selected LineEnding |
<EndingType>1</EndingType> |
<EndingType>0</EndingType> |
Require Sunday instead of Saturday; case TrueConditions, assuming these are the only weekday conditions |
<Weekdays>6</Weekdays> |
<Weekdays>7</Weekdays> |
For the 12-line example, keep StepSize=1 if the intention is successive day values; explicitly change it if the original differs. For the Sunday example, check FalseConditions for a conflicting Sunday requirement and inspect other enabled cases that may match first. Removing a condition means removing its character, not deleting the entire conditions record.
5.1. Add, move or remove a GenTokens configuration
GenTokens has 18 fixed slots (ids 1–18), not a variable-length list. The ordinary export writes all 18 GenToken wrappers. Adding means configuring an available slot; moving means transferring its configuration and updating the intended token references; removing means clearing its configuration and removing or redirecting its uses. Changing the order of GenToken elements in the XML file does not change their slot numbers; each slot is identified by its id attribute.
Before changing a slot, inventory its uses in the relevant GridTemplate and in token-bearing script settings, including nested LineContents and override text. A script export does not contain the full template text. A slot that looks empty in XML is not proven unused. Preserve date prefixes, language tags and suffixes when changing only a GenTokens index, and check other script lines using the same template.
Operation |
Concrete example |
Required changes |
Add a configuration |
Copy slot 2 into unused slot 6 |
Replace the contents of the existing GenToken id="6" with a complete copy of slot 2, retaining destination id="6" and rec_type="TGenTokensOptions". Keep slot 2. Edit the new payload as required and place the intended [GenTokens6] token in the template or other token text. Do not create a duplicate id="6" sibling. |
Move a configuration |
Move slot 2 to unused slot 6 |
Copy the entire configuration, including default formatting and every retained special case, to slot 6. Update intended references from GenTokens2 to GenTokens6. After accounting for every old use, reset slot 2. If slot 6 is occupied, relocate it or explicitly decide to replace it first. |
Exchange two configurations |
Swap slots 2 and 6 |
Take snapshots of both complete payloads, then place the old slot-2 payload in slot 6 and the old slot-6 payload in slot 2. Swap intended references simultaneously using the original mapping, so a sequential replacement does not turn both into the same index. |
Remove a configuration |
Retire slot 6 |
Remove or redirect all intended [GenTokens6] uses, then replace its payload with <GenToken id="6" rec_type="TGenTokensOptions" />. The record reader initializes an empty wrapper. Keep other slot IDs unchanged. Clearing LineContents alone does not clear special cases or other settings. |
For example, moving [1GenTokens2] to slot 6 gives [1GenTokens6]; the initial 1 still supplies the same DayValue. Moving a token physically to another text frame without changing its index is a different operation: its XML configuration stays in the same slot, but its inherited formatting and available geometry may change. Check the InDesign section below.
If copying between different grid script lines, also check the destination holidays lists, macros, colors, styles and template geometry. Copying XML does not copy those resources. Apply template changes through the normal Q++Studio template update/rescan workflow where required.
5.2. Add, move or remove a special case
Within one GenToken, LineEndingOptions id="0" is the default; ids 1–15 are special cases. Move the entire LineEndingOptions subtree: Enabled, WasOnceEnabled, TrueConditions, FalseConditions, TrueFalseLogicalOperator and LineEnding, including its formatting and override text. Do not move only the condition or only the format. Keep id="0" outside all special-case renumbering.
Operation |
Before → after |
Procedure |
Append a case |
Cases 1–3 used; add case 4 |
Check that slot 4 has no configuration you need to retain. Copy a suitable complete special-case subtree to id="4", edit both its conditions and action, and set Enabled=true and WasOnceEnabled=true. Check whether an earlier case already matches the intended dates. |
Insert before an existing case |
1=A, 2=B, 3=C → 1=A, 2=NEW, 3=B, 4=C |
Snapshot the affected subtrees. Shift old case 3 to 4 and old case 2 to 3, then place the new case at 2. Include disabled retained cases in the occupancy check. Never overwrite an occupied last slot or shift beyond id 15. |
Move earlier |
1=A, 2=B, 3=C, 4=D, 5=E → 1=A, 2=E, 3=B, 4=C, 5=D |
Move old case 5 to 2 and shift old cases 2–4 up by one. Assign each destination ID exactly once from the snapshots. Other case slots keep their IDs. |
Move later |
1=A, 2=B, 3=C, 4=D, 5=E → 1=A, 2=C, 3=D, 4=E, 5=B |
Move old case 2 to 5 and shift old cases 3–5 down by one. This changes evaluation priority even though each payload is unchanged. |
Disable temporarily |
Keep case 3 available for reuse |
Set Enabled=false and WasOnceEnabled=true and retain its complete subtree. |
Remove permanently |
Delete case 3 without shifting the others |
Remove its LineEndingOptions id="3" subtree. With the remaining GenToken payload present, the reader initializes the missing slot. Cases 4–15 retain their IDs; gaps are allowed. |
A–E and NEW above are labels for complete case payloads, not XML values. Changing the order of LineEndingOptions elements in the XML file does not change their case numbers. For example, placing an element with id="5" before one with id="2" still leaves Case 2 evaluated before Case 5. To change priority, assign the complete case configurations to the intended case IDs. Enabled cases are evaluated in numerical order and the first match wins. After a move, test dates matching more than one case, the first and last generated lines, month boundaries and relevant holidays. When all 15 slots contain settings that must be retained, another case cannot be inserted without consolidating or retiring an existing one.
Use an IDML export of the actual GridTemplate, together with the script XML; an IDML export of the generated output is also useful for checking the result. For every affected GenTokens occurrence, identify its story, paragraph and containing text frame. Tokens may be split across text-style runs, and a story may flow through several frames. Match occurrences to their script line and slot rather than assuming all occurrences of the same token use the same formatting.
Resolve the formatting actually applied
Follow paragraph and character styles, their inheritance and local overrides to determine the effective leading and paragraph rules. Then account for the selected GenTokens line ending and its override switches. Hard Return inherits the original token’s paragraph attributes; an unchecked formatting override also leaves the corresponding original attributes in use. Do not insert a leading override merely because the script XML does not specify one. Automatic leading, baseline-grid alignment and Space Before/After need separate consideration when determining the actual row spacing.
In InDesign, leading is a text attribute. The Leading value in the GenTokens Formats settings is ignored. Determine the effective text leading from the template and any macro or SARA that changes it; do not try to correct row spacing solely by editing the paragraph Leading value in the script XML. See QuarkXPress–InDesign differences and the GenTokens paragraph-leading warning.
Compare rule thickness with the intended row height
In the Q++Studio Rules UI, Width is the vertical thickness of a rule, called Weight in InDesign. It is not the text-frame width, nor InDesign’s Text/Column rule-width selector. For a design using a solid rule as full-day shading, compare this thickness with the effective leading/day height at each token occurrence. For half-day shading, check the intended half-height and its offset. These are design checks, not a requirement that every decorative rule have a thickness equal to the leading or a simple fraction of it.
Example |
Check |
Full-height shading at 16.45 pt leading |
A 16.45 pt rule can cover one row when its offset is correct. |
Half-height shading at 16.45 pt leading |
The intended half-height is 8.225 pt, subject to the precision the editor and output preserve; verify which half the offset covers. |
Reuse at 13 pt leading |
A retained 16.45 pt rule is a mismatch to investigate if full-row shading is intended; do not automatically change the template leading to fit the rule. |
Extra Sunday space |
Check Space After and the applicable special-case rules as well as leading. A design with extra Sunday spacing can need different shading from a single-height Sunday design. |
Check From Left and From Right against the available width
Check the actual frame containing the token and the rule’s Text/Column reference. For a simple single-column rectangular frame with column-relative rules and nonnegative rule indents, the available span is frame width minus left and right text insets. The remaining rule span is that available span minus From Left minus From Right. It must be positive for a visible rule. Checking that the frame is wider than each indent separately is insufficient: their sum must fit as well.
Single-column example (millimeters) |
Result |
Frame width 30; left/right text insets 1 each; From Left 5; From Right 20 |
Available span 28; remaining rule span 3: a positive span. |
Same frame and insets; From Left 10; From Right 20 |
Remaining rule span −2: the indents do not fit, although each is individually smaller than the frame width. |
For multicolumn frames use the relevant column span after insets and gutters, not the whole frame width. Text-relative rules use the rendered text extent and may intentionally use negative indents. Resolve rotation, scaling and other transforms before comparing geometry; an axis-aligned page bounding box is not necessarily the frame’s text width. Threaded or irregular frames may require an InDesign composition check to determine the actual containing frame and available span.
Compare values in matching units
For the supplied XML implementation, TXtagsRule stores Width, FromLeft and FromRight as integers scaled by 1,000,000. Width decodes to points, while FromLeft and FromRight decode to millimeters in the supplied editor mapping. For example Width=16450000 means 16.45 pt and FromLeft=5000000 means 5 mm. Convert millimeters to points using mm × 72 / 25.4 before comparing with IDML point measurements. Display units in the UI may differ; never compare raw scaled XML integers to IDML geometry.
For each occurrence, record the frame/story, effective leading, active default or special-case rule, rule thickness and offset, left/right indents, available span and expected visual effect. Check corresponding date and shading columns together for cumulative drift. Confirm the generated result in InDesign or an exported PDF, including frame overflow, half-height shading, Sundays and the last line generated.
Field encodings: TXtagsRule.
Units, insets and rule-reference choices: Rules Above and Below.
Inheritance and overrides: Line Endings and Paragraph Formatting.
Compare the original and edited XML and account for every change. Import the edited copy using the intended Q++Studio workflow. Reopen GenTokens and verify the selected slot, mode, case states, conditions and formatting. Generate a representative result, including the relevant month end, Sunday, holiday or other boundary. Re-export and compare semantically: formatting, default omission and WasOnceEnabled normalization can change the XML without changing the intended settings.
A successful XML parse proves syntax, not correct output. Existing holiday data, templates, macros, fonts and colors still matter. If the desired result depends on an undocumented condition interaction, resolve that specific question from the evaluator or a controlled Q++Studio test before extending the edit.
Selective copying in the UI: Copying GenTokens Options and Sub-Options (HelpContext 176025).
Source mapping: frmGenTokensEditor.GetOptionsRec/SetOptionsRec/GetLineEndingOptions; fmSelSpecialCases.getConditionsFromForm; fmSelLineEndingSettings.IndexToLineEndingType/GetLineEnding; fmMiscGridOptions.pcGenTokensChange/pcGenTokensChanging; cpMiscGridOptions.GetGenTokens; TypeDefinitions record readers/writers. UI units are used as evidence, not reproduced wholesale.
Topic 189600, last updated on 06-Oct-2026