Script evaluation

This topic explains that you can write any script for any Content Control including PlainText, RichText etc, whenever that Control is about to execute, the script will be executed just before the evaluation of the Content Control.

Assigning variables new values in the Scripting tab

We can assign each variable a new value using the assignment operator (=) in the Scripting tab. Whenever the Content Control is evaluated, the variable value is changed and any references to the variable below it will use the new value.

When a script is evaluated in the Scripting tab the only thing that is modified is the value of the variables, therefore the variable must be assigned to a new value for any change to occur. This is true in most cases except some functions listed below under the heading functionality specific functions.

Multiple statements can be added to one scripting tab provided they are separated by the use of ;.

Note: For changes to reflect, variables must be explicitly assigned new values within scripts. For example, writing in the scripting tab 2 + 2; will not display the value 4 when the document is generated. However if we insert a NumberVariable and write in the scripting value of that Variable to $NumberVariable = 2 + 2; then we will see 4 in the generated document instead of $NumberVariable old value.

We can write any script for any Content Control including PlainText, RichText etc whenever that Control is about to execute the script will be executed just before the evaluation of the Content Control.