Quite Hot 6: Variables

Previous: << Variables: using variables with watched folders
Next: >> Variables: command line options

Variables: using variables with Enfocus Switch

Quite Hot Imposing 6.0 has a number of changes designed to make integrating with Switch much simpler than in older releases. The latest version of the Quite Hot Imposing configurator or Quite Hot Imposing app for Enfocus Switch includes a new option “Connect Switch metadata”.

A close-up of a data box

Description automatically generated

If you do not see this option, please update the configurator. (All versions of the Switch app, used in Switch 2023 and later, have this option).

This option is off by default. If you select Private data + datasets, this option has three effects.

1.       Import all suitable Switch private data from the job as variables to Quite Hot Imposing.

2.       Make all Switch datasets from the job available in Quite Hot Imposing.

3.       Pass back exported data from Quite Hot Imposing, to set Switch private data in the job.

Details on these three effects follow.

Importing Switch private data as Quite Hot Imposing variables

In Enfocus Switch, user variables are called ‘private data’. Private data is set using JavaScript. In the Switch configurator or app for Quite Hot Imposing you can select the option Connect Switch metadata.

The default is ‘no so no info is passed from private data to Quite Hot Imposing. If you select ‘Private data + datasets’ then all the variables set in private data are automatically available as variables in Quite Hot Imposing (provided they have a simple name – for example private data called “Top list” or “Alpha-2” cannot be used).

A simple way to set private data is using the Enfocus Switch App ‘Script Private data’. This allows you to set private data from script expressions, which can be as simple as typing a number.

In this example, a Script Private data element is added to a flow. The screen shot shows the properties of the Script Private data element. Private data key 1 is copies, and private data script 1 is just the script “42”. This will set the Quite Hot Imposing variables copies=42.

Setting variables from submit point “fields” XML format

In Switch, there a number of ways to make XML datasets attached to the job. We are looking at a particular format (“schema”) of XML created by Switch Submit Points and Checkpoints. This format is described under Variables setting files – XML fields format. This can be a very simple and convenient way to set Quite Hot Imposing variables directly from a submit point without scripting.

For the Submit point in Switch you choose “Enter metadata: Yes”. You can then define metadata fields. The only item you must always fill in is “Label”. This label does two jobs: it is the prompt when the user connects to the Submit point, and it is the name in the metadata. So, if you set Label to “copies”, for example, you can use a Quite Hot variable called copies, and the user is prompted for it each time they submit work.

The prompt and the metadata name are the same, which may make for very long metadata names, and might contain spaces. Quite Hot Imposing applies several rules to simplify this. The rules apply to the prompts/variable names only, not to what the user types when prompted.

1.       Any space in the prompt is replaced by an underscore.

2.       If the prompt contains parentheses (round brackets), everything is ignored except the part inside the parentheses. For example a prompt of “Number of columns (cols)” will set a variable name of “cols” only.

3.       After these changes to the prompt, if there is anything other than upper or lower case unaccented English letters, digits, or an underscore, then no variable is set.

So, you might have a label of “Width of pages in mm (width)” which shows all of this text as a prompt, but sets a variable name of “width”.

Now, you just need to make Quite Hot Imposing pick up this information from the dataset. To start with you must set “Connect Switch Metadata” to “Private data + datasets”. Each Submit point and Checkpoint has a dataset name. These names will usually be different, as Switch will not combine the information. The default dataset name for a submit point is just “Submit”.

So you need to tell the Quite Hot Imposing app/configurator to read from the dataset “Submit”. The simplest way is to add the extra option (command line option) -switchfields "Submit". If you have multiple datasets, you can list them all. For example -switchfields "Submit,Checkpoint1".

Setting variables using filename filter

It’s possible to have Quite Hot Imposing scan the filename for variable values. The command line option -varfilter pattern can be used but for Switch we recommend the command line option ‑switchvarfilter pattern. This checks the filename to see if it starts _xxxxx_ where xxxxx is five alphanumeric characters. Switch adds this prefix to names. By using -switchvarfilter, we automatically take the prefix off, and can be concerned with the original filename.

TUESDAY_ADVERT_273!44-3-2.pdf

In this example, we’ve used 44, 3 and 2 as the variable values. (The 273 is just part of the regular name). We need to tell Quite Hot Imposing how to read these names, by typing a filter. To do that we need to know the names of each variable we want to set. Let’s suppose that they are copies, rows and columns. And we want to use them in that order.

The filter we use is

*!<copies>+<rows>+<columns>

Let’s break this down. The * at the start means “anything”, that is the normal part of the name. Actually, almost anything. The normal part mustn’t have a ! mark because that is what starts the variables.

You can see that the filter has the names of the variables we want to use. We always put them like this <name>. There is no < or > in the actual filename, this just tells Quite Hot Imposing that we have a variable name.

