Rule-Based Substitution
A rule-based substitution allows for more complex operations by filtering properties based on conditions and then performing one or more actions. The parent elements for rule-based substitutions are Rule, ViewRule, and FrameRule elements. Rule is specific to objects on TheView. ViewRule is specific to TheView. FrameRule is specific to TheFrame.
Example
The following example shows a sample rule-based substitution set:
<Substitutions>
<Set Label="Rule-based Substitution">
<Rule> <!-- Rule applies to objects on TheView -->
<Conditions> <!-- Conditions can include wildcards -->
<Tooltype>TextTool</Tooltype>
<UDC>P*</UDC>
</Conditions>
<Actions>
<Text>%privalue% %priunits%</Text>
</Actions>
</Rule>
<ViewRule> <!-- ViewRule applies to TheView -->
<Conditions>
<SiteService>MYSITE.UIS</SiteService>
</Conditions>
<Actions>
<PrintScale>0.5</PrintScale>
</Actions>
</ViewRule>
<FrameRule> <!-- FrameRule applies to TheFrame-->
<Conditions>
<BorderStyle>1</BorderStyle>
</Conditions>
<Actions>
<Height>768</Height>
<Width>1024</Width>
</Actions>
</FrameRule>
</Set>
</Substitutions>
Rule-based Substitution Elements
Any number of Rule elements can be included in a substitution set. A Rule can have only one Conditions block and one Actions block. However, each block can contain multiple elements.
A rule-based substitution can be used to change only those properties exposed to VBScript. When substituting for properties with Boolean values, you must use -1 for "true" and 0 for "false."
Unlike a standard substitution, Rules, Conditions, and Actions are processed in the order listed. Wildcarding is accepted for Conditions.
Be careful to apply rule-based substitutions only to objects that have the script-accessible properties. Use of ToolType as a Conditions element is useful for this purpose. If listed as the first condition, it will eliminate any non-applicable objects.


