This article includes various examples of how the use ALang. Here, it is illustrated how the different objects and operations can be combined.
Show/hide
This example depict how the visibility of certain shapes can be toggled. When the command is executed, it will search through all shapes in the document. Firstly, it evaluate whether the name of a shape contains "shapeName". If that turns out to be true, the command will show the certain shape. On the other hand, if it returns false, it will execute several If statements. If a shape name contains "Coverpage_" or "hideShapeName", the particular shape will be hidden, while shapes with a name that contains "showShapeName" will be shown in the document.
<Cmd case="SkabelonDesign.ALang:execute">
<ForEach name="Shape" source="Document.Shapes">
<If source="Shape.Name" contains="shapeName">
<True>
<Show target="Shape"/>
</True>
<False>
<If source="Shape.Name" contains="Coverpage_">
<True>
<Hide target="Shape"/>
</True>
</If>
<If source="Shape.Name" contains="showShapeName">
<True>
<Show target="Shape"/>
</True>
</If>
<If source="Shape.Name" contains="hideShapeName">
<True>
<Hide target="Shape"/>
</True>
</If>
</False>
</If>
</ForEach>
</Cmd>
Select shape
The example below shows how we are able to select a shape. When the command is executed, it will go through all shapes in the document and check each one. If the visibility of the shape turns out to be true, it will run the first true branch. In this branch, I have defined that if the name of the shape contains "shapeName", it will select the target which is a shape.
Since I have added the Break
element, it only selects the first shape that contains "shapeName" in its name and then stops the ForEach
. Without the break, it would quickly select every shape where the name contains "shapeName" one by one.
<Cmd case="SkabelonDesign.ALang:execute"> <ForEach name="Shape" source="Document.Shapes"> <If source="Shape.Visible" equals="True"> <True> <If source="Shape.Name" contains="shapeName"> <True> <Select target="Shape"/> <Break/> </True> </If> </True> </If> </ForEach> </Cmd>
Comments
0 comments
Article is closed for comments.