Scripting hierarchy
The scriptable functionality of Canvas is presented in a hierarchical
structure as it is common for Automation on Windows. A similar
hierarchy is used by Apple Computers AppleScript. The hierarchy is
organized in a way that mirrors the layout of Canvas. Objects in the
scripting hierarchy represent items of Canvas. The application object
is on the highest level. Objects for open documents, which contain
page objects, are below the application object. The page objects hold
layer objects, which contain the drawing objects that are present in
Canvas.
A scripts hierarchy is a snapshot of the current state of Canvas. Each
object in the hierarchy provides a certain functionality of Canvas that
is associated with a particular item. For example, the layer object has
functionality for setting and retrieving its name, accessing the draw-
ing objects that reside on it, retrieving the page object it resides on,
etc. The user can use this functionality to control Canvas through a
scripting language. For example, that user could go to the fifth layer
and change its name.
Methods and properties
Each object in the scripting hierarchy has properties and methods. A
property represents a certain characteristic of the object and has a
specific type (For example: Integer or String). A property can be set
by assigning it a value. It can also be accessed to check its current
state. For example, Width is a property of drawing objects. You can
set it to 144 pixels (all distances in scripting for Canvas are measured
in pixels):
drawingObject.Width = 144
or you can check whether it is wider than 72 pixel:
if (drawingObject.Width > 72) Then
...
End If
Methods represent operations that can be performed with the object.
They can have multiple parameters as input. In addition, methods can
produce multiple output values. For example, moving a drawing
object is an operation performed by the Move method. Move takes
the x and y offsets as parameters. The following line moves a draw-
ing object by 300 pixels over to the right and by 90 pixels down:
drawingObject.Move 300, 90