How to get started with ALang (W)

Modified on Mon, 5 Oct at 1:53 PM

Deciding to use ALang

Before deciding to use ALang, be aware of the pros and cons. ALang, or Alloy Language, is a "programming language" developed by Omnidocs. ALang is intended to supplement the command calls of OfficeExtensions.

Currently, ALang does not support functionality not already supported in BaseExtensions. Therefore, it is important to ask yourself "do I really need ALang for this implementation?". It can be beneficial to ask a technical colleague this very question as well.

ALang handles complex solutions better than BaseExtensions, but at the same time it is more complex to configure and is bound to cause more headaches than BaseExtensions unless used wisely.

ALang should be considered in solutions where "if this, then that"-complexity is high. Simplified you could say that:

"If this, then that" = BaseExtensions
"If this and this but not this, then that and that but not that" = ALang

Example of usage

One such solution where ALang was fruitfully used to manage a great deal of complexity is RegionH's "A4 Pjece" template. In this case, RegionH needed to be able to change between 7 frontpage layouts in three different layout types, bringing the total number of possible layouts to 21. For each possible layout, up to twenty alterations take place such as moving and colouring shapes and styles etc.

Supporting the "A4 Pjece" in a BaseExtensions module would mean hundreds of lines of command calls, which in turn would pose issues for maintenance as well as performance.

To read more on how ALang can be configured to solve this issue, see this article.

Using ALang

Plugin is located here:

...SD.Installers\AlloyPlugins\RawPlugins\SkabelonDesign.ALang

Place the following command in your module:

XML
<Cmd case="SkabelonDesign.ALang:execute">

Log

When errors occur or something is just not working as it should, you must always take a look at the log. Go to this path and open the .txt file for the program concerned:

%appdata%\OfficeExtensions\User\Temp\Wordlog.txt

The log can be very helpful as it often explains exactly what went wrong when executing ALang.

Example of configuration

Command in module context:

XML
<Button label="Select shapeName" icon="ShapeSelect" size="large" showInWord="false">
 <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>
</Button>

Further configuration

General functionality and configuration of ALang

ExternalFunction feature

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article