The other things we see are ! (before <copies>) and + (between variables). These symbols ! and + are not special, they are just what we want to put in the file name. There could be any number of characters, including letters. Here are some different ways we might set for those three variables.

*--<copies>-<rows>+<columns>                example UPDATE_BOOKLET--44-3-2.pdf

*$(<copies>+<rows>$$<columns>)         example PIC PAGE 1$(44+3$$2).pdf

* K=<copies> R=<rows> C=<columns>   example LEGEND_42 K=44 R=3 C=2.pdf

To emphasise: the = is also not a special character. It just allows the filename to contain K= and so on. You must have a separator between variables. For example you could not put <rows><columns> directly because there is no way to know when <rows> finishes and <columns> starts. You also cannot have an asterisk (*) immediately before or after a <variable> reference, there must be at least one character between them.

The names have to exactly match. If they don’t match there will be an error message, and the file will not be processed, because you probably don’t want to run a job without the settings.

This filter will force the variables to be at the end of the name. But if you want to allow more info after the variables, just put a * at the end. If you want the variables to be at the start, remove the * from the start. (Remember that using -switchvarfilter will already have removed the Switch prefix _xxxxx_).

Some characters aren’t allowed, often because they aren’t allowed in file names. Never use any of these: colon (:), forward slash (/), backwards slash (\), vertical bar (|), curly brackets ({ or }) or square brackets ([ or ]). In Windows, you must not use question mark (?), double quote (") in a file name.

You can use -switchvarfilter multiple times and all the matching filters are used. For example

-switchvarfilter "* K=<copies> *"
-switchvarfilter "* R=<rows> *"
-switchvarfilter "* C=<columns> *"

This example would set the copies, rows and columns variables according to the filename. Notice that we need a space around the strings, so that the names are separated from other variables. This means that the filename would be required to have a space after each of these. You could add three more rules

-switchvarfilter "* K=<copies>"
-switchvarfilter "* R=<rows>"
-switchvarfilter "* C=<columns>"

This would allow each of the items at the end as well (no * at the end of these patterns).

If no filter matches, no variables are set. There is no error at this point, but if you try to use a variable that is not set, the job will fail.

Working with Switch “user fields”

The Enfocus Switch configurator/app for Quite Hot Imposing offers three properties “User field 1”, “User field 2” and “User field 3”. You can use these for simple applications, though it is less flexible than working with private data. It has the advantage that up to 3 values can be used directly on the Quite Hot Imposing element, without need for any additional elements like scripts.

To use these you just need to use a special syntax when typing a variable. You type [User:1], [User:2] or [User:3] – including the square brackets. These can be freely used in expressions, for example you could type

[User:1] * 2 - 1

Making Switch datasets available in Quite Hot Imposing

In Enfocus Switch, datasets are extra files that travel with a job. If you select . If you set “Connect Switch Metadata” to “Private data + datasets”, all the datasets in the job are available in Quite Hot Imposing.

The default is ‘no so no info is passed from private data to Quite Hot Imposing. If you select ‘Private data + datasets’ then all the variables set in private data are automatically available. You can use datasets like regular files in these places:

·         Variable data merge source

·         Variable data merge file of pages to be inserted by reference from the data source

·         Backgrounds for imposition 

·         Pages to insert (“Insert pages” command)

·         Pages to stick on (“Stick on pages” command)

To select a dataset, where you can choose a file or Browse, you will now see “Dataset…” as a choice.

A screenshot of a computer

Description automatically generated

If you choose Dataset, you now can type the name of the dataset, as defined in Switch.

A screenshot of a computer error message

Description automatically generated

As this example shows the name of the dataset could itself be set by a variable.

Passing export variables from Quite Hot Imposing back to Switch private data

Exporting variables is a way to get the values out of Quite Hot Imposing. If you set “Connect Switch Metadata” to “Private data + datasets” then all the variables you export are automatically placed in Switch Private Data.

A close-up of a box

Description automatically generated

You can set variables to export in various ways.

·         You can use the Results button for certain commands, to pick up values specific to the command, such as the number of rows or columns in an imposition, as described below.

·         You can use a Set Variables command to set variables, and list the names to export, for example
GRIDSIZE=ROWS * COLUMNS
EXPORT GRIDSIZE
If you use
EXPORT *
all the variables are automatically exported to Switch private data

·         You can use the ‑varexport  name or ‑varexport "*" command line option as part of the Other Options in the Switch flow element, which have the same effect as using EXPORT in a Set Variables command.

·         Variables can also be set using as described in Variables: Variables settings files, which have the same format as the Set Variables command, or in a specific XML format. You can give the variables setting file to read using the command line option ‑vars filename or ‑vars dataset::datasetname .

In this example of the Results button, a sequence containing N-Up has results set for the N-Up command. You can choose any names to export a private data, or go with the default names.


Previous: << Variables: using variables with watched folders
Next: >> Variables: command line options