2021.1

Table Of Contents
Paragraphs can be made conditional with a Conditional Script Wizard.
For dynamic images, you can use the Dynamic Image Script Wizard.
In an Email context, you are provided with a number of Email Script Wizards to set the sender,
the recipients and the subject of the email.
However, when you want to do something that goes beyond what you can do with a Wizard,
like creating a conditional paragraph with a condition that is based on a combination of data
fields, you have to write the script yourself.
This topic explains how scripts work and how you can create and write a script yourself.
Script types
There are three types of scripts in the Designer: Control Scripts, Standard Scripts and Post
Pagination Scripts.
Control Scripts
When output is generated from a template, Control Scripts run before all other scripts, when a
record is merged with a context. They determine how different sections of the context are
handled. They can, for example, make the page numbering continue over all Print sections,
split Email attachments, or omit Print sections from the output.
Some knowledge of JavaScript is needed to edit Control Scripts, just as for any other self-made
scripts; see "Writing your own scripts" on the previous page. Some functionality is provided as
a Scripting Wizard, for example Conditional Print Sections.
Control Scripts don't touch the content of the sections themselves, but they change the way a
template is outputted. For more information about Control Scripts and their use, see "Control
Scripts" on page903.
Standard Scripts
Standard Scripts can change the contents of sections in a template. This type of script must
have a selector. The selector can be text, an HTML element and/or a CSS selector (see
"Selectors in Connect" on page888). Running a Standard Script starts with looking for pieces
of content in the template that match the script's selector.
The results of this query can vary from one occurrence of a simple text (for example:
@EMAIL@) to a large collection of HTML elements. For example, when the selector is p, the
HTML tag for a paragraph, all paragraphs will be collected and passed to the script.
Page 868