2022.2

Table Of Contents
Watch.ExpandString
Provides access to the emulated job file and to all variables. This function returns a string that is the
expanded version of the input string.
Syntax
Watch.ExpandString(StringToExpand)
StringToExpand
A regular parseable string that may contain system variables (%u, %f), user variables (%1 to %9),
octal codes, and data selections.
Note: Workflow interprets a backslash in the regular parseable string as an escape character;
JavaScript, Python and Perl do the same. This means that backslashes must be doubled when
using one of those scripting languages.
This does not apply to strings inside a system variable or user variable, since those variables are
expanded, but not parsed.
Here is an example in VBScript, with a file name:
Dim s
s = Watch.ExpandString("C:\\Account\\PDFs\\REV%{RevisionNumber}-
LP.pdf")
Watch.Log s,2
In JavaScript, Python, and Perl, the file name would have to be:
"C:\\\\Account\\\\PDFs\\\\REV%{RevisionNumber}-LP.pdf"
If %{RevisionNumber} contains a backslash, it will not be seen as an escape character.
Example
This example results in expanding the string of the variables to the date value in the following format:
“YYYY-MM-DD”.
JavaScript
var s;
s= Watch.ExpandString("%y-%m-%d");
Watch.Log("Current Date is: " + s, 2);
VBScript
Dim s
s= Watch.ExpandString("%y-%m-%d")
Page 133