In some workflow actions, you can use workflow variables within inputs, outputs, or other settings. A workflow variable is a shorthand notation for referencing a known or unknown value, such as a user name, a file or folder name, or the current date and time.
What is a workflow variable?
A workflow variable is a placeholder for an input field in a workflow action. For example, a workflow variable could be a placeholder for a user name, a file or folder name, or the current date and time.
You can also use a workflow variable to get data from users while a workflow is running. For example, ${ask} prompts the user to choose a file from the File Explorer.
Use workflow variables to store and reuse values in different workflow actions within a workflow. You can reference workflow variables throughout your workflow—and if the value that the workflow variable stands for changes, you don't need to update the input field.
For example, if the name of the workflow changes and you are using the ${workflow} variable, the new workflow name will be automatically updated while the job is running. Using workflow variables increases your ability to work efficiently and minimises the likelihood of error.
Workflow variables types
There are two types of workflow variables: global and field.
You can use global workflow variables anywhere that you can add a workflow variable to an input field. Every workflow action in your workflow can access the value of a global variable.
Field variables are specified in the InDesign template as a Typefi Field, and they have the field: prefix included in their name.
Syntax
The syntax for using workflow variables is ${name:parameter,optional-parameter}, where:
- name is the workflow variable,
- a colon (:) is a separator,
- parameter provides extra information (such as formatting instructions) to Typefi Server,
- a comma (,) is a separator for any optional parameters, and
- optional-parameter provides optional parameters.
Add a workflow variable
Within a workflow action, click the Add Variable icon next to an input field, and choose the variable you want to use from the pop-up menu.
Suppose your workflow uses the Edit Metadata workflow action or has an InDesign template that includes Project Fields. In that case, those Project Fields will also be listed in the Add Variable pop-up menu. If Typefi can resolve the Project Fields to actual values (for example, a real Content XML file is an input in the workflow), the description shown in the Add Variable menu is the actual value. Otherwise, only the Project Field name will be shown. Project fields are grouped below named variables, while relevant outputs from previous actions are grouped at the top of the Add Variable menu for quick access.
Workflow variables reference
${ask}
Name | Description | Example |
---|---|---|
${ask} | Prompts for a value or file selection when the workflow is run. | If you use ${ask} in the Output field, you are prompted to enter a name for the output. |
${date:patterns}
Name | Description | Example |
---|---|---|
${date:patterns} | A placeholder for the current date formatted using patterns (yyyy, yyyy-MM, or yyyy-MM-dd). Patterns are case-sensitive. For example, mm refers to minutes, while MM refers to months. |
${date:yyyy-MM-dd} stands for a date formatted like 2020-08-26. |
${field:name}
Name | Description | Example |
---|---|---|
${field:name} | A placeholder for the value of a specific Project Field. | If the InDesign template has a Project Field named DocumentTitle with a value of Lorem Ipsum, then ${field:DocumentTitle} is a placeholder for Lorem Ipsum. |
${input:first}
Name | Description | Example |
---|---|---|
${input:first} | A placeholder for the name without the file extension from the first enabled workflow action input. | If the input from the first workflow action is named my-input.xml, then ${input:first} is a placeholder for my-input. |
${job-folder}
Name | Description | Example |
---|---|---|
${job-folder} | A placeholder for the name of the job folder (formatted as UTC; yyyy-MM-dd hh.mm.ss). | If the job folder name is 2020-07-15 19.34.03, then ${job-folder} is a placeholder for 2020-07-15 19.34.03. |
${output}
Requires the Adobe InDesign plug-in version 31 or later
Name | Description | Example |
---|---|---|
${output} | Used in the Create InDesign book workflow action to allow the InDesign book filename to be used in the pattern for naming the output InDesign document files. | Use ${output} to create book documents that have a consistent naming prefix. |
${section}
Requires the Adobe InDesign plug-in version 31 or later
Name | Description | Example |
---|---|---|
${section} | A placeholder for a Typefi Section name. | If the Typefi Section is named Chapter, then ${section} is a placeholder for Chapter. |
${seq:patterns}
Requires the Adobe InDesign plug-in version 31 or later
Name | Description | Example |
---|---|---|
${seq:patterns} | Used in the Create InDesign book workflow action to customise the file naming convention for generated InDesign documents within a book. ${seq:patterns} is a counter for files, formatted using patterns:
|
For example, ${seq:A}_${section} sets the filenames as:
|
${username}
Name | Description | Example |
---|---|---|
${username} | A placeholder for the username of the person running the workflow. | If the username of the person running the workflow is John Cleese, then ${username} is a placeholder for John Cleese. |
${variable:indesign-pages}
Name | Description | Example |
---|---|---|
${variable:indesign-pages} | A placeholder for the number of pages in the InDesign document. | If the InDesign document has 20 pages, then ${variable:indesign-pages} is a placeholder for 20. |
${workflow}
Name | Description | Example |
---|---|---|
${workflow} | A placeholder for the name of the current Typefi workflow. | If the workflow is named Hello World, then ${workflow} is a placeholder for Hello World. |
${xpath:expression}
Requires the Adobe InDesign plug-in version 31 or later
Name | Description | Example |
---|---|---|
${xpath:expression, default} |
Resolves an XPath 2.0 expression, as implemented by ExtendScript. The XPath expression must be enclosed in single or double quotes (' or "). The node used for evaluation (.) is the Typefi Section element ( <section> ), but the Content XML is parsed in full, so the forward-slash (/) refers to the root Content XML element. If the expression does not produce a valid result, the text for default is used.Setting a default value is optional, but strongly recommended. The comma (,) is required. For more information about XPath expressions, see the W3Schools' XPath Tutorial. |
In this example, No_Title is the default text:${xpath:'.//tps:fieldSet This example does not have a value for the default text, but still includes the comma: ${xpath:'.//tps:fieldSet [@name='ChapterTitle\'] |
Comments
0 comments
Please sign in to leave a comment.