Onetastic Macro Documentation >
>
Using variables Using variables
Macro language has variables, for temporarily storing and manipulating
information. Variables can be of various types including
objects and arrays.
Variables are named with a dollar sign ($) followed by an identifier. The valid
characters in the variable name are a-z, A-Z, 0-9 and underscore (_). Following
macro demonstrate use of variables to store the list of cells in a page and
to store the text of the first cell to fill the rest of the cells with:
$Cells = QueryObjects("Cell", GetCurrentPage())
$i = 0
foreach ($Cell in $Cells)
if ($i == 0)
$TextOfFirstCell = $Cell.text
else
$Cell.text = $TextOfFirstCell
$i += 1
Here $Cells, $Cell, $i, $TextOfFirstCell are all variables storing an array of
Cell objects, a Cell object, an integer, and a string
respectively.
|