Example
The following example shows how to send trace messages to the Java console. This example uses the following action elements: Trace and Variable update.
You can copy the text of this macro script from this document into the system clipboard, and then from the system clipboard into the Code Editor (see Copy and paste a script from this guide into the Code Editor). After you save this script in the Macro Editor, you can edit it either with the Macro Editor or with the Code Editor.
You should notice the following facts about this example:
- The example consists of one entire macro script named TRACE.
- The <create> element creates a string variable named
$strData$
and initializes it to an original value of'Original value'
. - The first action is a Trace action with the Trace Text set to
'The value is' + $strData$
. - The second action is a Variable update action that sets the variable
$strData$ to a new value of
'Updated value
'. - The third action is another Trace action identical with the first Trace action.
The value is +{$strData$ = Original value}
The value is +{$strData$ = Updated value}
In the trace output
above you should notice that instead of just displaying the value
of $strData$, the Debug action displays both the variable's name and
its value inside curly braces {}.