1.8

Table Of Contents
Removing a password
Passwords set in the Control Script override the password set through the Email PDF
password script (see "Email PDF password" on page125). This allows you to change or
remove the password from a specific part. Removal is done by setting the password field to null
or an empty string ("").
Example
This scripts splits the Print output into two PDF attachments and sets a password for the
second attachment.
var printSections;
if (channel == Channel.EMAIL) { // only when generating Email
output
if (merge.context.type == ContextType.PRINT) {
printSections = merge.template.contexts.PRINT.sections;
printSections['Section 1'].part = 'PDFAttach1';
printSections['Section 2'].part = 'PDFAttach2'
printSections['Section 2'].password = 'secret';
}
}
The script flow: when scripts run
When Connect generates the actual output letters, web pages or emails -, it opens a record
set and merges it with the template. It takes each record, one by one, and runs all scripts for it,
in a specific order, as explained below.
First all Control Scripts are executed, in the order in which they appear in the Scripts pane.
Control scripts don't touch the content of the sections themselves, but they change the way a
template is outputted, for example by selecting or omitting sections from the output (see
"Control Scripts" on page281).
Then the template scripts are executed, once for each section, in the order in which they
appear in the Scripts pane.
Template scripts can change the contents of the current section in a template.
This type of script must have a selector: text, an HTML element and/or a CSS selector (see
"Writing your own scripts" on page260).
Running a template script starts with looking in the current section for pieces of content that
match the script's selector.
Important to note is that if nothing matches the selector, the script is not executed.
Page 295