2018.1

Table Of Contents
Control Scripts differ from template scripts in two ways:
l
Control Scripts run before all other scripts. When a template consists of several contexts,
and these contexts are combined in the output - for example, when an Email is generated
with the Print context as attachment - all scripts run once for each context, but Control
Scripts always go first.
l
Control Scripts don't touch the content - meaning, the text flow - of the sections. They
don't have a selector, like the other scripts do. A selector selects parts of the content of a
section and stores them in the results object, so that they can be modified in the script.
As Control Scripts don't have a selector, the results object can't be used there.
In a Control Script, section usually is the most important object. To get a quick overview and
lots of examples, see "section" on page1084. For help on specific tasks, see the table below.
Task See topic Field/function of
section object
Change the page numbering of
Print sections
"Control Script: Page
numbering" on the facing page
restartPageNumbering
Set the background image of a
Print section
"Control Script: Setting a Print
section's background" on
page719
background.source,
background.url,
background.position
Split Email attachments and
rename them
"Parts: splitting and renaming
email attachments" on
page716
part
Dynamically set a password on
PDF attachments
"Control Script: Securing PDF
attachments" on page723
password,
ownerPassword
Include/exclude sections:
l Conditionally omit
sections
l Output one section or
another, based on the
value of a data field
Use a Conditional Print
Section script to in/exclude a
Print section based on a
simple condition; see "section"
on page1084
In all other cases take a look
enabled
Page 713