Scripting is the most powerful feature in InDesign—no other feature will save you as much time. You can incorporate InDesign scripts directly into your Typefi workflows by adding event scripts.
On this page
Scripting, which allows you to enhance InDesign's core capabilities, is an essential tool when you are creating complex documents. While you usually deploy scripts via InDesign's Scripts panel, you can also incorporate scripts directly into Typefi workflows to expand Typefi's core functionality.
All custom InDesign scripts are designed to run at a specific event, or key moment, during the automated page composition process. This article will explain the nature of these events and how to deploy event scripts in a Typefi workflow.
This introductory article provides a solid foundation for those who want to start writing scripts for Typefi workflows. In addition, this article is useful for anyone who uses Typefi Server and would like to learn more about how to deploy scripts in a Typefi workflow.
Event types ↩
All custom InDesign scripts are designed to run at a specific event. These events can be seen on the Event scripts tab of Typefi’s Create InDesign Document and Create InDesign Book workflow actions in Typefi Server.
The Create InDesign Document workflow action has these events:
- Document start
- Section start
- Spread start
- Page start
- Spill end
- Page end
- Spread end
- Section end
- Index start
- Index end
- Document end
The Create InDesign Book workflow action has the same events as the Create InDesign Document workflow action, plus two more events:
- Book start
- Book end
The Parameters field (listed last in the Event scripts tab for both the Create InDesign document and Create InDesign book workflow actions) is not an event; instead, it's a field that you can use to pass on directives to one or more event scripts.
The events are listed in the order that they occur when a job runs through Typefi.
spill.end event can occur just once, or many times when a job is run.
|Event||Description||Example use cases|
|Book start||Used in the Create InDesign book workflow action. At
||Seldom used. At
For instance, in workflows that use the MathTools plug-ins, a MathML handler is installed so that MathML is placed in the InDesign documents. Another example is a hotfix to fix a problem, or add customisations.
TIP What a script can do at
||Seldom used. Instead, use
NOTE The above description does not hold for the first page of a Typefi Section. On these pages, no frames have been placed or overridden at
In general, run a script at
If the story is a Main Story, then it will usually be overset. Because most of the story will be overset at
Scripts that change the content of a story must run either at
TIP If a script can be done at
|Several Typefi script modules run at
||Locate the Main Story frame on the page and change its height to a percentage of its standard height|
||Seldom used. Instead, use
|Section end||A Typefi Section has been finished. In a book job, each Typefi Section is produced as a separate document. Typefi Sections define divisions within a publication that break it into logical chunks and are used to specify which Adobe InDesign master pages to use during the composition process, and in what order.||Place a thumb tab at the edge of every page. What can be done at
|Index start||Any index markers are processed at
Create a list of topics for an index, set or change the sort order of indexes, or add a page range to index entries.
|Index end||The index has been generated, placed, and paginated.||Place repeat topics in an index or apply special keep options.
In general, use any scripts that need to see the finished index.
When run as part of a job,
Place bars in the margins, add a shaded background, manipulate running headers, log various types of document diagnostics, such as missing glyphs, or detect overset text frames and table cellsIn general,
|Book end||Used in the Create InDesign book workflow action. At
|Parameters||The Parameters field is NOT an event script. It's a field that you can use to pass on information to one or more event scripts.
All scripts can access parameters set in the Parameters field. More complex parameters can be handled differently; for instance, in configuration tables in the template.
|Use parameters to run a job with a certain spot colour:
TIP You can combine several pieces of information in one string, as in:
Deploying event scripts in a Typefi workflow ↩
In Typefi Server 8.4 and later, you can copy scripts to Typefi Server in the same way that you copy any other file. It doesn’t matter where the scripts are.
You can create a single scripts folder, which is fine if you use just a small handful of scripts. But, if you use many scripts at different events, then we recommend creating folders for each event that you have scripts for.
For example, you could create a PageEnd folder and place all
page.end scripts in it, and a DocumentEnd folder for
document.end scripts. It’s entirely up to you.
Once the scripts are in place, specify them in the workflow action. Go to the Create InDesign Document action or the Create InDesign Book action. Then go to the Event scripts tab.
To select an input for an event script, click Choose File (folder icon) to browse for a file on Typefi Server (alternatively, click Browse within the Choose File dialog to browse for a file on your local computer).
For example, to add a
page.end script, click the folder icon and navigate to the script you uploaded, select it, and click Choose. The script’s name is inserted in the Page end field.
Scripts are run in the order in which you see them. To change the order of two or more scripts, drag them around with the mouse.
You can also add several scripts at once, and they will display alphabetically by default. For this reason, we often use two-digit prefixes for script names, so we know the order in which they should appear. For example:
TIP The two-digit prefixes are also useful when troubleshooting. If you remove a script to run some tests and then want to add it back in, it’s easy to see where it goes.