Insight · Platform

Scripting and Automation in Sparx EA: What’s Possible and What It Takes

The short version: Sparx EA has a powerful built-in scripting and automation capability that most teams never fully use. You can automate diagram generation, model validation, batch reporting, element creation, and custom toolbox behavior — in VBScript, JScript, or C# via the Add-In API. The capability is real. The honest qualifier is that scripting requires dedicated internal capability to build and maintain. Ad hoc scripts written by one architect and abandoned when they move on create more problems than they solve. Sparx Services helps build this capability sustainably in your team — not as a one-off delivery.

What the scripting engine does

Sparx EA’s internal scripting engine is accessible via the Scripting window (Extensions › Scripting in the main menu). It supports three languages:

VBScript: the original and most widely documented option, with a large body of community examples. Synchronous, straightforward, and direct access to the EA Automation Interface. Adequate for most internal automation.

JScript: Microsoft’s JavaScript implementation, syntactically familiar to web developers, with the same Automation Interface access.

C# (via Add-In API): for production-grade automation, the Add-In framework lets you build compiled .NET assemblies that integrate directly into the EA UI — menu items, toolbox entries, ribbon controls, and event handlers. The right choice for team-wide automation that runs regularly and must be reliable.

All three reach the same underlying EA Automation Interface — a COM-based object model that exposes the full repository: packages, elements, connectors, diagrams, attributes, operations, tagged values, and constraints.

The Automation Interface: what you can touch

The Automation Interface is the key to understanding what scripting can and cannot do. Everything in the repository is reachable programmatically: repository navigation (iterate packages, find elements by name, GUID, or type, traverse the full hierarchy); element creation and modification; diagram manipulation (create diagrams, add objects, set positions and formatting, generate images); model search (run SQL queries directly against the repository database, or use EA’s built-in search with custom queries); programmatic validation; document generation; and external data access — EA scripts run in the Windows environment and can use any COM-accessible library.

What the Automation Interface does not do natively: it provides no REST endpoint, and it does not run without an active EA client session — automation scripts require EA to be open.

Practical automation that pays off

The wins are concrete. These are the four scenarios where scripting reliably removes manual effort.

1

Batch diagram generation

If your program produces a defined set of diagrams on a cycle — weekly architecture views, monthly change-impact diagrams, release documentation — these can be scripted to run unattended or at the click of a button, generating consistent images or documents from the current model state. It removes significant recurring effort and enforces a single formatting standard across architects.

2

Model validation scripts

EA’s built-in validation checks UML syntax, but real programs have conventions that go beyond it: every element of type X must have a description; every interface must have a realizing component; every requirement must trace to a design element; no package may exceed a defined element count. These rules become VBScript or C# validators run on demand or as part of a model review, with results written to a report or surfaced as EA model issues.

3

Automated reporting

Scripted reporting extends EA’s native document generation to scheduled or triggered runs, multi-format output (generate RTF, convert to PDF, archive to SharePoint), and data-driven reports that combine model data with external sources — for example joining EA application inventory with CMDB data from a SQL query.

4

Guided MDG element creation

When teams work with custom MDG Technology stereotypes, creating elements with the correct stereotype, tagged values, and parent package is error-prone by hand. Scripts can provide guided creation wizards that prompt for the required information and produce a correctly-formed element, reducing MDG compliance errors.

Integration with external data sources

Sparx EA scripts can call external web services (via WinHTTP or MSXML COM objects), read Excel files (via COM automation), query SQL databases (via ADO), and write results back to the model. Practical examples: pull application data from a CMDB API to populate EA application elements; read requirement data from a Jira or Azure DevOps export to create linked requirement elements; push EA metadata to an external register or governance tool. These integrations demand care — they write to the model and must be idempotent, well-tested, and documented — but they remove the manual synchronization work that otherwise falls on architects.

The Add-In API: production-grade automation

For automation that must be reliable, maintainable, and used by an entire team, the Add-In API is the right approach. A Sparx EA Add-In is a .NET DLL registered as a COM server and declared in the Windows registry. Add-Ins can add custom menu items, ribbon controls, and toolbox pages; react to EA events (element created, diagram opened, model saved); implement custom validators that integrate with EA’s built-in validation framework; add custom property pages for specific stereotypes; and generate custom diagram layouts. The development workflow is a software-engineering discipline — version control, unit testing, build pipeline, deployment packaging. Teams that approach Add-In development as “a quick script” consistently underestimate the maintenance burden.

When not to automate

The honest assessment: scripting in Sparx EA is not always the right answer.

A VBScript file that no current team member understands is an operational liability.

Don’t automate one-off tasks — if you need to bulk-update 500 elements once, write it, run it, delete it. Don’t automate rapidly-changing model structures — scripts that rely on specific element types break when the model is reorganized; stabilize the structure first. Don’t replace native EA capabilities with custom scripts — confirm EA’s built-in document generation, model search, and templates genuinely can’t do what you need before writing anything. And don’t automate without a skill owner: before committing to an automation investment, confirm that at least one person can maintain it.

The maintenance burden teams underestimate

Scripting in EA is deceptively easy to start — VBScript is accessible, the Automation Interface is well-documented, and early scripts often work quickly. The maintenance burden emerges later: EA version upgrades occasionally change API behavior; model-structure changes break element-finding logic; scripts written for one project get repurposed for another with different conventions and fail silently; and the person who wrote the script leaves the team. Sparx Services addresses this directly — scripts and Add-Ins we produce are documented to a defined standard, tested against the team’s actual repository, and handed over to at least two team members. We do not deliver a script without delivering the capability to maintain it.

Frequently asked questions

What scripting languages does Sparx EA support?

The internal scripting engine supports VBScript and JScript. For production Add-Ins — compiled automation integrated into the EA UI — the Add-In API uses .NET (C# or VB.NET). VBScript is the most widely used for internal scripts because of the large community knowledge base. For any automation that will be team-wide and regularly used, the Add-In framework with C# is the appropriate choice.

Can I automate diagram generation in Sparx EA?

Yes. The Automation Interface provides programmatic access to diagrams — create them, add elements, set positions and formatting, and generate image or document output. Batch diagram generation across a portfolio of applications is one of the most common use cases. Output quality depends on how well the underlying model elements are connected; automation cannot compensate for a poorly-structured model.

What’s the difference between EA scripting and EA Add-Ins?

Scripts (VBScript or JScript) run inside the EA scripting engine — quick to develop, no compilation, good for personal or team-internal automation. Add-Ins are compiled .NET assemblies that extend the EA application itself — menu items, toolbox pages, event handlers, custom UI. Add-Ins are the right choice for team-wide production automation; scripts are right for per-project or personal automation. Both access the same underlying Automation Interface.

When should a team invest in EA scripting capability?

Invest when you have a stable model structure scripts can rely on, a repeating task that consumes significant manual effort, and at least one team member who can own the scripts long-term. Do not invest in scripting as a substitute for good MDG governance — a well-structured model with consistent stereotypes and tagged values produces better results from EA’s native capabilities than a poorly-structured model with complex scripts layered on top.

Build automation you can actually maintain.

Talk to a practitioner about custom validators, automated reporting, and integration scripts — delivered with the capability to keep them running.

Book a call →