Impact 2024 now released, bringing with it a host of new features. Details here.

Overview of Automation

Impact has a powerful mechanism by which many tasks can be automated, using scripts (written in VBScript) or compiled plug-in libraries (written in various languages) or macros (written in our proprietary macro language, IML). 

Automation may be used in many places with Impact, for example you can use it to:

  • create custom tools for your users
  • create custom tasks which are triggered automatically (for example whenever any project is saved)
  • create custom text entities which are automatically calculated (for example to appear on a report) 
  • calculate specific values to be written to the database (value mappings)

COM

Impact has an extensive application programming interface (API) implemented using Microsoft’s Component Object Model (COM), comprising many hundreds of functions. The way that your script or plug-in will interact with Impact is via this COM API.

The Impact object model corresponds closely to the things you will already be familiar with from the user interface, with objects representing drawings, layers, blocks, lines, arcs, palettes and so on. 

The COM interfaces are described in detail in a separate document, along with numerous example code snippets. This document is available on request from Arden Software.

Scripts

Scripts may be written in Microsoft Visual Basic Scripting Edition (commonly referred to as VBScript or VBS). There are very many online resources for this language. VBScript is an interpreted language – it does not need to be complied. Impact runs scripts by using the Microsoft Script Control, which is a core part of Windows.

Often scripts are short pieces of code for performing relatively simple tasks. Although long complex scripts may be developed, it is usually a better alternative to do such developments as a plug-in. 

Script writers will often use the Script Toolbox to write and test small to medium sized pieces of code. However, as a script gets longer it is usually better to use a code editor with more advanced features (for example Notepad++).

Plug-ins

For more complex developments, there are many advantages to creating a plug-in rather than a script. Firstly, you have a wide choice of languages – any language that supports COM, for example VB.Net, C#, Delphi Pascal. Secondly, you will use a development environment, such as Visual Studio or Delphi, with powerful development tools including debuggers and user interface design tools. Thirdly, you will distribute binary DLLs rather than text-based scripts, so your code will be more secure.

Plug-ins can be registered and executed using the Plugin Manager tool. 

Macros

Impact does have its own macro language (IML), but its use is no longer recommended. Macros use their own legacy API that is very limited and is no longer being developed (as opposed to the COM-based API that is continually being extended). 

Macros may be compiled and run using the Macro Tools. However, we advise automation developers not to create macros and to replace any existing macros with scripts or plug-ins.

Installation Settings

Many automation-related settings can be found in the Automation section of the Database Installation settings. This includes auto-tasks (see below), Persisted Globals, configured tools and VBScript include files. 

Custom Tools

There are two ways that you can add custom automation tools to the user interface. Firstly, you can add them to the Automation menu, by configuring the item (script, plug-in or macro) in the Automation Tools settings. By doing this you are making the tool visible for all users. 

Alternatively, you can add the item to a custom menu item or button by using the Customize feature and choosing New Menu Item. In this case, the tool is specific to you, until you make it part of a saved appearance. 

Auto-tasks

You can associate scripts, plug-ins or macros with certain events, such as whenever the user opens a project, or saves a project, or plots, or runs a standard. There are many such events that you can use to trigger an automation task; you can configure these in the Automation Auto-Tasks section of the Database Installation settings. 

Value Mappings

Value mappings are commonly used to calculate values using a script and write those values to the database. Like auto-tasks, value mappings may be associated with certain events such as running a standard or saving a project. 

These mappings are created via Value Mappings master tool settings and then configured in the Value Mappings section of the Database Installation settings. 

Text Entities

The content of a text entity may be partially or fully calculated using a script, plug-in or macro. Such a calculated text entity could be used within a project, but more often would be used in a symbol or report template. 

The automation code can be embedded (in the case of a script) or referenced from a file (for scripts, plug-ins or macros) using the Text Editor form. 

Script Signing

By digitally signing a script, the developer can ensure that it has not been altered since it was written. Signatures appear as a block of comment lines at the end of the script code, and Impact verifies the signature prior to script execution. If the signature is not there, or does not match the script, an error or warning can be displayed. 

Both embedded scripts and script files may be signed. A signature may be added to a script using any form that allows you to enter script code, most notably the Script Toolbox

Scripts provided by Arden Software will often be signed before delivery. If any other script developer wishes to sign their scripts, they should obtain their own certificate from a Certificate Authority (CA) such as VeriSign or Comodo.

The verification of script signatures can be controlled from the Security section of the Workstation settings. 

Plug-ins are not signed in the same way as scripts - the development environment (for example Visual Studio) will provide tools for signing DLL assemblies. Macros may not be signed and should be avoided where possible.

Impact Auto Plug-ins (IAPs)

IAPs allow a script or plug-in developer to easily and effectively distribute packages of customised functionality to other Impact users. These users benefit from seamless integration of these automation tools with their appearance settings.

Impact nServer

It is possible to run automation tasks on a server, independent of any user’s Impact workstation, using the nServer software. This is a separate product that runs as a COM+ Service without any user interface, offering the same COM interfaces as Impact. For more information about the nServer product, please contact Arden Software.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.

You may like to read -